|
| 1 | +name: Full Tests (maintainer only) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + pr: |
| 7 | + description: "PR number" |
| 8 | + required: true |
| 9 | + ref_kind: |
| 10 | + description: "Which ref to test (merge|head)" |
| 11 | + required: false |
| 12 | + default: "merge" |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: full-tests-pr-${{ github.event.inputs.pr }}-${{ github.event.inputs.ref_kind }} |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | + |
| 22 | +jobs: |
| 23 | + full-tests: |
| 24 | + if: ${{ github.repository_owner == 'confident-ai' }} |
| 25 | + runs-on: ubuntu-latest |
| 26 | + timeout-minutes: 60 |
| 27 | + environment: ci-secrets |
| 28 | + env: |
| 29 | + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Resolve ref |
| 33 | + id: refsel |
| 34 | + run: | |
| 35 | + if [ "${{ github.event.inputs.ref_kind }}" = "head" ]; then |
| 36 | + echo "ref=refs/pull/${{ github.event.inputs.pr }}/head" >> $GITHUB_OUTPUT |
| 37 | + else |
| 38 | + # test what would merge |
| 39 | + echo "ref=refs/pull/${{ github.event.inputs.pr }}/merge" >> $GITHUB_OUTPUT |
| 40 | + fi |
| 41 | +
|
| 42 | + - name: Checkout PR ref |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + ref: ${{ steps.refsel.outputs.ref }} |
| 46 | + fetch-depth: 0 |
| 47 | + |
| 48 | + - name: Set up Python |
| 49 | + id: setup-python |
| 50 | + uses: actions/setup-python@v4 |
| 51 | + with: |
| 52 | + python-version: "3.11" |
| 53 | + |
| 54 | + - name: Install Poetry |
| 55 | + uses: snok/install-poetry@v1 |
| 56 | + with: |
| 57 | + virtualenvs-create: true |
| 58 | + virtualenvs-in-project: true |
| 59 | + installer-parallel: true |
| 60 | + |
| 61 | + - name: Cache virtualenv |
| 62 | + id: cached-poetry-dependencies |
| 63 | + uses: actions/cache@v3 |
| 64 | + with: |
| 65 | + path: .venv |
| 66 | + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 67 | + |
| 68 | + # Core deps only (main) |
| 69 | + - name: Install dependencies (main) |
| 70 | + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' |
| 71 | + run: poetry install --no-interaction --no-root --only main |
| 72 | + |
| 73 | + - name: Install project (main) |
| 74 | + run: poetry install --no-interaction --only main |
| 75 | + |
| 76 | + #---------------------------------------------- |
| 77 | + # run test suite |
| 78 | + #---------------------------------------------- |
| 79 | + |
| 80 | + # Run Core tests |
| 81 | + - name: Run core tests (with secrets) |
| 82 | + if: ${{ env.OPENAI_API_KEY != '' }} |
| 83 | + run: | |
| 84 | + poetry run pytest -vv -rA --maxfail=1 --capture=tee-sys \ |
| 85 | + tests/test_core/ \ |
| 86 | + --ignore=tests/test_core/test_synthesizer/ \ |
| 87 | + --ignore=tests/test_core/test_datasets/ |
| 88 | +
|
| 89 | + - name: Run core tests (no secrets) |
| 90 | + if: ${{ env.OPENAI_API_KEY == '' }} |
| 91 | + run: | |
| 92 | + poetry run pytest -vv -rA --maxfail=1 --capture=tee-sys \ |
| 93 | + tests/test_core/ \ |
| 94 | + --ignore=tests/test_core/test_synthesizer/ \ |
| 95 | + --ignore=tests/test_core/test_datasets/ \ |
| 96 | + --ignore=tests/test_core/test_evaluation/test_end_to_end/test_configs.py \ |
| 97 | + --ignore=tests/test_core/test_tracing/test_dataset_iterator.py |
| 98 | +
|
| 99 | + # Install dev dependencies and run dev tests |
| 100 | + - name: Install dev dependencies |
| 101 | + run: poetry install --no-interaction --with dev |
| 102 | + |
| 103 | + - name: Run dev tests (with secrets) |
| 104 | + if: ${{ env.OPENAI_API_KEY != '' }} |
| 105 | + run: | |
| 106 | + poetry run pytest -vv -rA --maxfail=1 --capture=tee-sys -o faulthandler_timeout=300 \ |
| 107 | + tests/test_core/test_synthesizer/ tests/test_core/test_datasets/ |
| 108 | +
|
| 109 | + - name: Run dev tests (no secrets) |
| 110 | + if: ${{ env.OPENAI_API_KEY == '' }} |
| 111 | + run: | |
| 112 | + poetry run pytest -vv -rA --maxfail=1 --capture=tee-sys -o faulthandler_timeout=300 \ |
| 113 | + tests/test_core/test_datasets/ |
0 commit comments