Retry flaky E2E test (#643) #983
This file contains 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: Testing | |
on: | |
push: | |
branches: | |
- main | |
- v1.* | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
lint: | |
uses: stylelint/.github/.github/workflows/lint.yml@main | |
test: | |
name: Test for Stylelint ${{ matrix.stylelint }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
stylelint: ['14', '15', '16'] | |
timeout-minutes: 30 | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Stylelint 15 | |
run: npm i -D stylelint@15 stylelint-scss@5 | |
if: ${{ matrix.stylelint == '15' }} | |
- name: Install Stylelint 14 | |
run: npm i -D stylelint@14 [email protected] | |
if: ${{ matrix.stylelint == '14' }} | |
- name: Run unit tests | |
run: npm run test:unit -- --coverage | |
- name: Run integration tests | |
run: npm run test:integration -- --coverage | |
- name: Cache VS Code binaries | |
uses: actions/cache@v4 | |
id: vscode-cache | |
with: | |
path: .vscode-test | |
key: ${{ runner.os }}-vscode-${{ hashFiles('package.json') }} | |
# TODO: If E2E flakiness is resolved, we should stop retrying and avoid potentially long CI runs. | |
- name: Run end-to-end tests (Linux) | |
if: ${{ runner.os == 'Linux' }} | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
retry_on: error | |
command: xvfb-run -a npm run test:e2e -- --silent | |
- name: Run end-to-end tests (non-Linux) | |
if: ${{ runner.os != 'Linux' }} | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 5 | |
retry_on: error | |
command: npm run test:e2e -- --silent | |
test-node-versions: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
permissions: | |
contents: read | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: npm | |
- name: Test Node.js versions | |
run: npm run test:node-versions |