-
Notifications
You must be signed in to change notification settings - Fork 0
222 lines (185 loc) · 5.7 KB
/
ci.yml
File metadata and controls
222 lines (185 loc) · 5.7 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
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: CI
on:
pull_request:
paths:
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/ci.yml'
push:
branches:
- 'master'
tags:
- v*
env:
CARGO_INCREMENTAL: 0
RUST_CACHE_VERSION: v1
PROJ_NAME: eew-renderer-url
jobs:
release_windows:
if: ${{ github.event_name != 'pull_request' }}
permissions:
contents: write
runs-on: windows-2025
steps:
- uses: actions/checkout@v6.0.3
with:
submodules: true
- name: Install Toolchains
run: |
winget install --id=Google.Protobuf -l C:\protobuf --exact --accept-package-agreements --accept-source-agreements
echo C:\protobuf\bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- uses: Swatinem/rust-cache@v2.9.1
with:
prefix-key: ${{ env.RUST_CACHE_VERSION }}-rust
- name: Build
run: |
cargo build --release
- name: Install cargo license
run: |
cargo install cargo-license
- name: Create CREDITS file
shell: C:\shells\gitbash.exe {0}
run: |
cargo license \
--authors \
--do-not-bundle \
--avoid-dev-deps \
--filter-platform "$(rustc -vV | sed -n 's|host: ||p')" \
> CREDITS
- name: Make release file
shell: C:\shells\gitbash.exe {0}
run: |
DIR_NAME="${{ env.PROJ_NAME }}-windows-x86_64-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || format('master-{0}', github.sha) }}"
mkdir "$DIR_NAME"
cp ./target/release/eew-renderer-url.exe "$DIR_NAME/"
cp ./LICENSE "$DIR_NAME/"
cp ./CREDITS "$DIR_NAME/"
cp ./README.md "$DIR_NAME/"
7z a "$DIR_NAME.zip" "$DIR_NAME/"
- name: pre-release
uses: softprops/action-gh-release@v3.0.0
if: "! startsWith(github.ref, 'refs/tags/')"
with:
tag_name: master-${{ github.sha }}
prerelease: true
fail_on_unmatched_files: true
files: |
*.zip
- name: tagged-release
uses: softprops/action-gh-release@v3.0.0
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: true
files: |
*.zip
release_linux:
if: ${{ github.event_name != 'pull_request' }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
include:
- ghimage: ubuntu-24.04
mcarch: amd64
arch_s: x86_64
- ghimage: ubuntu-24.04-arm
mcarch: arm64
arch_s: aarch64
permissions:
contents: write
runs-on: ${{ matrix.ghimage }}
steps:
- uses: actions/checkout@v6.0.3
with:
submodules: true
- run: |
sudo apt-get update -y
sudo apt-get install -y protobuf-compiler
- name: Install cargo license
run: |
cargo install cargo-license
- uses: Swatinem/rust-cache@v2.9.1
with:
prefix-key: ${{ env.RUST_CACHE_VERSION }}-rust
- name: Build
run: |
cargo build --release
- name: Create CREDITS file
run: |
cargo license \
--authors \
--do-not-bundle \
--avoid-dev-deps \
--filter-platform "$(rustc -vV | sed -n 's|host: ||p')" \
> CREDITS
- name: Make release file
run: |
DIR_NAME="${{ env.PROJ_NAME }}-linux-${{ matrix.arch_s }}-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || format('master-{0}', github.sha) }}"
mkdir "$DIR_NAME"
cp ./target/release/eew-renderer-url "$DIR_NAME/"
cp ./LICENSE "$DIR_NAME/"
cp ./CREDITS "$DIR_NAME/"
cp ./README.md "$DIR_NAME/"
tar cvf "$DIR_NAME.tar.gz" "$DIR_NAME/"
- name: pre-release
uses: softprops/action-gh-release@v3.0.0
if: "! startsWith(github.ref, 'refs/tags/')"
with:
tag_name: master-${{ github.sha }}
prerelease: true
fail_on_unmatched_files: true
files: |
*.tar.gz
- name: tagged-release
uses: softprops/action-gh-release@v3.0.0
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: true
files: |
*.tar.gz
clippy_and_test:
continue-on-error: false
strategy:
fail-fast: false
matrix:
include:
- ghimage: ubuntu-24.04
dockerarch: linux/amd64
mcarch: amd64
- ghimage: ubuntu-24.04-arm
dockerarch: linux/arm64
mcarch: arm64
permissions:
packages: write
checks: write
contents: read
deployments: write
runs-on: ${{ matrix.ghimage }}
steps:
- uses: actions/checkout@v6.0.3
with:
submodules: true
- run: |
sudo apt-get update -y
sudo apt-get install -y protobuf-compiler
- name: Get Rust toolchain
id: toolchain
run: |
awk -F'[ ="]+' '$1 == "channel" { print "toolchain=" $2 }' rust-toolchain >> "$GITHUB_OUTPUT"
- name: install clippy
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ steps.toolchain.outputs.toolchain }}
components: clippy
- uses: Swatinem/rust-cache@v2.9.1
with:
prefix-key: ${{ env.RUST_CACHE_VERSION }}-rust
- name: clippy check
uses: yanorei32/action-clippy@50412b135153ebee7d4b8a5b868c4defdc663683
with:
reporter: github-check
- name: unit test
run: |
cargo test --no-run --locked
cargo test