Skip to content

Build and E2E tests #11

Build and E2E tests

Build and E2E tests #11

name: Build and E2E tests
on:
workflow_dispatch:
env:
NODE_OPTIONS: '--max_old_space_size=8192'
web: 'false'
back-office: 'false'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_and_e2e:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
name: Checkout [Pull Request]
if: ${{ github.event_name == 'pull_request' }}
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: actions/checkout@v3
name: Checkout [Default Branch]
if: ${{ github.event_name != 'pull_request' }}
with:
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for nx affected commands
id: nx
uses: nrwl/nx-set-shas@v3
with:
main-branch-name: staging
- name: Set up environment and cache dependencies
uses: sebpalluel/ci/.github/actions/setup-environment@latest
- name: Build and check if back-office or web affected
id: check
run: |
pnpm nx affected -t=build | tee affected.log
echo "back-office=$(grep -q 'back-office:build:production' affected.log && echo true || echo false)" >> $GITHUB_ENV
echo "web=$(grep -q 'web:build:production' affected.log && echo true || echo false)" >> $GITHUB_ENV
- name: Launch docker services
if: ${{ env.back-office == 'true' || env.web == 'true' }}
run: pnpm docker:services
- name: Run e2e tests for back-office
if: ${{ env.back-office == 'true' }}
run: pnpm nx run back-office:e2e --skipInstall
- name: Run e2e tests for web
if: ${{ env.web == 'true' }}
run: pnpm nx run web:e2e --skipInstall