Repository navigation
127 lines (108 loc) · 4.56 KB
/
Copy pathci.yml
File metadata and controls
127 lines (108 loc) · 4.56 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: ci
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
# Cancel in-flight runs for the same ref when a new push lands (keeps PR queues sane).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# Match the local-dev guidance — same MSBuild server reuse on CI for faster reruns.
MSBUILDUSESERVER: '1'
# Quiet down telemetry / first-run noise.
DOTNET_CLI_TELEMETRY_OPTOUT: '1'
DOTNET_NOLOGO: '1'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: '1'
jobs:
build:
strategy:
fail-fast: false
matrix:
# Ubuntu is named explicitly so a runner image move is a reviewed change, not a silent one.
os: [ubuntu-26.04, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
# global.json pins 11.0.100-rc.2.26504.105 with allowPrerelease: true.
# setup-dotnet reads the exact build and fetches it from Microsoft's CDN.
# If that exact preview ever 404s (preview rotations sometimes get pulled),
# swap to the manual dotnet-install fallback at the bottom of this file.
- name: Setup .NET (from global.json)
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Show .NET info
run: dotnet --info
# NuGet package cache. Keyed on the lockfile-equivalent (csproj refs + global.json).
- name: Cache NuGet packages
uses: actions/cache@v6
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', 'global.json') }}
restore-keys: |
nuget-${{ runner.os }}-
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build -v:q --no-restore
- name: Verify formatting
run: dotnet format --verify-no-changes --no-restore
# xUnit v3 + Microsoft.Testing.Platform — `dotnet run` is the canonical runner.
# `dotnet test` also works but rebuilds; --no-build keeps CI fast.
- name: Test
run: dotnet run --project BcsSharp.Tests/BcsSharp.Tests.csproj --no-build --no-restore -c Debug
# Rust cross-implementation parity. Builds a Dockerized Rust fixture generator
# via Testcontainers, runs the explicit-only tests that compare bytes against the
# C# serializer. Linux-only (Docker is native there); kept separate from the main
# build matrix so it doesn't gate PR feedback on Docker availability.
rust-parity:
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@v7
- name: Setup .NET (from global.json)
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Cache NuGet packages
uses: actions/cache@v6
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', 'global.json') }}
restore-keys: |
nuget-${{ runner.os }}-
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build -v:q --no-restore
# `-explicit on` enables tests marked [Fact(Explicit = true)] — the parity tests
# that spin up the Rust Docker container via Testcontainers and compare bytes.
- name: Parity tests (--explicit on)
run: >
dotnet run --project BcsSharp.Tests/BcsSharp.Tests.csproj
--no-build --no-restore -c Debug
--
-explicit on
# --- Manual dotnet-install fallback ----------------------------------------
# If actions/setup-dotnet ever fails to find the pinned preview SDK on the CDN,
# replace the "Setup .NET" step above with this two-step block:
#
# - name: Install .NET 11 preview SDK (Linux/macOS)
# if: runner.os != 'Windows'
# run: |
# curl -sSL https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh -o dotnet-install.sh
# chmod +x dotnet-install.sh
# ./dotnet-install.sh --version 11.0.100-rc.2.26504.105 --install-dir $HOME/.dotnet
# echo "$HOME/.dotnet" >> $GITHUB_PATH
# echo "DOTNET_ROOT=$HOME/.dotnet" >> $GITHUB_ENV
#
# - name: Install .NET 11 preview SDK (Windows)
# if: runner.os == 'Windows'
# shell: pwsh
# run: |
# Invoke-WebRequest https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1
# ./dotnet-install.ps1 -Version 11.0.100-rc.2.26504.105 -InstallDir "$env:USERPROFILE\.dotnet"
# Add-Content $env:GITHUB_PATH "$env:USERPROFILE\.dotnet"
# Add-Content $env:GITHUB_ENV "DOTNET_ROOT=$env:USERPROFILE\.dotnet"