Skip to content

test: add unit tests for remaining app workers (#489) #1390

test: add unit tests for remaining app workers (#489)

test: add unit tests for remaining app workers (#489) #1390

Workflow file for this run

name: CI Checks
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
changes:
name: Detect changed paths
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
src: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: filter
uses: dorny/paths-filter@v3
with:
filters: |
src:
- 'src/**'
- 'test/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'tsconfig*.json'
- 'biome.json'
- '.knip.json'
- 'Dockerfile*'
- 'docker-compose*.yml'
- '.nvmrc'
- '.github/workflows/checks.yml'
commit-lint:
name: Lint commits
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install package dependencies
run: pnpm install --frozen-lockfile
- name: Run commitlint
uses: wagoid/commitlint-github-action@v5
lint:
name: Lint code
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install package dependencies
run: pnpm install --frozen-lockfile
- name: Run Biome
run: pnpm run lint
- name: Run Knip
run: pnpm run check:deps
build-check:
name: Build check
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install package dependencies
run: pnpm install --frozen-lockfile
- name: Run build check
run: pnpm run build:check
- name: Build artifacts
run: pnpm run build
- name: Verify built CLI entrypoint
run: pnpm run verify:cli:build
test-units-and-cover:
name: Unit Tests And Coverage
runs-on: ubuntu-latest
needs:
- changes
- lint
- build-check
if: |
needs.changes.outputs.src == 'true' &&
needs.lint.result == 'success' &&
needs.build-check.result == 'success'
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install package dependencies
run: pnpm install --frozen-lockfile
- name: Run unit tests
run: pnpm run test:unit
- name: Run CLI test suite
run: pnpm run test:cli
- name: Run coverage for unit tests
run: pnpm run cover:unit
if: ${{ always() }}
- uses: actions/upload-artifact@v4
name: Upload coverage report for unit tests
if: ${{ always() }}
with:
name: unit-coverage-lcov
path: .coverage/unit/lcov.info
- name: Coveralls
uses: coverallsapp/github-action@v2.3.6
if: ${{ always() }}
with:
path-to-lcov: ./.coverage/unit/lcov.info
flag-name: Unit
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
test-integrations-and-cover:
name: Integration Tests and Coverage
runs-on: ubuntu-latest
needs:
- changes
- lint
- build-check
if: |
needs.changes.outputs.src == 'true' &&
needs.lint.result == 'success' &&
needs.build-check.result == 'success'
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Run integration tests
run: pnpm run docker:test:integration
- name: Generate Cucumber report annotations
uses: deblockt/cucumber-report-annotations-action@v1.7
if: ${{ always() }}
continue-on-error: true
with:
access-token: ${{ secrets.GITHUB_TOKEN }}
path: .test-reports/integration/report.json
- name: Run coverage for integration tests
run: pnpm run docker:cover:integration
- name: Coveralls
uses: coverallsapp/github-action@v2.3.6
if: ${{ always() }}
with:
path-to-lcov: .coverage/integration/lcov.info
flag-name: Integration
parallel: true
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
name: Upload coverage report for integration tests
if: ${{ always() }}
with:
name: integration-coverage-lcov
path: .coverage/integration/lcov.info
post-tests:
name: Post Tests
runs-on: ubuntu-latest
needs:
- changes
- test-units-and-cover
- test-integrations-and-cover
if: ${{ always() }}
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2.3.6
if: |
needs.test-units-and-cover.result != 'skipped' ||
needs.test-integrations-and-cover.result != 'skipped'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
changeset-check:
name: Changeset Required
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.head_ref != 'changeset-release/main'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install package dependencies
run: pnpm install --frozen-lockfile
- name: Check for changeset
run: pnpm exec changeset status --since origin/${{ github.base_ref }}