feat: Add stub Explorer endpoints for self-hosted compatibility #35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| push: | |
| branches: [main, experimental] | |
| pull_request: | |
| merge_group: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| build_and_push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| packages: "write" | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3 | |
| - id: "auth" | |
| uses: google-github-actions/auth@v2 | |
| continue-on-error: true | |
| with: | |
| credentials_json: ${{ secrets.GCP_SA_KEY }} | |
| - name: Compute requirements hash | |
| id: req-hash | |
| run: echo "hash=$(sha256sum requirements.txt | cut -c1-8)" >> $GITHUB_OUTPUT | |
| - name: Build and push Docker image | |
| run: | | |
| make .env | |
| # Use requirements hash in cache key to invalidate when deps change | |
| CACHE_KEY="ghcr.io/${{ github.repository_owner }}/seer:cache-${{ steps.req-hash.outputs.hash }}" | |
| docker buildx bake --file docker-compose.yml --file docker-compose-cache.json \ | |
| --set *.cache-to=type=registry,ref=${CACHE_KEY},mode=max \ | |
| --set *.cache-from=type=registry,ref=${CACHE_KEY} \ | |
| --set *.output=type=registry \ | |
| --set *.tags=ghcr.io/${{ github.repository_owner }}/seer:cache-${{ github.sha }} | |
| typecheck: | |
| needs: [build_and_push] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| packages: "read" | |
| env: | |
| IMAGE_TAG: cache-${{ github.sha }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull pre-built Docker image | |
| run: | | |
| docker pull ghcr.io/${{ github.repository_owner }}/seer:${IMAGE_TAG} | |
| cp docker-compose.ci.yml docker-compose.override.yml | |
| - name: Create blank .env | |
| run: make .env | |
| - name: Typecheck with mypy | |
| run: docker compose run app mypy | |
| test: | |
| name: Parallelized Tests | |
| needs: [build_and_push] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| packages: "read" | |
| env: | |
| TEST: 1 | |
| IMAGE_TAG: cache-${{ github.sha }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - id: "auth" | |
| uses: google-github-actions/auth@v2 | |
| continue-on-error: true | |
| with: | |
| credentials_json: ${{ secrets.GCP_SA_KEY }} | |
| - name: Set up Cloud SDK | |
| uses: google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b # v1 | |
| - name: Pull pre-built Docker image | |
| run: | | |
| docker pull ghcr.io/${{ github.repository_owner }}/seer:${IMAGE_TAG} | |
| cp docker-compose.ci.yml docker-compose.override.yml | |
| - name: Create blank .env | |
| run: make .env | |
| - name: Migrate database | |
| run: docker compose run app flask db upgrade | |
| - name: Validate no pending migrations | |
| run: make check-no-pending-migrations | |
| - name: Decrypt VCR cassettes | |
| run: | | |
| pip install -r scripts/requirements.txt | |
| make vcr-decrypt | |
| - name: Fetch models | |
| if: github.event_name == 'push' | |
| continue-on-error: true | |
| run: | | |
| rm -rf ./models | |
| gcloud storage cp -r gs://sentry-ml/seer/models ./ || { | |
| echo "Models not accessible, using NO_REAL_MODELS mode" | |
| mkdir -p models | |
| echo "# Placeholder" > models/.keep | |
| } | |
| - name: Set test environment flags | |
| run: | | |
| # Check if models directory has real models (not just placeholder) | |
| if [[ -d "./models" && $(find ./models -type f ! -name '.keep' ! -name '.gitignore' | head -1) ]]; then | |
| echo "EXTRA_COMPOSE_TEST_OPTIONS=-e NO_SENTRY_INTEGRATION=1 -e CI=1 -e GITHUB_TOKEN=${{ secrets.GH_PAT }}" >> $GITHUB_ENV | |
| else | |
| echo "EXTRA_COMPOSE_TEST_OPTIONS=-e NO_REAL_MODELS=1 -e NO_SENTRY_INTEGRATION=1 -e CI=1 -e GITHUB_TOKEN=${{ secrets.GH_PAT }}" >> $GITHUB_ENV | |
| fi | |
| - name: Test with pytest | |
| run: | | |
| docker compose up -d test-db | |
| docker compose run ${{ env.EXTRA_COMPOSE_TEST_OPTIONS }} app bash -c "\ | |
| pip install pytest-split && \ | |
| pytest --splits 10 --group ${{ matrix.group }} --splitting-algorithm least_duration --cov . --cov-report=\"xml:.artifacts/coverage.xml\" -vv" | |
| - name: Upload to codecov | |
| if: ${{ always() }} | |
| uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ".artifacts/coverage.xml" | |
| override_commit: ${{ github.event.pull_request.head.sha }} | |
| plugin: noop | |
| verbose: true | |
| finish: | |
| name: ${{ github.event_name == 'push' && 'Finish Tests (Main)' || 'Finish Tests' }} | |
| needs: [test, typecheck] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Check test results | |
| run: | | |
| if [[ "${{ needs.test.result }}" == "success" && "${{ needs.typecheck.result }}" == "success" ]]; then | |
| echo "All tests completed successfully" | |
| else | |
| echo "Tests failed. Check the logs for details." | |
| exit 1 | |
| fi |