Repository navigation
71 lines (62 loc) · 3.02 KB
/
Copy pathci.yml
File metadata and controls
71 lines (62 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Every pull request: build, then run the tests, the real WinFsp mount with synthetic imagery among them.
# A pull request that only changes documentation skips the build and tests. The "test" job then shows as skipped,
# which counts as passed for a required check. (A workflow-level paths-ignore would leave the check pending.)
name: CI
on:
pull_request:
jobs:
# Is anything besides documentation changed? Lists the PR's files on a cheap Linux runner.
# A file counts as documentation only if it matches the pattern below. Anything else (code, tests, build files,
# the installer, other workflows) runs the full build, so a file nobody expected errs toward testing.
changes:
runs-on: ubuntu-latest
outputs:
code: ${{ steps.diff.outputs.code }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Look for non-documentation changes
id: diff
env:
BASE: ${{ github.event.pull_request.base.sha }}
# HEAD is the PR merged into its base (the checkout's default), so the three-dot diff is the PR's own changes.
run: |
files=$(git diff --name-only "$BASE"...HEAD)
echo "Changed files:"; echo "$files"
docs='^(docs/|release-notes/|README\.md$|CLAUDE\.md$|LICENSE$|mkdocs\.yml$|\.github/workflows/pages\.yml$)'
if [ -n "$files" ] && ! echo "$files" | grep -qvE "$docs"; then
echo "Only documentation changed: skipping the build and tests"
echo "code=false" >> "$GITHUB_OUTPUT"
else
echo "code=true" >> "$GITHUB_OUTPUT"
fi
test:
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
# WinFsp with its Developer part: the build references its .NET API (bin\winfsp-msil.dll), which a default
# install (choco's too) leaves out. The same version as the developers' PCs; the smoke test mounts with it.
# The installer is cached so a GitHub release-download hiccup (504s happen) doesn't fail the run; a cache miss retries.
- name: Cache the WinFsp installer
uses: actions/cache@v4
with:
path: winfsp.msi
key: winfsp-2.1.25156
- name: Install WinFsp
shell: pwsh
run: |
if (-not (Test-Path winfsp.msi)) {
Invoke-WebRequest https://github.com/winfsp/winfsp/releases/download/v2.1/winfsp-2.1.25156.msi -OutFile winfsp.msi -MaximumRetryCount 5 -RetryIntervalSec 15
}
Start-Process msiexec.exe -ArgumentList '/i', 'winfsp.msi', '/qn', 'ADDLOCAL=F.Main,F.User,F.Developer' -Wait
if (-not (Test-Path "${env:ProgramFiles(x86)}\WinFsp\bin\winfsp-msil.dll")) { throw "WinFsp's .NET API (winfsp-msil.dll) was not installed" }
- name: Build
run: dotnet build OrthoStreamXP.slnx -c Release
- name: Test
run: dotnet test --solution OrthoStreamXP.slnx -c Release --no-build