mempool/.github/workflows/ci.yml

97 lines
2.9 KiB
YAML
Raw Normal View History

name: CI Pipeline for the Backend and Frontend
2022-07-05 05:37:17 -07:00
on:
pull_request:
2022-07-08 04:40:05 -07:00
types: [opened, review_requested, synchronize]
2022-07-05 05:37:17 -07:00
jobs:
2022-07-05 05:37:17 -07:00
backend:
if: "!contains(github.event.pull_request.labels.*.name, 'ops') && !contains(github.head_ref, 'ops/')"
2022-07-05 05:37:17 -07:00
strategy:
matrix:
2022-07-08 04:40:05 -07:00
node: ["16.16.0", "18.5.0"]
flavor: ["dev", "prod"]
fail-fast: false
2022-07-08 04:40:05 -07:00
runs-on: "ubuntu-latest"
2022-07-05 05:37:17 -07:00
2022-07-08 04:40:05 -07:00
name: Backend (${{ matrix.flavor }}) - node ${{ matrix.node }}
steps:
- name: Checkout
uses: actions/checkout@v3
2022-07-05 04:46:13 -07:00
with:
2022-07-08 04:40:05 -07:00
path: ${{ matrix.node }}/${{ matrix.flavor }}
2022-07-05 05:37:17 -07:00
- name: Setup Node
uses: actions/setup-node@v3
with:
2022-07-08 04:40:05 -07:00
node-version: ${{ matrix.node }}
registry-url: "https://registry.npmjs.org"
2022-07-05 05:37:17 -07:00
- name: Install
if: ${{ matrix.flavor == 'dev'}}
run: npm ci
2022-07-08 04:40:05 -07:00
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend
2022-07-05 05:37:17 -07:00
- name: Install (Prod dependencies only)
if: ${{ matrix.flavor == 'prod'}}
run: npm ci --omit=dev --omit=optional
2022-07-08 04:40:05 -07:00
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend
2022-07-05 05:37:17 -07:00
2022-07-08 04:40:05 -07:00
- name: Lint
2022-07-05 05:37:17 -07:00
if: ${{ matrix.flavor == 'dev'}}
2022-07-05 04:30:56 -07:00
run: npm run lint
2022-07-08 04:40:05 -07:00
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend
2022-07-05 05:37:17 -07:00
- name: Unit Tests
if: ${{ matrix.flavor == 'dev'}}
run: npm run test
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend
2022-07-05 05:37:17 -07:00
- name: Build
run: npm run build
2022-07-08 04:40:05 -07:00
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend
2022-07-05 05:37:17 -07:00
frontend:
if: "!contains(github.event.pull_request.labels.*.name, 'ops') && !contains(github.head_ref, 'ops/')"
2022-07-05 05:37:17 -07:00
strategy:
matrix:
2022-07-08 04:40:05 -07:00
node: ["16.15.0", "18.5.0"]
flavor: ["dev", "prod"]
fail-fast: false
2022-07-08 04:40:05 -07:00
runs-on: "ubuntu-latest"
2022-07-05 05:37:17 -07:00
2022-07-08 04:40:05 -07:00
name: Frontend (${{ matrix.flavor }}) - node ${{ matrix.node }}
steps:
- name: Checkout
uses: actions/checkout@v3
2022-07-05 04:46:13 -07:00
with:
2022-07-08 04:40:05 -07:00
path: ${{ matrix.node }}/${{ matrix.flavor }}
2022-07-05 05:37:17 -07:00
- name: Setup Node
uses: actions/setup-node@v3
with:
2022-07-08 04:40:05 -07:00
node-version: ${{ matrix.node }}
registry-url: "https://registry.npmjs.org"
2022-07-05 05:37:17 -07:00
- name: Install (Prod dependencies only)
run: npm ci --omit=dev --omit=optional
2022-07-05 05:37:17 -07:00
if: ${{ matrix.flavor == 'prod'}}
2022-07-08 04:40:05 -07:00
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/frontend
2022-07-05 05:37:17 -07:00
- name: Install
if: ${{ matrix.flavor == 'dev'}}
run: npm ci
2022-07-08 04:40:05 -07:00
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/frontend
2022-07-05 05:37:17 -07:00
- name: Lint
if: ${{ matrix.flavor == 'dev'}}
run: npm run lint
2022-07-08 04:40:05 -07:00
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/frontend
2022-07-05 05:37:17 -07:00
2022-07-08 04:40:05 -07:00
# - name: Test
# run: npm run test
2022-07-05 05:37:17 -07:00
- name: Build
run: npm run build
2022-07-08 04:40:05 -07:00
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/frontend