-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (132 loc) · 4.46 KB
/
Copy pathci.yml
File metadata and controls
138 lines (132 loc) · 4.46 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
128
129
130
131
132
133
134
135
136
137
138
name: CI
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
validate:
name: Validate source
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.85.0
with:
components: clippy, rustfmt
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: Swatinem/rust-cache@v2
- name: Check Rust formatting
run: cargo fmt --all -- --check
- name: Run Clippy
run: cargo clippy --workspace --all-targets --locked -- -D warnings
- name: Run Rust tests
run: cargo test --workspace --all-targets --locked
- name: Build managed package
run: dotnet build src/MiniExcelRust/MiniExcelRust.csproj -c Release
native-package-test:
name: Test ${{ matrix.rid }} package
strategy:
fail-fast: false
matrix:
include:
- runner: windows-latest
rid: win-x64
- runner: windows-11-arm
rid: win-arm64
- runner: ubuntu-latest
rid: linux-x64
- runner: ubuntu-24.04-arm
rid: linux-arm64
- runner: macos-15-intel
rid: osx-x64
- runner: macos-latest
rid: osx-arm64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.85.0
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.rid }}
- name: Build, pack, and test
shell: pwsh
run: ./build/Test-Package.ps1 -Rid '${{ matrix.rid }}' -LifecycleIterations 5000
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.rid }}
path: artifacts/native/${{ matrix.rid }}/*
if-no-files-found: error
musl-package-test:
name: Test ${{ matrix.rid }} package
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
rid: linux-musl-x64
- runner: ubuntu-24.04-arm
rid: linux-musl-arm64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.85.0
with:
targets: ${{ matrix.rid == 'linux-musl-x64' && 'x86_64-unknown-linux-musl' || 'aarch64-unknown-linux-musl' }}
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: mlugg/setup-zig@v2
- uses: taiki-e/install-action@v2
with:
tool: cargo-zigbuild
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.rid }}
- name: Build native asset
shell: pwsh
run: ./build/Build-Native.ps1 -Rid '${{ matrix.rid }}' -UseZig -Toolchain 1.85.0
- name: Pack
run: dotnet pack src/MiniExcelRust/MiniExcelRust.csproj -c Release -o artifacts/packages -p:MiniExcelRustRequireAllNativeAssets=false
- name: Test package in Alpine
shell: bash
run: |
docker run --rm \
-v "$GITHUB_WORKSPACE:/work" \
-w /work \
mcr.microsoft.com/dotnet/sdk:8.0-alpine \
sh -lc 'dotnet restore tests/MiniExcelRust.PackageTests/MiniExcelRust.PackageTests.csproj --source artifacts/packages && dotnet run --project tests/MiniExcelRust.PackageTests/MiniExcelRust.PackageTests.csproj -c Release --no-restore -- suite 5000 32'
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.rid }}
path: artifacts/native/${{ matrix.rid }}/*
if-no-files-found: error
assemble-package:
name: Assemble eight-RID NuGet
needs: [validate, native-package-test, musl-package-test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: actions/download-artifact@v4
with:
pattern: '*'
path: artifacts/native
- name: Pack complete NuGet
run: dotnet pack src/MiniExcelRust/MiniExcelRust.csproj -c Release -o artifacts/packages
- name: Verify package contents
shell: pwsh
run: ./build/Verify-Package.ps1 -PackagePath artifacts/packages/MiniExcelRust.0.1.0-preview.2.nupkg
- uses: actions/upload-artifact@v4
with:
name: nuget-preview
path: artifacts/packages/MiniExcelRust.0.1.0-preview.2.*nupkg
if-no-files-found: error