-
Notifications
You must be signed in to change notification settings - Fork 2
156 lines (153 loc) · 5.4 KB
/
release.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
name: Release
on:
release:
types: [published]
env:
CARGO_TERM_COLOR: always
jobs:
set-env:
runs-on: ubuntu-24.04
outputs:
name: ${{steps.vars.outputs.name}}
version: ${{steps.vars.outputs.version}}
steps:
- uses: actions/checkout@v4
- id: vars
run: |
set -e -o pipefail
echo "NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].name')" >> "$GITHUB_OUTPUT"
echo "VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].version')" >> "$GITHUB_OUTPUT"
build-linux-x86_64:
needs: set-env
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Rustfmt Check
run: cargo fmt --check
- name: Add x86_64-unknown-linux-musl target
run: |
rustup target add x86_64-unknown-linux-musl
sudo apt-get -y update
sudo apt-get -y install musl-dev musl-tools
- name: Build
run: cargo build --target=x86_64-unknown-linux-musl --release --verbose
- name: Run tests
run: cargo test --verbose
- name: Compress
run: >
cat "target/x86_64-unknown-linux-musl/release/${{needs.set-env.outputs.name}}"
| bzip2 -9 -c > ${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-linux-x86_64.bz2
- name: Upload
uses: diamondburned/[email protected]
with:
files: ${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-linux-x86_64.bz2
build-linux-arm64:
needs: set-env
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install cross
run: cargo install cross
- name: Build
run: cross build --target aarch64-unknown-linux-musl --release --verbose
- name: Compress
run: >
cat "target/aarch64-unknown-linux-musl/release/${{needs.set-env.outputs.name}}"
| bzip2 -9 -c > ${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-linux-arm64.bz2
- name: Upload
uses: diamondburned/[email protected]
with:
files: ${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-linux-arm64.bz2
build-darwin-x86_64:
needs: set-env
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --release --verbose
- name: Compress
run: >
cat "target/release/${{needs.set-env.outputs.name}}"
| bzip2 -9 -c > ${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-darwin-x86_64.bz2
- name: Upload
uses: diamondburned/[email protected]
with:
files: ${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-darwin-x86_64.bz2
build-darwin-arm64:
needs: set-env
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --release --verbose
- name: Compress
run: >
cat "target/release/${{needs.set-env.outputs.name}}"
| bzip2 -9 -c > ${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-darwin-arm64.bz2
- name: Upload
uses: diamondburned/[email protected]
with:
files: ${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-darwin-arm64.bz2
build-windows-x86_64:
needs: set-env
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose
- name: Compress
run: >
Compress-Archive
target/release/${{needs.set-env.outputs.name}}.exe
${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-windows-x86_64.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-x86_64-release
path: ${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-windows-x86_64.zip
upload-windows-x86_64:
needs: [set-env, build-windows-x86_64]
runs-on: ubuntu-24.04
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: windows-x86_64-release
- name: Upload
uses: diamondburned/[email protected]
with:
files: ${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-windows-x86_64.zip
build-windows-arm64:
needs: set-env
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Add aarch64-pc-windows-msvc target
run: |
rustup target add aarch64-pc-windows-msvc
- name: Build
run: cargo build --release --target=aarch64-pc-windows-msvc --verbose
- name: Compress
run: >
Compress-Archive
target/aarch64-pc-windows-msvc/release/${{needs.set-env.outputs.name}}.exe
${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-windows-arm64.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-arm64-release
path: ${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-windows-arm64.zip
upload-windows-arm64:
needs: [set-env, build-windows-arm64]
runs-on: ubuntu-24.04
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: windows-arm64-release
- name: Upload
uses: diamondburned/[email protected]
with:
files: ${{needs.set-env.outputs.name}}-${{needs.set-env.outputs.version}}-windows-arm64.zip