forked from comtrya/comtrya
-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (181 loc) · 5.99 KB
/
main.yaml
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
name: release
on:
workflow_dispatch: {}
push:
branches:
- "main"
env:
MIN_SUPPORTED_RUST_VERSION: "1.77.0"
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
CARGO_TERM_COLOR: always
#Fix these up soon
#RUSTFLAGS: "-D warnings"
jobs:
lint-test-release:
runs-on: ubuntu-22.04
steps:
- name: Clone Repository
uses: actions/checkout@v4
- name: Install Rust Toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }})
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }}
default: true
profile: minimal
components: clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets
- name: Run Tests
uses: actions-rs/cargo@v1
with:
command: test
- name: Run Tarpaulin
uses: actions-rs/[email protected]
with:
version: "0.22.0"
args: "--workspace -- --test-threads 1"
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
- name: Check for Release
id: is-release
shell: bash
run: |
unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi
echo ::set-output name=IS_RELEASE::${IS_RELEASE}
- name: Cargo Publish "comtrya-lib"
if: steps.is-release.outputs.IS_RELEASE
run: cargo publish -p comtrya-lib --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Cargo Publish "comtrya"
if: steps.is-release.outputs.IS_RELEASE
run: cargo publish -p comtrya --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
build:
name: Build-${{ matrix.platform.target }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- os_name: Linux-x86_64-gnu
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
bin: comtrya
name: comtrya-x86_64-unknown-linux-gnu
cross: false
cargo_command: cargo
skip_tests: false
- os_name: Linux-aarch64-gnu
os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
bin: comtrya
name: comtrya-aarch64-unknown-linux-gnu
cross: false
cargo_command: ./cross
skip_tests: false
- os_name: Windows-x86_64
os: windows-2022
target: x86_64-pc-windows-msvc
bin: comtrya.exe
name: comtrya-x86_64-pc-windows-msvc
cross: false
cargo_command: cargo
skip_tests: false
- os_name: macOS-x86_64
os: macos-12
target: x86_64-apple-darwin
bin: comtrya
name: comtrya-x86_64-apple-darwin
cross: false
cargo_command: cargo
skip_tests: false
- os_name: macOS-aarch64
os: macos-12
target: aarch64-apple-darwin
bin: comtrya
name: comtrya-aarch64-apple-darwin
cross: true
cargo_command: ./cross
skip_tests: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: "build"
target: ${{ matrix.platform.target }}
toolchain: stable
args: "--release"
- name: Rename Binary
if: matrix.platform.target != 'x86_64-pc-windows-msvc'
shell: bash
run: |
mv target/${{ matrix.platform.target }}/release/comtrya comtrya-${{ matrix.platform.target }}
- name: Rename Binary.exe
if: matrix.platform.target == 'x86_64-pc-windows-msvc'
shell: bash
run: |
mv target/${{ matrix.platform.target }}/release/comtrya.exe comtrya-${{ matrix.platform.target }}.exe
- name: Upload Artifact
if: matrix.platform.target != 'x86_64-pc-windows-msvc'
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: false
name: Unreleased
generate_release_notes: false
fail_on_unmatched_files: true
files: |
comtrya-${{ matrix.platform.target }}
- name: Upload Artifact.exe
if: matrix.platform.target == 'x86_64-pc-windows-msvc'
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: false
name: Unreleased
generate_release_notes: false
fail_on_unmatched_files: true
files: |
comtrya-${{ matrix.platform.target }}.exe
build-musl:
runs-on: ubuntu-latest
container: clux/muslrust:stable
steps:
- name: Clone Repository
uses: actions/checkout@v4
- name: Link to muscl Toolchain
run: |
ln -s /root/.cargo $HOME/.cargo
ln -s /root/.rustup $HOME/.rustup
- name: Handle Rust Dependencies Caching
uses: Swatinem/rust-cache@v2
with:
key: v1-linux-musl
- name: Build Release Binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Rename Binary
shell: bash
run: |
mv target/x86_64-unknown-linux-musl/release/comtrya target/x86_64-unknown-linux-musl/release/comtrya-x86_64-unknown-linux-musl
- name: Upload release archive
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: false
name: Unreleased
generate_release_notes: false
fail_on_unmatched_files: true
files: |
target/x86_64-unknown-linux-musl/release/comtrya-x86_64-unknown-linux-musl