name: integration tests on: # run after staging deployment completes workflow_run: workflows: ["deploy staging"] types: - completed branches: - main # allow manual trigger workflow_dispatch: inputs: skip_if_no_tokens: description: "Skip tests if tokens not configured (vs fail)" type: boolean default: true permissions: contents: read jobs: integration: name: run integration tests runs-on: ubuntu-latest # only run if staging deploy succeeded (or manual trigger) if: > github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' timeout-minutes: 15 steps: - uses: actions/checkout@v4 - name: check token configuration id: check-tokens run: | if [ -z "${{ secrets.PLYR_TEST_TOKEN_1 }}" ]; then echo "has_tokens=false" >> $GITHUB_OUTPUT echo "::warning::PLYR_TEST_TOKEN_1 not configured - integration tests will be skipped" else echo "has_tokens=true" >> $GITHUB_OUTPUT fi - name: set up python if: steps.check-tokens.outputs.has_tokens == 'true' uses: actions/setup-python@v5 with: python-version: "3.12" - name: install uv if: steps.check-tokens.outputs.has_tokens == 'true' uses: astral-sh/setup-uv@v7 with: enable-cache: true cache-dependency-glob: "backend/uv.lock" - name: install dependencies if: steps.check-tokens.outputs.has_tokens == 'true' run: cd backend && uv sync --locked - name: install ffmpeg if: steps.check-tokens.outputs.has_tokens == 'true' run: sudo apt-get update && sudo apt-get install -y ffmpeg - name: run integration tests if: steps.check-tokens.outputs.has_tokens == 'true' env: PLYR_API_URL: https://api-stg.plyr.fm PLYR_TEST_TOKEN_1: ${{ secrets.PLYR_TEST_TOKEN_1 }} PLYR_TEST_TOKEN_2: ${{ secrets.PLYR_TEST_TOKEN_2 }} PLYR_TEST_TOKEN_3: ${{ secrets.PLYR_TEST_TOKEN_3 }} run: | cd backend uv run pytest tests/integration -m integration -v --tb=short - name: prune uv cache if: always() run: uv cache prune --ci