-
Notifications
You must be signed in to change notification settings - Fork 8
194 lines (172 loc) · 6.16 KB
/
ci.yml
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
RUSTDOCFLAGS: "--deny warnings"
RUSTFLAGS: "--deny warnings"
RUST_TEST_THREADS: 1
# COREHOST_TRACE: 2
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
toolchain: ["beta"]
target: ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc", "i686-pc-windows-msvc", "x86_64-apple-darwin"]
dotnet: ["6.0", "7.0", "8.0"]
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
dotnet_install_download_script: curl -sSL https://dot.net/v1/dotnet-install.sh > dotnet-install.sh; chmod +x dotnet-install.sh
dotnet_install_script: ./dotnet-install.sh
arch: x64
- target: x86_64-pc-windows-msvc
os: windows-latest
dotnet_install_download_script: Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1
dotnet_install_script: ./dotnet-install.ps1
arch: x64
- target: i686-pc-windows-msvc
os: windows-latest
dotnet_install_download_script: Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1
dotnet_install_script: ./dotnet-install.ps1
arch: x86
- target: x86_64-apple-darwin
os: macos-latest
dotnet_install_download_script: curl -sSL https://dot.net/v1/dotnet-install.sh > dotnet-install.sh; chmod +x dotnet-install.sh
dotnet_install_script: ./dotnet-install.sh
arch: x64
env:
NETCOREHOST_TEST_NETCORE_VERSION: net${{ matrix.dotnet }}
steps:
- uses: actions/checkout@v3
- name: Install .NET SDK ${{ matrix.dotnet }}
run: |
${{ matrix.dotnet_install_download_script }}
${{ matrix.dotnet_install_script }} -Architecture ${{ matrix.arch }} -Channel 6.0
${{ matrix.dotnet_install_script }} -Architecture ${{ matrix.arch }} -Channel 7.0
${{ matrix.dotnet_install_script }} -Architecture ${{ matrix.arch }} -Channel 8.0
if ($Env:DOTNET_INSTALL_DIR) {
$dotnetRoot = $Env:DOTNET_INSTALL_DIR
} else {
if ([System.Environment]::OSVersion.Platform -eq "Win32NT") {
$dotnetRoot = [IO.Path]::Combine($Env:LOCALAPPDATA, "Microsoft", "dotnet")
} else {
$dotnetRoot = [IO.Path]::Combine($Env:HOME, ".dotnet")
}
}
$dotnetRoot >> $env:GITHUB_PATH
"DOTNET_ROOT=$dotnetRoot" >> $env:GITHUB_ENV
dotnet --info
shell: pwsh
- name: Check .NET Installation
run: dotnet --info
- name: Install latest ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
override: true
- name: Build
run: cargo build --target ${{ matrix.target }} --no-default-features --features "nethost-download $("net" + "${{ matrix.dotnet }}".replace(".", "_"))"
shell: pwsh
- name: Test
run: cargo test --target ${{ matrix.target }} --all-targets --no-fail-fast --no-default-features --features "nethost-download $("net" + "${{ matrix.dotnet }}".replace(".", "_"))" -- --nocapture
shell: pwsh
cross:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: ["beta"]
target: ["aarch64-unknown-linux-gnu", "armv7-unknown-linux-gnueabihf"]
steps:
- uses: actions/checkout@v3
- name: Install latest ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
override: true
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build
run: cross build --target ${{ matrix.target }}
examples:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain: ["beta"]
example: ["run-app", "run-app-with-args", "call-managed-function", "passing-parameters", "return-string-from-managed"]
steps:
- uses: actions/checkout@v3
- name: Install latest ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
override: true
- name: Build .NET project for '${{ matrix.example }}'
working-directory: ./examples/${{ matrix.example }}/ExampleProject
run: dotnet build
- name: Run example '${{ matrix.example }}'
run: cargo run --example ${{ matrix.example }}
documentation:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
- os: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install latest nightly
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: nightly
override: true
- name: Generate documentation
run: cargo doc --all-features
- name: Install cargo-deadlinks
run: cargo install cargo-deadlinks
- name: Check dead links in doc
run: cargo deadlinks
clippy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
- os: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install latest nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: clippy
override: true
- name: Clippy check
run: cargo clippy --all-features
fmt:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
- os: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install latest nightly
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- name: Format check
run: cargo fmt --all -- --check