Skip to content

Combing CI workflows to use matrix strategy #376

Combing CI workflows to use matrix strategy

Combing CI workflows to use matrix strategy #376

Workflow file for this run

name: CI
on:
push:
branches:
- feature/**
- GAP-**
- fix/**
- bug/**
- TMI2-**
paths:
- "packages/**"
- ".github/workflows/feature.yml"
- "package.json"
- "yarn.lock"
jobs:
snyk:
name: Security checks
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Snyk setup
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --yarn-workspaces --strict-out-of-sync=false
build:
name: Test apps
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
app_name: ["applicant", "admin", "gap-web-ui"]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Generate .env files
if: ${{ matrix.app_name == 'admin' }}
run: |
cp packages/admin/.env.example packages/admin/.env
sed -i -e '/TINYMCE_API_KEY=/s/$/${{ secrets.TINYMCE_API_KEY }}/g' packages/admin/.env
- name: Generate .env files
if: ${{ matrix.app_name == 'applicant' }}
run: |
cp packages/applicant/.env.example packages/applicant/.env
- name: Read .nvmrc
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
id: nvm
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
cache: 'yarn'
- name: Install dependencies
run: |
yarn workspace ${{ matrix.app_name }} install --immutable
- name: Install gap-web-ui dependencies
if: ${{ matrix.app_name == 'admin' || matrix.app_name == 'applicant' }}
run: |
yarn workspace gap-web-ui install --immutable
- name: Build gap-web-ui application
if: ${{ matrix.app_name == 'admin' || matrix.app_name == 'applicant' }}
run: |
yarn workspace gap-web-ui build
- name: Build application
run: |
yarn workspace ${{ matrix.app_name }} build
- name: Lint files
if: ${{ matrix.app_name != 'gap-web-ui' }}
run: |
yarn workspace ${{ matrix.app_name }} lint
- name: Units Tests
run: |
yarn workspace ${{ matrix.app_name }} coverage