diff --git a/.github/workflows/browser-tests.yml b/.github/workflows/browser-tests.yml index b1cd16f..cdd1bbc 100644 --- a/.github/workflows/browser-tests.yml +++ b/.github/workflows/browser-tests.yml @@ -63,6 +63,11 @@ on: description: "Job maximum timeout in minutes" required: false type: number + selected-os: + default: "ubuntu-latest" + description: "Ubuntu OS version" + required: false + type: string secrets: SLACK_WEBHOOK_URL: required: true @@ -102,6 +107,7 @@ jobs: outputs: matrix: ${{ steps.generate-matrix.outputs.matrix }} job-count: ${{ steps.generate-matrix.outputs.job-count }} + selected-os: ${{ steps.select-os.outputs.selected-os }} steps: - name: Set job count for builds run: echo "job_count=${{ inputs.job-count }}" >> $GITHUB_ENV @@ -117,6 +123,14 @@ jobs: - name: (v3) Limit job-count to 1 for PRs if: github.event_name == 'pull_request' && inputs.project-version == '^3.3.x-dev' run: echo "job_count=1" >> $GITHUB_ENV + - name: Select Random OS + id: select-os + run: | + OS_ARRAY=("ubuntu-20.04" "ubuntu-22.04" "ubuntu-24.04") + RANDOM_INDEX=$(( RANDOM % ${#OS_ARRAY[@]} )) + SELECTED_OS=${OS_ARRAY[$RANDOM_INDEX]} + echo "selected-os=$SELECTED_OS" >> $GITHUB_ENV + echo "selected-os=$SELECTED_OS" >> $GITHUB_OUTPUT - name: Generate matrix id: generate-matrix run: | @@ -126,12 +140,16 @@ jobs: browser-tests: needs: setup-jobs - runs-on: ubuntu-latest + runs-on: ${{ needs.setup-jobs.outputs.selected-os }} timeout-minutes: ${{ inputs.timeout }} strategy: fail-fast: false matrix: ${{ fromJson(needs.setup-jobs.outputs.matrix) }} steps: + - name: Check Ubuntu Version + run: | + source /etc/os-release + echo "Running on Ubuntu version $VERSION_ID" - if: contains(inputs.setup, 'varnish') name: "[Varnish] Set the URL the tests should access" run: echo "WEB_HOST=http://varnish" >> $GITHUB_ENV