Skip to content

Commit b55286b

Browse files
Nick Ficanoclaude
andcommitted
ci: add GitHub Actions test workflow
Runs unit tests on push to main and PRs, with caching, concurrency control, minimal permissions, and pinned action versions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fabd12e commit b55286b

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# CI: build, format-check, and run unit tests for the F# SDK.
2+
#
3+
# Action pinning policy:
4+
# - First-party actions (actions/*) are pinned to a major tag (e.g. @v4).
5+
# - Third-party actions are pinned to a full commit SHA with a version comment.
6+
#
7+
# .NET version is governed by global.json (sdk 10.0.203, rollForward latestFeature).
8+
# TargetFramework (net10.0) comes from Directory.Build.props and is the sole matrix entry.
9+
name: test
10+
11+
on:
12+
push:
13+
branches: [main]
14+
paths-ignore:
15+
- "**.md"
16+
- "docs/**"
17+
- "LICENSE"
18+
- ".gitignore"
19+
- ".editorconfig"
20+
pull_request:
21+
branches: [main]
22+
paths-ignore:
23+
- "**.md"
24+
- "docs/**"
25+
- "LICENSE"
26+
- ".gitignore"
27+
- ".editorconfig"
28+
workflow_dispatch:
29+
30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.ref }}
32+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
33+
34+
permissions:
35+
contents: read
36+
37+
jobs:
38+
test:
39+
name: test (${{ matrix.tfm }} on ${{ matrix.os }})
40+
runs-on: ${{ matrix.os }}
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
os: [ubuntu-latest]
45+
tfm: [net10.0]
46+
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v4
50+
with:
51+
fetch-depth: 1
52+
53+
- name: Setup .NET (from global.json)
54+
uses: actions/setup-dotnet@v4
55+
with:
56+
global-json-file: global.json
57+
58+
- name: Cache NuGet packages
59+
uses: actions/cache@v4
60+
with:
61+
path: ~/.nuget/packages
62+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props', '**/*.fsproj', 'global.json', 'nuget.config') }}
63+
restore-keys: |
64+
${{ runner.os }}-nuget-
65+
66+
- name: Restore .NET tools (fantomas)
67+
run: dotnet tool restore
68+
69+
- name: Restore dependencies
70+
run: dotnet restore ARCP.slnx
71+
72+
- name: Format check (fantomas)
73+
run: dotnet fantomas --check src tests samples
74+
75+
- name: Build
76+
run: dotnet build ARCP.slnx --configuration Release --no-restore
77+
78+
- name: Test (unit)
79+
run: >
80+
dotnet test tests/ARCP.UnitTests/ARCP.UnitTests.fsproj
81+
--configuration Release
82+
--no-build
83+
--verbosity normal
84+
--logger "trx;LogFileName=unit-tests.trx"
85+
--logger "console;verbosity=normal"
86+
--results-directory ${{ github.workspace }}/TestResults
87+
88+
- name: Upload test results
89+
if: failure()
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: test-results-${{ matrix.os }}-${{ matrix.tfm }}
93+
path: ${{ github.workspace }}/TestResults
94+
if-no-files-found: ignore
95+
retention-days: 7

0 commit comments

Comments
 (0)