169 lines
5.1 KiB
YAML
169 lines
5.1 KiB
YAML
name: Frontend Workflow
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- "*"
|
|
|
|
jobs:
|
|
install-front:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20.x"
|
|
|
|
- name: Restore the frontend cache
|
|
uses: actions/cache@v4
|
|
id: front-node_modules
|
|
with:
|
|
path: "src/frontend/**/node_modules"
|
|
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
|
|
|
|
- name: Install dependencies
|
|
if: steps.front-node_modules.outputs.cache-hit != 'true'
|
|
run: cd src/frontend/ && yarn install --frozen-lockfile
|
|
|
|
- name: Cache install frontend
|
|
if: steps.front-node_modules.outputs.cache-hit != 'true'
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: "src/frontend/**/node_modules"
|
|
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
|
|
|
|
test-front:
|
|
runs-on: ubuntu-latest
|
|
needs: install-front
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20.x"
|
|
|
|
- name: Restore the frontend cache
|
|
uses: actions/cache@v4
|
|
id: front-node_modules
|
|
with:
|
|
path: "src/frontend/**/node_modules"
|
|
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
|
|
|
|
- name: Test App
|
|
run: cd src/frontend/ && yarn test
|
|
|
|
lint-front:
|
|
runs-on: ubuntu-latest
|
|
needs: install-front
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Restore the frontend cache
|
|
uses: actions/cache@v4
|
|
id: front-node_modules
|
|
with:
|
|
path: "src/frontend/**/node_modules"
|
|
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
|
|
|
|
- name: Check linting
|
|
run: cd src/frontend/ && yarn lint
|
|
|
|
test-e2e-chromium:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Restore the frontend cache
|
|
uses: actions/cache@v4
|
|
id: front-node_modules
|
|
with:
|
|
path: "src/frontend/**/node_modules"
|
|
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
|
|
|
|
- name: Set e2e env variables
|
|
run: cat env.d/development/common.e2e.dist >> env.d/development/common.dist
|
|
|
|
- name: Start Docker services
|
|
run: make bootstrap FLUSH_ARGS='--no-input' cache=
|
|
|
|
- name: Install Playwright Browsers
|
|
run: cd src/frontend/apps/e2e && yarn install-playwright chromium
|
|
|
|
# Tool to wait for a service to be ready
|
|
- name: Install Dockerize
|
|
run: |
|
|
curl -sSL https://github.com/jwilder/dockerize/releases/download/v0.8.0/dockerize-linux-amd64-v0.8.0.tar.gz | sudo tar -C /usr/local/bin -xzv
|
|
|
|
- name: Wait for services to be ready
|
|
run: |
|
|
printf "Minio check...\n"
|
|
dockerize -wait tcp://localhost:9000 -timeout 20s
|
|
printf "Keyclock check...\n"
|
|
dockerize -wait tcp://localhost:8080 -timeout 20s
|
|
printf "Server collaboration check...\n"
|
|
dockerize -wait tcp://localhost:4444 -timeout 20s
|
|
printf "Ngnix check...\n"
|
|
dockerize -wait tcp://localhost:8083 -timeout 20s
|
|
printf "DRF check...\n"
|
|
dockerize -wait tcp://localhost:8071 -timeout 20s
|
|
printf "Postgres Keyclock check...\n"
|
|
dockerize -wait tcp://localhost:5433 -timeout 20s
|
|
printf "Postgres back check...\n"
|
|
dockerize -wait tcp://localhost:15432 -timeout 20s
|
|
|
|
- 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: 20
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Restore the frontend cache
|
|
uses: actions/cache@v4
|
|
id: front-node_modules
|
|
with:
|
|
path: "src/frontend/**/node_modules"
|
|
key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }}
|
|
|
|
- name: Set e2e env variables
|
|
run: cat env.d/development/common.e2e.dist >> env.d/development/common.dist
|
|
|
|
- name: Start Docker services
|
|
run: make bootstrap FLUSH_ARGS='--no-input' cache=
|
|
|
|
- name: Install Playwright Browsers
|
|
run: cd src/frontend/apps/e2e && yarn install-playwright firefox webkit chromium
|
|
|
|
- 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
|