diff --git a/.github/workflows/presubmits.yml b/.github/workflows/presubmits.yml new file mode 100644 index 0000000..9732469 --- /dev/null +++ b/.github/workflows/presubmits.yml @@ -0,0 +1,30 @@ +name: json-yaml-validate +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + pull-requests: write + +jobs: + validate-signals: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Checkout schemas repo + uses: actions/checkout@v4 + with: + repository: OBDb/.schemas + path: .schemas + + - name: Validate signalsets + id: json-yaml-validate-v3 + uses: GrantBirki/json-yaml-validate@v2.7.1 + with: + comment: "true" + base_dir: signalsets/v3/ + json_schema: .schemas/signals.json diff --git a/.github/workflows/response_tests.yml b/.github/workflows/response_tests.yml new file mode 100644 index 0000000..5aea0ea --- /dev/null +++ b/.github/workflows/response_tests.yml @@ -0,0 +1,65 @@ +name: Response tests + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + pull-requests: write + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Run tests in devcontainer + id: test + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/obdb/devcontainer + push: never + env: | + GITHUB_SERVER_URL=${{ github.server_url }} + GITHUB_REPOSITORY=${{ github.repository }} + GITHUB_SHA=${{ github.sha }} + GITHUB_RUN_ID=${{ github.run_id }} + runCmd: | + pytest tests/ --ignore=tests/schemas -xvs -n auto > ./test-output.txt 2>&1 + TEST_EXIT=$? + cat ./test-output.txt + + # Format results for PR comment with all required arguments + /usr/local/bin/format-test-results.sh \ + test-output.txt \ + $TEST_EXIT \ + "$GITHUB_SERVER_URL" \ + "$GITHUB_REPOSITORY" \ + "$GITHUB_SHA" \ + "$GITHUB_RUN_ID" \ + > ./test-results.md || true + + # Exit with the actual test result + exit $TEST_EXIT + + - name: Set test results output + if: always() && github.event_name == 'pull_request' + run: | + if [ -f test-results.md ]; then + { + echo 'TEST_RESULTS<> $GITHUB_ENV + fi + + - name: Comment test results on PR + if: always() && github.event_name == 'pull_request' + uses: thollander/actions-comment-pull-request@v2 + with: + message: ${{ env.TEST_RESULTS }} + comment_tag: response-tests diff --git a/.gitignore b/.gitignore index 2173fa5..17717bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ -build/ -__pycache__/ -workspace/ -node_modules +tests/schemas/ +__pycache__ +.claude/skills +.claude/settings.local.json +tests/*.py +.vscode/*.json