try to parallelize workflow #3
Workflow file for this run
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: prototype tests | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| device: | ||
| description: 'Device to test (exact name)' | ||
| required: false | ||
| default: 'Desktop Chrome' | ||
| programmes: | ||
| description: 'Programmes to use (HPV, MENACWY, TD_IPV, FLU)' | ||
| required: false | ||
| default: 'HPV,MENACWY,TD_IPV,FLU' | ||
| environment: | ||
| description: 'Environment to run tests on (qa, test, training)' | ||
| required: false | ||
| default: 'qa' | ||
| set_feature_flags: | ||
| description: 'Enable feature flags to be changed in the flipper page (true/false)' | ||
| required: false | ||
| default: 'false' | ||
| additional_feature_flags: | ||
| description: '(If enabled above) Additional feature flags to set. api, basic_auth, dev_tools will be set by default' | ||
| required: false | ||
| default: '' | ||
| pull_request: | ||
| jobs: | ||
| test: | ||
| name: prototype tests | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| partition: [0, 1, 2, 3] | ||
| fail-fast: false | ||
| permissions: | ||
| contents: write | ||
| env: | ||
| TZ: "Europe/London" | ||
| steps: | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v6 | ||
| - name: Install Playwright | ||
| run: uv run playwright install --with-deps | ||
| shell: bash | ||
| - name: Install Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| - name: Set variables | ||
| id: set-variables | ||
| run: | | ||
| declare -A env_map=( | ||
| [qa]="https://qa.mavistesting.com" | ||
| [test]="https://test.mavistesting.com" | ||
| [training]="https://training.manage-vaccinations-in-schools.nhs.uk" | ||
| ) | ||
| if [ "${{ github.event_name }}" = "pull_request" ]; then | ||
| echo "device=Desktop Chrome" >> $GITHUB_OUTPUT | ||
| echo "environment=${env_map[qa]}" >> $GITHUB_OUTPUT | ||
| echo "programmes=HPV,MENACWY,TD_IPV,FLU" >> $GITHUB_OUTPUT | ||
| echo "set_feature_flags=false" >> $GITHUB_OUTPUT | ||
| echo "additional_feature_flags=" >> $GITHUB_OUTPUT | ||
| echo "deploy_report=false" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "device=${{ github.event.inputs.device }}" >> $GITHUB_OUTPUT | ||
| input_env="${{ github.event.inputs.environment }}" | ||
| url="${env_map[$input_env]:-${env_map[qa]}}" | ||
| echo "environment=$url" >> $GITHUB_OUTPUT | ||
| echo "programmes=${{ github.event.inputs.programmes }}" >> $GITHUB_OUTPUT | ||
| echo "set_feature_flags=${{ github.event.inputs.set_feature_flags }}" >> $GITHUB_OUTPUT | ||
| echo "additional_feature_flags=${{ github.event.inputs.additional_feature_flags }}" >> $GITHUB_OUTPUT | ||
| echo "deploy_report=true" >> $GITHUB_OUTPUT | ||
| fi | ||
| - uses: actions/checkout@v4 | ||
| - name: Run tests | ||
| run: | | ||
| pip install pytest-xdist pytest-split | ||
| pytest tests/ \ | ||
| --splits 4 --group ${{ matrix.partition }} \ # Split into groups | ||
| -n 4 \ # Parallelize WITHIN this group | ||
| --dist=loadscope # Minimize conflicts | ||
| with: | ||
| device: ${{ steps.set-variables.outputs.device }} | ||
| base_url: ${{ steps.set-variables.outputs.environment }} | ||
| programmes_enabled: ${{ steps.set-variables.outputs.programmes }} | ||
| set_feature_flags: ${{ steps.set-variables.outputs.set_feature_flags }} | ||
| additional_feature_flags: ${{ steps.set-variables.outputs.additional_feature_flags }} | ||
| env: | ||
| BASIC_AUTH_TOKEN: ${{ secrets.HTTP_AUTH_TOKEN_FOR_TESTS }} | ||
| IMMS_BASE_URL: ${{ vars.IMMS_BASE_URL }} | ||
| IMMS_API_KEY: ${{ secrets.IMMS_API_KEY }} | ||
| IMMS_API_KID: ${{ secrets.IMMS_API_KID }} | ||
| IMMS_API_PEM: ${{ secrets.IMMS_API_PEM }} | ||
| # - name: Process reports | ||
| # if: always() && steps.set-variables.outputs.deploy_report == 'true' | ||
| # uses: ./.github/actions/deploy-reports | ||
| # with: | ||
| # device: ${{ steps.set-variables.outputs.device }} | ||
| # env: | ||
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||