mempool/.github/workflows/ci.yml

112 lines
3.5 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:
node: ["18", "20"]
2022-07-08 04:40:05 -07:00
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
2023-08-21 10:17:35 -07:00
- name: Read rust-toolchain file from repository
id: gettoolchain
run: echo "::set-output name=toolchain::$(cat rust-toolchain)"
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}
- name: Install ${{ steps.gettoolchain.outputs.toolchain }} Rust toolchain
# Latest version available on this commit is 1.71.1
# Commit date is Aug 3, 2023
uses: dtolnay/rust-toolchain@f361669954a8ecfc00a3443f35f9ac8e610ffc06
with:
toolchain: ${{ steps.gettoolchain.outputs.toolchain }}
2023-06-27 16:12:39 -07:00
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:ci
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:
node: ["18", "20"]
2022-07-08 04:40:05 -07:00
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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}