Restrict CI matrix to consumer smoke tests only #92
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: Isolated Smoke Test & Report | |
| on: | |
| push: {} | |
| pull_request: {} | |
| workflow_dispatch: {} | |
| jobs: | |
| collect-test-files: | |
| if: true # Workflow paused - set to true to re-enable | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - id: set-matrix | |
| name: Find all smoke test files and build matrix | |
| run: | | |
| readarray -t files < <(find tests -type f -path "*consumer/smoke/test_*.py") | |
| includes=(); i=0 | |
| for file in "${files[@]}"; do | |
| flow=$(echo "$file" | awk -F'/' '{print $2}') | |
| idx=$(( (i % 2) + 1 )) | |
| includes+=("{\"flow\":\"$flow\",\"test_file\":\"$file\",\"user_index\":$idx}") | |
| i=$((i + 1)) | |
| done | |
| joined=$(printf ",%s" "${includes[@]}") | |
| matrix="[${joined:1}]" | |
| echo "matrix={\"include\":${matrix}}" >> "$GITHUB_OUTPUT" | |
| test: | |
| needs: collect-test-files | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: ${{ fromJson(needs.collect-test-files.outputs.matrix) }} | |
| env: | |
| HOME_URL_DEV: ${{ secrets.HOME_URL_DEV }} | |
| TEST_EMAIL_1: ${{ secrets.TEST_EMAIL_1 }} | |
| TEST_PASSWORD_1: ${{ secrets.TEST_PASSWORD_1 }} | |
| TEST_EMAIL_2: ${{ secrets.TEST_EMAIL_2 }} | |
| TEST_PASSWORD_2: ${{ secrets.TEST_PASSWORD_2 }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Dump TEST env vars | |
| run: | | |
| echo ">>> All TEST_* vars >>>" | |
| env | grep '^TEST_' || echo "(none)" | |
| - name: Cache pip | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-json-report python-dotenv pytest-xdist | |
| - name: Run ${{ matrix.test_file }} (User #${{ matrix.user_index }}) | |
| env: | |
| TEST_USER_INDEX: ${{ matrix.user_index }} | |
| run: | | |
| echo "=== Running ${{ matrix.test_file }} as user #$TEST_USER_INDEX ===" | |
| if [ "$TEST_USER_INDEX" = "1" ]; then | |
| export TEST_EMAIL="$TEST_EMAIL_1" | |
| export TEST_PASSWORD="$TEST_PASSWORD_1" | |
| else | |
| export TEST_EMAIL="$TEST_EMAIL_2" | |
| export TEST_PASSWORD="$TEST_PASSWORD_2" | |
| fi | |
| pytest -n auto "${{ matrix.test_file }}" -v --json-report | |
| - name: List screenshots | |
| if: always() | |
| run: | | |
| echo "=== Screenshots directory contents ===" | |
| ls -la screenshots || echo "(none)" | |
| - name: Upload Screenshots | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: screenshots-${{ matrix.flow }}-user${{ matrix.user_index }} | |
| path: screenshots/ |