Skip to content

Commit f51c794

Browse files
committed
Build and test using OS matrix
1 parent 3c290d4 commit f51c794

File tree

1 file changed

+35
-6
lines changed

1 file changed

+35
-6
lines changed

.github/workflows/build-and-test.yml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,70 @@ on:
1111

1212
jobs:
1313
build-and-test:
14-
runs-on: ubuntu-latest
14+
name: Build ${{ matrix.name }}
15+
runs-on: ${{ matrix.os }}
16+
timeout-minutes: 5
1517

1618
permissions:
1719
contents: read
1820
attestations: read
1921

20-
timeout-minutes: 5
22+
strategy:
23+
fail-fast: true
24+
matrix:
25+
include:
26+
- { os: ubuntu-24.04, name: linux-x64, ext: so, arch: 'x64' }
27+
- { os: ubuntu-24.04-arm, name: linux-arm64, ext: so, arch: 'arm64' }
28+
- { os: windows-2025, name: win-x64, ext: dll, arch: 'x64' }
29+
- { os: windows-2025, name: win-x86, ext: dll, arch: 'x86' }
30+
- { os: windows-11-arm, name: win-arm64, ext: dll, arch: 'arm64' }
31+
- { os: macos-15, name: osx-arm64, ext: dylib, arch: 'arm64' }
32+
- { os: macos-15-intel, name: osx-x64, ext: dylib, arch: 'x64' }
33+
2134
steps:
2235
- name: Checkout
2336
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2437

2538
- name: Setup .NET SDK
39+
if: ${{ matrix.name != 'win-x86' }}
2640
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
2741
with:
2842
dotnet-version: '10.0.x'
2943

44+
- name: Install dotnet x86
45+
if: ${{ matrix.name == 'win-x86' }}
46+
run: |
47+
iwr -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1 -UseBasicParsing
48+
./dotnet-install.ps1 -Channel 10.0 -Architecture x86 -InstallDir "C:/Program Files (x86)/dotnet"
49+
50+
- name: Show info
51+
run: dotnet --info
52+
3053
- name: Install dependencies
31-
run: dotnet restore
54+
run: |
55+
dotnet restore ./ZstdNet/ZstdNet.csproj --runtime ${{ matrix.name }}
56+
dotnet restore ./ZstdNet.Tests/ZstdNet.Tests.csproj --runtime ${{ matrix.name }}
3257
3358
- name: Download native libs
3459
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
3560
with:
3661
github-token: ${{ secrets.GITHUB_TOKEN }}
3762
run-id: 22015842187 # https://github.com/skbkontur/ZstdNet/actions/runs/22015842187
3863
merge-multiple: true
64+
name: ${{ matrix.name }}
3965
path: ./ZstdNet/
4066

4167
- name: Check attestation
4268
env:
4369
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
GH_FORCE_TTY: '100%'
4471
run: |
45-
find ./ZstdNet/runtimes -path "*/native/libzstd.*" -type f -print -exec gh attestation verify {} --repo skbkontur/ZstdNet ';'
72+
gh attestation verify ./ZstdNet/runtimes/${{ matrix.name }}/native/libzstd.${{ matrix.ext }} --repo skbkontur/ZstdNet
4673
4774
- name: Build
48-
run: dotnet build --configuration Release --no-restore
75+
run: |
76+
dotnet build ./ZstdNet/ZstdNet.csproj --no-restore --runtime ${{ matrix.name }}
77+
dotnet build ./ZstdNet.Tests/ZstdNet.Tests.csproj --no-restore --runtime ${{ matrix.name }}
4978
5079
- name: Test
51-
run: dotnet test --configuration Release --no-build
80+
run: dotnet test ./ZstdNet.Tests/ZstdNet.Tests.csproj --no-build --runtime ${{ matrix.name }}

0 commit comments

Comments
 (0)