CI #2976
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: CI | |
| on: | |
| push: | |
| schedule: | |
| # Every day at ~7:17am Chicago time. | |
| # | |
| # Using a non-zero minute offset since GitHub Actions suggests | |
| # running jobs at a random minute to avoid overloading their | |
| # servers. | |
| # | |
| # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule | |
| - cron: '17 12 * * *' | |
| # Cancel in progress runs of this workflow when we push changes to the branch | |
| # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| POETRY_VERSION: '1.7.1' | |
| jobs: | |
| pre-commit-checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: '.python-version' | |
| - name: Install poetry | |
| run: curl -sSL https://install.python-poetry.org | python3 - | |
| - name: Check pyproject.toml & poetry.lock are in sync | |
| run: poetry lock --check | |
| - name: Install poetry-relax plugin | |
| run: poetry self add poetry-relax | |
| - name: Install dev dependencies | |
| run: poetry install | |
| - name: Run pre-commit checks | |
| uses: pre-commit/action@v3.0.1 | |
| - name: Validate renovate config | |
| run: npx --package renovate renovate-config-validator --strict | |
| tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - '3.9' | |
| - '3.10' | |
| - '3.11' | |
| - '3.12' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install poetry | |
| run: curl -sSL https://install.python-poetry.org | python3 - | |
| - name: Check pyproject.toml & poetry.lock are in sync | |
| run: poetry check --lock | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Run tests | |
| run: poetry run pytest tests/autoblocks | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| - name: Run e2e tests | |
| run: poetry run pytest tests/e2e/test_e2e.py | |
| env: | |
| # Org-scoped API key | |
| AUTOBLOCKS_API_KEY: ${{ secrets.CI_AUTOBLOCKS_API_KEY }} | |
| # User-scoped API key | |
| AUTOBLOCKS_API_KEY_USER: ${{ secrets.CI_AUTOBLOCKS_API_KEY_USER_NICOLE }} | |
| AUTOBLOCKS_INGESTION_KEY: ${{ secrets.CI_AUTOBLOCKS_INGESTION_KEY }} | |
| - name: Run e2e prompts v2 tests | |
| run: poetry run pytest tests/e2e/test_prompts_v2.py | |
| env: | |
| AUTOBLOCKS_V2_API_KEY: ${{ secrets.CI_AUTOBLOCKS_V2_API_KEY }} | |
| - name: Run e2e datasets tests | |
| run: poetry run pytest tests/e2e/test_datasets.py | |
| env: | |
| AUTOBLOCKS_V2_API_KEY: ${{ secrets.CI_AUTOBLOCKS_V2_API_KEY }} | |
| - name: Run e2e app client tests | |
| run: poetry run pytest tests/e2e/test_app_client.py | |
| env: | |
| AUTOBLOCKS_V2_API_KEY: ${{ secrets.CI_AUTOBLOCKS_V2_API_KEY }} | |
| notify: | |
| needs: | |
| - tests | |
| if: always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: slackapi/slack-github-action@v2.1.1 | |
| with: | |
| payload: | | |
| { | |
| "text": ":warning: Workflow `${{ github.workflow }}` in repository `${{ github.repository }}` failed. <${{ env.run-url }}|Logs>" | |
| } | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
| run-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |