️(CI) persist the frontend between jobs

To improve the speed of the CI, we cache the frontend
install. It will even be reused between pull request
until the yarn.lock has a change.
We cache as well the desk build app, in another cache,
this cache persist only per workflow. It will increase the
speed if we have e2e flaky tests and that we have to relaunch
the e2e job.
This commit is contained in:
Anthony LC
2024-03-29 17:30:55 +01:00
committed by Anthony LC
parent 97cec8901c
commit 480d8277cc

View File

@@ -58,11 +58,9 @@ jobs:
exit 1
fi
test-front:
install-front:
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/frontend/
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -71,40 +69,85 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'yarn'
cache-dependency-path: src/frontend/yarn.lock
- name: Restore the frontend cache
uses: actions/cache@v3
id: cache-install
with:
path: src/frontend/
key: install-front-${{ hashFiles('src/frontend/**/yarn.lock') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
if: steps.cache-install.outputs.cache-hit != 'true'
run: cd src/frontend/ && yarn install --frozen-lockfile
- name: Cache install frontend
if: steps.cache-install.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: src/frontend/
key: install-front-${{ hashFiles('src/frontend/**/yarn.lock') }}
build-front:
runs-on: ubuntu-latest
needs: install-front
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Restore the frontend cache
uses: actions/cache@v3
id: cache-install
with:
path: src/frontend/
key: install-front-${{ hashFiles('src/frontend/**/yarn.lock') }}
- name: Build CI App
run: cd src/frontend/ && yarn ci:build
- name: Cache build frontend
uses: actions/cache@v3
with:
path: src/frontend/
key: build-front-${{ github.run_id }}
test-front:
runs-on: ubuntu-latest
needs: install-front
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Restore the frontend cache
uses: actions/cache@v3
id: cache-install
with:
path: src/frontend/
key: install-front-${{ hashFiles('src/frontend/**/yarn.lock') }}
- name: Test App
run: yarn app:test
run: cd src/frontend/ && yarn app:test
lint-front:
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/frontend/
needs: install-front
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Restore the frontend cache
uses: actions/cache@v3
id: cache-install
with:
node-version: '18.x'
cache: 'yarn'
cache-dependency-path: src/frontend/yarn.lock
- name: Install dependencies
run: yarn install --frozen-lockfile
path: src/frontend/
key: install-front-${{ hashFiles('src/frontend/**/yarn.lock') }}
- name: Check linting
run: yarn lint
run: cd src/frontend/ && yarn lint
test-e2e:
runs-on: ubuntu-latest
needs: build-mails
needs: [build-mails, build-front]
timeout-minutes: 10
steps:
- name: Checkout repository
@@ -121,6 +164,13 @@ jobs:
name: mails-templates
path: src/backend/core/templates/mail
- name: Restore the build cache
uses: actions/cache@v3
id: cache-build
with:
path: src/frontend/
key: build-front-${{ github.run_id }}
- name: Build and Start Docker Servers
env:
DOCKER_BUILDKIT: 1
@@ -137,22 +187,9 @@ jobs:
run: |
make demo FLUSH_ARGS='--no-input'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'yarn'
cache-dependency-path: src/frontend/yarn.lock
- name: Install dependencies
run: cd src/frontend/ && yarn install --frozen-lockfile
- name: Install Playwright Browsers
run: cd src/frontend/apps/e2e && yarn install
- name: Build CI App
run: cd src/frontend/ && yarn ci:build
- name: Run e2e tests
run: cd src/frontend/ && yarn e2e:test