|
| 1 | +name: Integration Tests |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run weekly on Sunday at midnight UTC |
| 6 | + - cron: '0 0 * * 0' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + use_live_api: |
| 10 | + description: 'Use live API instead of cached responses' |
| 11 | + required: false |
| 12 | + default: 'false' |
| 13 | + type: choice |
| 14 | + options: |
| 15 | + - 'true' |
| 16 | + - 'false' |
| 17 | + |
| 18 | +jobs: |
| 19 | + integration-tests-cached: |
| 20 | + name: Integration Tests (Cached) |
| 21 | + runs-on: ubuntu-latest |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Install uv |
| 27 | + uses: astral-sh/setup-uv@v4 |
| 28 | + with: |
| 29 | + version: "latest" |
| 30 | + |
| 31 | + - name: Set up Python |
| 32 | + run: uv python install 3.12 |
| 33 | + |
| 34 | + - name: Install dependencies |
| 35 | + run: uv sync --all-extras |
| 36 | + |
| 37 | + - name: Run integration tests with cached responses |
| 38 | + run: uv run pytest tests/integration/ -m integration -v |
| 39 | + env: |
| 40 | + TANGO_USE_LIVE_API: false |
| 41 | + |
| 42 | + - name: Upload test results |
| 43 | + if: always() |
| 44 | + uses: actions/upload-artifact@v4 |
| 45 | + with: |
| 46 | + name: integration-test-results-cached |
| 47 | + path: | |
| 48 | + .coverage |
| 49 | + coverage.xml |
| 50 | + retention-days: 30 |
| 51 | + |
| 52 | + integration-tests-live: |
| 53 | + name: Integration Tests (Live API) |
| 54 | + runs-on: ubuntu-latest |
| 55 | + # Only run live tests on scheduled runs or when explicitly requested |
| 56 | + if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.use_live_api == 'true') |
| 57 | + |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v4 |
| 60 | + |
| 61 | + - name: Install uv |
| 62 | + uses: astral-sh/setup-uv@v4 |
| 63 | + with: |
| 64 | + version: "latest" |
| 65 | + |
| 66 | + - name: Set up Python |
| 67 | + run: uv python install 3.12 |
| 68 | + |
| 69 | + - name: Install dependencies |
| 70 | + run: uv sync --all-extras |
| 71 | + |
| 72 | + - name: Run integration tests with live API |
| 73 | + run: uv run pytest tests/integration/ -m integration -v |
| 74 | + env: |
| 75 | + TANGO_USE_LIVE_API: true |
| 76 | + TANGO_API_KEY: ${{ secrets.TANGO_API_KEY }} |
| 77 | + |
| 78 | + - name: Upload test results |
| 79 | + if: always() |
| 80 | + uses: actions/upload-artifact@v4 |
| 81 | + with: |
| 82 | + name: integration-test-results-live |
| 83 | + path: | |
| 84 | + .coverage |
| 85 | + coverage.xml |
| 86 | + retention-days: 30 |
| 87 | + |
| 88 | + - name: Notify on failure |
| 89 | + if: failure() |
| 90 | + run: | |
| 91 | + echo "::warning::Integration tests with live API failed. This may indicate API changes or issues." |
0 commit comments