-
-
Notifications
You must be signed in to change notification settings - Fork 2
223 lines (196 loc) · 9.1 KB
/
rust.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
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
223
name: ❯ release
on: [push]
env:
CARGO_TERM_COLOR: always
jobs:
targets:
name: mf_${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
target:
# List of targets: https://doc.rust-lang.org/nightly/rustc/platform-support.html
# Linux targets 🐧
- aarch64-unknown-linux-gnu # 64-bit Linux systems on ARM architecture ✅ Tested
- aarch64-unknown-linux-musl # 64-bit Linux systems on ARM architecture ✅ Tested
- arm-unknown-linux-gnueabi # ARMv6 Linux (kernel 3.2, glibc 2.17) ✅ Tested
- armv7-unknown-linux-gnueabihf # ARMv7 Linux, hardfloat (kernel 3.2, glibc 2.17) ✅ Tested
- i686-unknown-linux-gnu # 32-bit Linux (kernel 3.2+, glibc 2.17+) ✅ Tested
- i686-unknown-linux-musl # 32-bit Linux (kernel 3.2+, musl libc) ✅ Tested
# - mips-unknown-linux-gnu # MIPS Linux (kernel 2.6.32+, glibc 2.11+) ❌ Tested
# - mips-unknown-linux-musl # MIPS Linux (kernel 2.6.32+, musl libc) ❌ Tested
# - mips64-unknown-linux-gnuabi64 # MIPS64 Linux (kernel 2.6.32+, glibc 2.11+) ❌ Tested
# - mips64el-unknown-linux-gnuabi64 # MIPS64el Linux (kernel 2.6.32+, glibc 2.11+) ❌ Tested
# - mipsel-unknown-linux-gnu # MIPSel Linux (kernel 2.6.32+, glibc 2.11+) ❌ Tested
# - powerpc64le-unknown-linux-gnu # 64-bit PowerPC Linux (kernel 2.6.32+, glibc 2.11+) ❌ Tested
- x86_64-unknown-linux-gnu # 64-bit Linux (kernel 2.6.32+, glibc 2.11+) ✅ Tested
- x86_64-unknown-linux-musl # 64-bit Linux (kernel 2.6.32+, musl libc) ✅ Tested
# macOS targets 🍎
- x86_64-apple-darwin # 64-bit macOS (10.7 Lion or later) ✅ Tested
# Windows targets 🪟
# - i686-pc-windows-msvc # 32-bit Windows ❌ Tested
# - x86_64-pc-windows-msvc # 64-bit Windows ❌ Tested
include:
# Linux targets 🐧
- target: aarch64-unknown-linux-gnu # 64-bit Linux systems on ARM architecture
os: ubuntu-latest
cross: true
- target: aarch64-unknown-linux-musl # 64-bit Linux systems on ARM architecture
os: ubuntu-latest
cross: true
- target: arm-unknown-linux-gnueabi # ARMv6 Linux (kernel 3.2, glibc 2.17)
os: ubuntu-latest
cross: true
- target: armv7-unknown-linux-gnueabihf # ARMv7 Linux, hardfloat (kernel 3.2, glibc 2.17)
os: ubuntu-latest
cross: true
- target: i686-unknown-linux-gnu # 32-bit Linux (kernel 3.2+, glibc 2.17+)
os: ubuntu-latest
cross: true
- target: i686-unknown-linux-musl # 32-bit Linux (kernel 3.2+, musl libc)
os: ubuntu-latest
cross: true
# - target: mips-unknown-linux-gnu # MIPS Linux (kernel 2.6.32+, glibc 2.11+)
# os: ubuntu-latest
# cross: true
# - target: mips-unknown-linux-musl # MIPS Linux (kernel 2.6.32+, musl libc)
# os: ubuntu-latest
# cross: true
# - target: mips64-unknown-linux-gnuabi64 # MIPS64 Linux (kernel 2.6.32+, glibc 2.11+)
# os: ubuntu-latest
# cross: true
# - target: mips64el-unknown-linux-gnuabi64 # MIPS64el Linux (kernel 2.6.32+, glibc 2.11+)
# os: ubuntu-latest
# cross: true
# - target: mipsel-unknown-linux-gnu # MIPSel Linux (kernel 2.6.32+, glibc 2.11+)
# os: ubuntu-latest
# cross: true
# - target: powerpc64le-unknown-linux-gnu # 64-bit PowerPC Linux (kernel 2.6.32+, glibc 2.11+)
# os: ubuntu-latest
# cross: true
- target: x86_64-unknown-linux-gnu # 64-bit Linux (kernel 2.6.32+, glibc 2.11+)
os: ubuntu-latest
cross: true
- target: x86_64-unknown-linux-musl # 64-bit Linux (kernel 2.6.32+, musl libc)
os: ubuntu-latest
cross: true
# macOS targets 🍎
- target: x86_64-apple-darwin # 64-bit macOS (10.7 Lion or later)
os: macos-latest
cross: true
# Windows targets 🪟
# - target: i686-pc-windows-msvc # 32-bit Windows
# os: windows-latest
# cross: true
# - target: x86_64-pc-windows-msvc # 64-bit Windows
# os: windows-latest
# cross: true
max-parallel: 2
steps:
- name: Checkout repository 🛎️
id: checkout-repository
uses: actions/checkout@v4
with: { submodules: true }
- name: Installing Rust 🦀
id: install-rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
shell: /bin/bash -e {0}
- name: Update version number 🧮
id: update-version
if: github.ref == 'refs/heads/main' && !github.event.check_run.conclusion
run: |
NEW_VERSION=$(grep version Cargo.toml | sed -n 2p | cut -d '"' -f 2)
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
shell: /bin/bash -e {0}
- name: Install Cross 🦀
id: install-cross
run: |
# Install cross
cargo install cross
# Clean the build artifacts
cargo clean --verbose
shell: /bin/bash -e {0}
- name: Build targets 🏗
id: build-targets
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --workspace --release --target ${{ matrix.target }}
- name: Run Cargo Format 🦀
id: run-check-format
if: github.ref == !github.event.check_run.conclusion
run: |
cargo check --all --all-features --workspace --verbose
- name: Run Clippy 🦀
id: run-check-clippy
if: github.ref == !github.event.check_run.conclusion
run: |
cargo clippy --all-targets --all-features --workspace -- -D warnings
- name: Run Cargo Doc 🦀
id: run-check-doc
if: github.ref == 'refs/heads/main' && !github.event.check_run.conclusion
run: |
cargo doc --workspace --color always --no-deps --release --all-features
- name: Run Cargo Test 🦀
id: run-check-test
if: github.ref == 'refs/heads/main'
run: |
cargo test --all-targets --workspace --all-features
- name: Run Cargo Code Coverage 🦀
id: run-check-code-coverage
if: github.ref == 'refs/heads/main' && !github.event.check_run.conclusion
run: |
# Install tarpaulin
cargo install cargo-tarpaulin
# Run tarpaulin and generate the code coverage report
cargo tarpaulin --all --all-features --workspace --out Xml
- name: Upload to codecov.io 📊
id: upload-codecov
if: github.ref == 'refs/heads/main' && !github.event.check_run.conclusion
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: false
- name: Package the binary 📦
id: package-binary
if: github.ref == 'refs/heads/main'
run: |
mkdir -p target/package
tar czf target/package/${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release .
- name: Deploy binary 🚀
id: deploy-binary
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}.tar.gz
path: target/package/${{ matrix.target }}.tar.gz
- name: Generate Changelog 📜
id: generate-changelog
if: github.ref == 'refs/heads/main' && !github.event.check_run.conclusion
run: |
# Append version information to CHANGELOG.md
echo "## [${{ env.VERSION }}] - $(date +'%Y-%m-%d')" >> ${{ github.workspace }}/CHANGELOG.md
# Copy content of template file to CHANGELOG.md
cat TEMPLATE.md > ${{ github.workspace }}/CHANGELOG.md
# Append git log to CHANGELOG.md
echo "$(git log --pretty=format:'%s' --reverse $(git describe --tags --abbrev=0)..HEAD)" >> ${{ github.workspace }}/CHANGELOG.md
# Append empty line to CHANGELOG.md
echo "" >> ${{ github.workspace }}/CHANGELOG.md
# Append empty line to CHANGELOG.md
echo "" >> ${{ github.workspace }}/CHANGELOG.md
- name: Create Release 🚀
id: create_release
if: github.ref == 'refs/heads/main' && !github.event.check_run.conclusion
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: Mini Functions 🦀 v${{ env.VERSION }}
body_path: ${{ github.workspace }}/CHANGELOG.md
draft: true
prerelease: false