|
| 1 | +name: Staging tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [labeled] |
| 6 | + branches: |
| 7 | + - master |
| 8 | + - 'rel/**' |
| 9 | + issue_comment: |
| 10 | + types: [created] |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + test_envs: |
| 14 | + description: 'Tox test environments to run (e.g. py312)' |
| 15 | + required: false |
| 16 | + default: 'py314' |
| 17 | + test_filter: |
| 18 | + description: 'Pytest filter expression (-k flag)' |
| 19 | + required: false |
| 20 | + default: '' |
| 21 | + |
| 22 | +concurrency: |
| 23 | + group: staging-tests |
| 24 | + cancel-in-progress: false |
| 25 | + |
| 26 | +jobs: |
| 27 | + staging-tests: |
| 28 | + name: Staging tests |
| 29 | + if: >- |
| 30 | + github.event_name == 'workflow_dispatch' || |
| 31 | + (github.event_name == 'pull_request' && github.event.label.name == 'test-staging') || |
| 32 | + (github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '/test-staging')) |
| 33 | + runs-on: |
| 34 | + group: infra1-runners-arc |
| 35 | + labels: runners-small |
| 36 | + steps: |
| 37 | + - name: Get PR head SHA (comment trigger) |
| 38 | + if: github.event_name == 'issue_comment' |
| 39 | + id: pr |
| 40 | + run: | |
| 41 | + PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}) |
| 42 | + echo "sha=$(echo "$PR_DATA" | jq -r .head.sha)" >> "$GITHUB_OUTPUT" |
| 43 | + echo "ref=$(echo "$PR_DATA" | jq -r .head.ref)" >> "$GITHUB_OUTPUT" |
| 44 | + env: |
| 45 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + |
| 47 | + - name: Checkout |
| 48 | + uses: actions/checkout@v4 |
| 49 | + with: |
| 50 | + ref: ${{ steps.pr.outputs.sha || github.event.pull_request.head.sha || github.sha }} |
| 51 | + |
| 52 | + - name: Set up Python |
| 53 | + uses: astral-sh/setup-uv@v6 |
| 54 | + with: |
| 55 | + python-version: '3.14' |
| 56 | + |
| 57 | + - name: Install dependencies |
| 58 | + run: uv sync --group test --locked |
| 59 | + |
| 60 | + - name: Clean staging environment |
| 61 | + run: make clean-staging |
| 62 | + env: |
| 63 | + TOKEN: ${{ secrets.PYTHON_SDK_STG_API_KEY }} |
| 64 | + |
| 65 | + - name: Load staging environment |
| 66 | + run: make load-staging |
| 67 | + env: |
| 68 | + TOKEN: ${{ secrets.PYTHON_SDK_STG_API_KEY }} |
| 69 | + |
| 70 | + - name: Run staging tests |
| 71 | + run: | |
| 72 | + make test-staging \ |
| 73 | + TEST_ENVS=${{ github.event.inputs.test_envs || 'py314' }} \ |
| 74 | + ADD_ARGS="${{ github.event.inputs.test_filter && format('-k {0}', github.event.inputs.test_filter) || '' }}" |
| 75 | + env: |
| 76 | + TOKEN: ${{ secrets.PYTHON_SDK_STG_API_KEY }} |
0 commit comments