Use reusable job #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Node.js CI | |
on: | |
push: | |
branches: ['master'] | |
pull_request: | |
branches: ['master'] | |
jobs: | |
test: | |
if: ${{ ! endsWith(github.event.head_commit.message, '[skip ci]') }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: | |
- archive | |
- base-node | |
- common-archive-client | |
- common-data | |
- common-postgres | |
- configurator | |
- gatherer-http | |
- gatherer-stdin | |
- infra-postgres | |
- infra-redis | |
- listener | |
- publisher | |
target: ['lint', 'test'] | |
node-version: [20] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- run: npm install | |
- run: npx nx run-many --target=${{ matrix.target }} --projects=${{ matrix.package }} --output-style=stream | |
build-base-images: | |
if: ${{ ! endsWith(github.event.head_commit.message, '[skip ci]') }} | |
needs: test | |
strategy: | |
matrix: | |
args: | |
- package: base-node | |
context: . | |
image: ghcr.io/unkhz/ruuvipuserrin/base-node | |
kustomization: ./packages/base-node/.khz-k3s/kustomization.yaml | |
uses: unkhz/ruuvipuserrin/.github/workflows/build-package.yml@master | |
with: | |
package: ${{ matrix.args.package }} | |
context: ${{ matrix.args.context }} | |
image: ${{ matrix.args.image }} | |
kustomization: ${{ matrix.args.kustomization }} | |
build-package-images: | |
if: ${{ ! endsWith(github.event.head_commit.message, '[skip ci]') }} | |
needs: build-base-images | |
strategy: | |
matrix: | |
args: | |
- package: archive | |
context: ./packages/archive | |
image: ghcr.io/unkhz/ruuvipuserrin/archive | |
kustomization: ./packages/archive/.khz-k3s/kustomization.yaml | |
uses: unkhz/ruuvipuserrin/.github/workflows/build-package.yml@master | |
with: | |
package: ${{ matrix.args.package }} | |
context: ${{ matrix.args.context }} | |
image: ${{ matrix.args.image }} | |
kustomization: ${{ matrix.args.kustomization }} |