Skip to content

feat: add global install target and --minor-only flag to update-packa… #281

feat: add global install target and --minor-only flag to update-packa…

feat: add global install target and --minor-only flag to update-packa… #281

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write # sticky-pull-request-comment
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Install dotnet-coverage
run: pnpm dotnet:coverage
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Set Nx base for affected commands (PR only)
if: github.event_name == 'pull_request'
run: echo "NX_BASE=origin/${{ github.base_ref }}" >> $GITHUB_ENV
- name: Lint
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
pnpm nx affected --target=lint --base=$NX_BASE
else
pnpm lint:all
fi
- name: Test
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
pnpm nx affected --target=test --base=$NX_BASE
else
pnpm test:all
fi
- name: Build
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
pnpm nx affected --target=build --base=$NX_BASE
else
pnpm build:prod
fi
- name: Pack
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
pnpm nx affected --target=pack --base=$NX_BASE
else
pnpm nx run update-packages:pack
fi
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage
path: coverage/
if-no-files-found: ignore
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results
path: junit/
if-no-files-found: ignore
- name: Coverage summary
if: always()
continue-on-error: true # no coverage files on PRs with no code changes
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage/**/cobertura-coverage.xml
badge: true
fail_below_min: false
format: markdown
output: both
thresholds: '60 80'
- name: Check for coverage results
id: coverage
if: always()
run: |
[ -f code-coverage-results.md ] && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
- name: Annotate coverage report
if: always() && github.event_name == 'pull_request' && steps.coverage.outputs.exists == 'true'
run: |
echo "> [!NOTE]" > coverage-note.md
echo "> Coverage shown for **affected projects only**. Per-file thresholds (80%) are enforced by vitest." >> coverage-note.md
echo "" >> coverage-note.md
cat code-coverage-results.md >> coverage-note.md
mv coverage-note.md code-coverage-results.md
- name: Write coverage to job summary
if: always() && steps.coverage.outputs.exists == 'true'
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
- name: Add coverage PR comment
if: always() && github.event_name == 'pull_request' && steps.coverage.outputs.exists == 'true'
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md