Skip to content

Commit 8991241

Browse files
authored
Merge pull request #40 from chrisjwalk/ci/github-actions-32
ci: add GitHub Actions CI workflow
2 parents d0a8dee + 185102d commit 8991241

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
ci:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- uses: pnpm/action-setup@v4
22+
with:
23+
version: 10
24+
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: 24
28+
cache: pnpm
29+
30+
- uses: actions/setup-dotnet@v4
31+
with:
32+
dotnet-version: 10.0.x
33+
34+
- name: Install dotnet-coverage
35+
run: pnpm dotnet:coverage
36+
37+
- name: Install dependencies
38+
run: pnpm install --frozen-lockfile
39+
40+
- name: Set Nx base for affected commands (PR only)
41+
if: github.event_name == 'pull_request'
42+
run: echo "NX_BASE=origin/${{ github.base_ref }}" >> $GITHUB_ENV
43+
44+
- name: Lint
45+
run: |
46+
if [ "${{ github.event_name }}" = "pull_request" ]; then
47+
pnpm nx affected --target=lint --base=$NX_BASE
48+
else
49+
pnpm lint:all
50+
fi
51+
52+
- name: Test
53+
run: |
54+
if [ "${{ github.event_name }}" = "pull_request" ]; then
55+
pnpm nx affected --target=test --base=$NX_BASE --configuration ci
56+
else
57+
pnpm test:all
58+
fi
59+
60+
- name: Build
61+
run: |
62+
if [ "${{ github.event_name }}" = "pull_request" ]; then
63+
pnpm nx affected --target=build --base=$NX_BASE
64+
else
65+
pnpm build:prod
66+
fi
67+
68+
- name: Upload coverage report
69+
if: always()
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: coverage
73+
path: coverage/
74+
if-no-files-found: ignore
75+
76+
- name: Upload test results
77+
if: always()
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: test-results
81+
path: junit/
82+
if-no-files-found: ignore

0 commit comments

Comments
 (0)