Skip to content

Build and E2E tests

Build and E2E tests #1

name: Build and E2E tests
on:
workflow_dispatch:
env:
NODE_OPTIONS: '--max_old_space_size=4096'
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: |
affected=$(pnpm nx affected -t=build)
echo "::set-output name=back-office::$(echo $affected | grep -q 'back-office:build:production' && echo true || echo false)"
echo "::set-output name=web::$(echo $affected | grep -q 'web:build:production' && echo true || echo false)"
- name: Launch docker services
if: steps.check.outputs.back-office == 'true' || steps.check.outputs.web == 'true'
run: pnpm docker:services
- name: Run e2e tests for back-office
if: steps.check.outputs.back-office == 'true'
run: pnpm nx run back-office:e2e --skipInstall
- name: Run e2e tests for web
if: steps.check.outputs.web == 'true'
run: pnpm nx run web:e2e --skipInstall