Skip to content

fix: resume queue in content-publishing when Capacity is available #233

fix: resume queue in content-publishing when Capacity is available

fix: resume queue in content-publishing when Capacity is available #233

Workflow file for this run

name: Build and Test
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
service-matrix:
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.determine-matrix.outputs.changes }}
# IF you add a new filter it ALSO needs to be here
services: >-
["account", "graph", "content-publishing", "content-watcher"]
# Resolves to true if it should run everything, aka when common files change
run-all: ${{ steps.determine-matrix.outputs.changes.common }}
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: determine-matrix
with:
# Adding a filter? Check for the need to add to the outputs as well
filters: |
common:
- 'packages/**'
- 'Docker/**'
- '.github/**'
- 'docker-compose.yaml'
account:
- 'services/account/**'
graph:
- 'services/graph/**'
content-publishing:
- 'services/content-publishing/**'
content-watcher:
- 'services/content-watcher/**'
build:
name: '[${{ matrix.service }}] Build and Test'
runs-on: ubuntu-latest
needs: service-matrix
strategy:
fail-fast: false
matrix:
service: ${{ fromJson(needs.service-matrix.outputs.services) }}
# NOTE: The if statement has to be on each step. :(
# This is because the job level if statement cannot handle matrix values
steps:
- name: Run or Skip
id: should
run: echo "RUN=${{ needs.service-matrix.outputs.run-all || contains(fromJson(needs.service-matrix.outputs.changes), matrix.service) }}" >> "$GITHUB_OUTPUT"
- name: Checkout
if: ${{ steps.should.outputs.RUN == 'true' }}
uses: actions/checkout@v4
- name: Install Node.js
if: ${{ steps.should.outputs.RUN == 'true' }}
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
cache-dependency-path: services/${{ matrix.service }}/package-lock.json
- name: Install dependencies
if: ${{ steps.should.outputs.RUN == 'true' }}
working-directory: services/${{ matrix.service }}
run: npm ci
- name: Build NestJS
if: ${{ steps.should.outputs.RUN == 'true' }}
working-directory: services/${{ matrix.service }}
run: npm run build
- name: Lint
if: ${{ steps.should.outputs.RUN == 'true' }}
working-directory: services/${{ matrix.service }}
run: npm run lint
- name: Unit Test
if: ${{ steps.should.outputs.RUN == 'true' }}
working-directory: services/${{ matrix.service }}
run: npm run test
- name: License Check
if: ${{ steps.should.outputs.RUN == 'true' }}
working-directory: services/${{ matrix.service }}
# List all the licenses and error out if it is not one of the supported licenses
run: npx license-report --fields=name --fields=licenseType | jq 'map(select(.licenseType | IN("MIT", "Apache-2.0", "ISC", "BSD-3-Clause", "BSD-2-Clause", "(Apache-2.0 AND MIT)", "Apache-2.0 OR MIT") | not)) | if length == 0 then halt else halt_error(1) end'
- name: Build OpenAPI spec
if: ${{ steps.should.outputs.RUN == 'true' }}
uses: ./.github/workflows/common/openapi-build
with:
service: ${{ matrix.service }}
# Test build of the Docker images
- name: Set up QEMU
if: ${{ steps.should.outputs.RUN == 'true' }}
uses: docker/setup-qemu-action@v3
with:
platforms: |
linux/amd64
- name: Set up Docker Buildx
if: ${{ steps.should.outputs.RUN == 'true' }}
uses: docker/setup-buildx-action@v3
# Use GitHub Container Registry instead due to rate limits
with:
config-inline: |
[registry."ghcr.io"]
- name: Login to DockerHub
if: ${{ steps.should.outputs.RUN == 'true' }}
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
- name: Build Docker Image
if: ${{ steps.should.outputs.RUN == 'true' }}
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: false
file: Docker/Dockerfile.${{ matrix.service }}