Performance: Make delayed selector much cheaper #5339
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: Cypress | |
on: | |
push: | |
branches: [main] | |
paths: | |
- 'src/**' | |
- 'test/**' | |
- 'yarn.lock' | |
- '.github/workflows/cypress.yml' | |
pull_request: | |
paths: | |
- 'src/**' | |
- 'test/**' | |
- 'yarn.lock' | |
- '.github/workflows/cypress.yml' | |
workflow_dispatch: | |
jobs: | |
internal: | |
if: | | |
github.repository_owner == 'Altinn' && | |
(github.event_name != 'pull_request' && github.event.repository.fork == false) || | |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
machines: [1, 2, 3] | |
name: Internal | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Increase file watchers | |
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | |
- uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn --immutable | |
- name: Build | |
run: yarn build | |
- name: Run tests | |
env: | |
CYPRESS_PROJECT_ID: y2jhp6 | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} | |
PERCY_PARALLEL_TOTAL: 3 | |
PERCY_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_attempt }} | |
run: " | |
npx cypress verify\n | |
bash -c 'yarn serve 8080 >/dev/null &'\n | |
bash -c 'npx percy exec --parallel -- npx cypress run | |
--spec test/e2e/integration | |
--env environment=tt02 | |
--record | |
--parallel | |
--tag \"altinn-app-frontend\" | |
--group altinn-app-frontend | |
--browser chrome | |
--ci-build-id $GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT' | |
" | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: logs | |
path: test/logs/* | |
external: | |
if: | | |
github.repository_owner == 'Altinn' && | |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true) | |
runs-on: ubuntu-latest | |
name: External | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Increase file watchers | |
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | |
- uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn --immutable | |
- name: Build | |
run: yarn build | |
- name: Verify cypress and run tests | |
run: " | |
npx cypress verify\n | |
bash -c 'yarn serve 8080 >/dev/null &'\n | |
bash -c 'npx cypress run | |
--spec test/e2e/integration | |
--config watchForFileChanges=false | |
--env environment=tt02' | |
" | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: redux-state-history | |
path: | | |
test/logs/* | |
test/screenshots/* | |
test/videos/* |