On the release pull request workflows, we sometimes face issues with disk space. We clean up some space before starting Docker services or after finishing to build images to avoid these issues.
196 lines
5.6 KiB
YAML
196 lines
5.6 KiB
YAML
name: Frontend Workflow
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- "*"
|
|
|
|
jobs:
|
|
|
|
install-dependencies:
|
|
uses: ./.github/workflows/dependencies.yml
|
|
with:
|
|
node_version: '22.x'
|
|
with-front-dependencies-installation: true
|
|
|
|
test-front:
|
|
needs: install-dependencies
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22.x"
|
|
|
|
- name: Restore the frontend cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: "src/frontend/**/node_modules"
|
|
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
|
|
fail-on-cache-miss: true
|
|
|
|
- name: Test App
|
|
run: cd src/frontend/ && yarn test
|
|
|
|
lint-front:
|
|
runs-on: ubuntu-latest
|
|
needs: install-dependencies
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22.x"
|
|
- name: Restore the frontend cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: "src/frontend/**/node_modules"
|
|
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
|
|
fail-on-cache-miss: true
|
|
|
|
- name: Check linting
|
|
run: cd src/frontend/ && yarn lint
|
|
|
|
test-e2e-chromium:
|
|
runs-on: ubuntu-latest
|
|
needs: install-dependencies
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22.x"
|
|
|
|
- name: Restore the frontend cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: "src/frontend/**/node_modules"
|
|
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
|
|
fail-on-cache-miss: true
|
|
|
|
- name: Set e2e env variables
|
|
run: cat env.d/development/common.e2e >> env.d/development/common.local
|
|
|
|
- name: Install Playwright Browsers
|
|
run: cd src/frontend/apps/e2e && yarn install --frozen-lockfile && yarn install-playwright chromium
|
|
|
|
- name: Free disk space before Docker
|
|
uses: ./.github/actions/free-disk-space
|
|
|
|
- name: Start Docker services
|
|
run: make bootstrap-e2e FLUSH_ARGS='--no-input'
|
|
|
|
- name: Run e2e tests
|
|
run: cd src/frontend/ && yarn e2e:test --project='chromium'
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: playwright-chromium-report
|
|
path: src/frontend/apps/e2e/report/
|
|
retention-days: 7
|
|
|
|
test-e2e-other-browser:
|
|
runs-on: ubuntu-latest
|
|
needs: test-e2e-chromium
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22.x"
|
|
|
|
- name: Restore the frontend cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: "src/frontend/**/node_modules"
|
|
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
|
|
fail-on-cache-miss: true
|
|
|
|
- name: Set e2e env variables
|
|
run: cat env.d/development/common.e2e >> env.d/development/common.local
|
|
|
|
- name: Install Playwright Browsers
|
|
run: cd src/frontend/apps/e2e && yarn install --frozen-lockfile && yarn install-playwright firefox webkit chromium
|
|
|
|
- name: Free disk space before Docker
|
|
uses: ./.github/actions/free-disk-space
|
|
|
|
- name: Start Docker services
|
|
run: make bootstrap-e2e FLUSH_ARGS='--no-input'
|
|
|
|
- name: Run e2e tests
|
|
run: cd src/frontend/ && yarn e2e:test --project=firefox --project=webkit
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: playwright-other-report
|
|
path: src/frontend/apps/e2e/report/
|
|
retention-days: 7
|
|
|
|
bundle-size-check:
|
|
runs-on: ubuntu-latest
|
|
needs: install-dependencies
|
|
if: github.event_name == 'pull_request'
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
issues: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Detect relevant changes
|
|
id: changes
|
|
uses: dorny/paths-filter@v2
|
|
with:
|
|
filters: |
|
|
lock:
|
|
- 'src/frontend/**/yarn.lock'
|
|
app:
|
|
- 'src/frontend/apps/impress/**'
|
|
|
|
- name: Restore the frontend cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: "src/frontend/**/node_modules"
|
|
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
|
|
fail-on-cache-miss: true
|
|
|
|
- name: Setup Node.js
|
|
if: steps.changes.outputs.lock == 'true' || steps.changes.outputs.app == 'true'
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22.x"
|
|
|
|
- name: Check bundle size changes
|
|
if: steps.changes.outputs.lock == 'true' || steps.changes.outputs.app == 'true'
|
|
uses: preactjs/compressed-size-action@v2
|
|
with:
|
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
build-script: "app:build"
|
|
pattern: "apps/impress/out/**/*.{css,js,html}"
|
|
exclude: "{**/*.map,**/node_modules/**}"
|
|
minimum-change-threshold: 500
|
|
compression: "gzip"
|
|
cwd: "./src/frontend"
|
|
show-total: true
|
|
strip-hash: "[-_.][a-f0-9]{8,}(?=\\.(?:js|css|html)$)"
|
|
omit-unchanged: true
|
|
install-script: "yarn install --frozen-lockfile"
|