-
-
Notifications
You must be signed in to change notification settings - Fork 5
208 lines (176 loc) · 7.41 KB
/
publish.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
name: Publish
on:
workflow_run:
branches:
- master
workflows:
- Tests & Checks
types:
- completed
workflow_dispatch:
permissions: write-all
jobs:
publish:
name: Publish
runs-on: ${{ matrix.os }}
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
outputs:
tag: ${{ steps.publish.outputs.tag }}
version: ${{ steps.publish.outputs.version }}
strategy:
matrix:
os:
- ubuntu-latest
toolchain:
- 1.77.2
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: recursive
show-progress: false
- name: Set up Rust toolchain
uses: Systemcluster/actions@setup-rust-v0
with:
channel: ${{ matrix.toolchain }}
cache-key-job: true
- name: Prepare release
run: |
# Archive runner source
cd startpe && tar cf ../startpe.tar * && cd ..
- name: Publish crates
uses: Systemcluster/actions@release-crates-v0
id: publish
if: github.ref == 'refs/heads/master' && github.repository_owner == 'Systemcluster'
with:
crates-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
dry-run: ${{ !secrets.CARGO_REGISTRY_TOKEN }}
allow-dirty: true
tag-crate: wrappe
release:
name: Release
runs-on: ubuntu-latest
needs: publish
if: ${{ needs.publish.result == 'success' && needs.publish.outputs.tag != '' && needs.publish.outputs.version != '' }}
strategy:
matrix:
os:
- ubuntu-latest
toolchain:
- 1.77.2
env:
WRAPPE_TARGETS: "aarch64-apple-darwin;x86_64-apple-darwin;x86_64-pc-windows-gnu;x86_64-unknown-linux-musl"
MACOSX_DEPLOYMENT_TARGET: 12.3
WRAPPE_TARGET_CC_aarch64-apple-darwin: "aarch64-apple-darwin22.4-clang"
WRAPPE_TARGET_CXX_aarch64-apple-darwin: "aarch64-apple-darwin22.4-clang++"
WRAPPE_TARGET_AR_aarch64-apple-darwin: "aarch64-apple-darwin22.4-ar"
WRAPPE_TARGET_CC_x86_64-apple-darwin: "x86_64-apple-darwin22.4-clang"
WRAPPE_TARGET_CXX_x86_64-apple-darwin: "x86_64-apple-darwin22.4-clang++"
WRAPPE_TARGET_AR_x86_64-apple-darwin: "x86_64-apple-darwin22.4-ar"
WRAPPE_TARGET_STRIP_x86_64-apple-darwin: "llvm-strip -x"
WRAPPE_TARGET_STRIP_aarch64-apple-darwin: "llvm-strip -x"
WRAPPE_TARGET_RUSTFLAGS_aarch64-apple-darwin: "-Ctarget-cpu=apple-m1 -Ctarget-feature=+crt-static -Cstrip=none"
WRAPPE_TARGET_RUSTFLAGS_x86_64-apple-darwin: "-Ctarget-cpu=x86-64-v2 -Ctarget-feature=+crt-static -Cstrip=none"
WRAPPE_TARGET_RUSTFLAGS_x86_64-pc-windows-gnu: "-Ctarget-cpu=x86-64-v2 -Ctarget-feature=+crt-static"
WRAPPE_TARGET_RUSTFLAGS_x86_64-unknown-linux-musl: "-Ctarget-cpu=x86-64-v2 -Ctarget-feature=+crt-static"
WRAPPE_MACOS_UNIVERSAL: "aarch64-apple-darwin;x86_64-apple-darwin"
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: recursive
show-progress: false
- name: Set up environment
run: sudo apt-get install mingw-w64 musl-tools patch libssl-dev lzma-dev libxml2-dev llvm-dev
- name: Set up macOS toolchain cache
uses: actions/cache/restore@v4
id: cache-osxcross
with:
path: |
~/osxcross
key: ${{ runner.os }}-toolchain-osxcross-13.3
restore-keys: |
${{ runner.os }}-toolchain-osxcross
- name: Build macOS toolchain
if: steps.cache-osxcross.outputs.cache-hit != 'true'
env:
OSX_VERSION_MIN: 12.3
run: |
# Build macOS toolchain
cd $HOME
[ -d "osxcross" ] || git clone https://github.com/tpoechtrager/osxcross
cd osxcross
[ -f "tarballs/MacOSX13.3.sdk.tar.xz" ] || wget -nc https://github.com/alexey-lysiuk/macos-sdk/releases/download/13.3/MacOSX13.3.tar.xz -O tarballs/MacOSX13.3.sdk.tar.xz
[ -f "target/bin/x86_64-apple-darwin22.4-clang" ] || UNATTENDED=yes ./build.sh
- name: Save macOS toolchain cache
if: steps.cache-osxcross.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
~/osxcross
key: ${{ runner.os }}-toolchain-osxcross-13.3
- name: Configure Rust toolchain
run: |
# Configure toolchain
cd $HOME
chmod -R 777 osxcross
chmod -R +x osxcross/target/bin
echo "$(pwd)/osxcross/target/bin" >> $GITHUB_PATH
mkdir -p .cargo
touch .cargo/config
echo '[target.aarch64-apple-darwin]' >> .cargo/config
echo 'linker = "aarch64-apple-darwin22.4-clang"' >> .cargo/config
echo 'ar = "aarch64-apple-darwin22.4-ar"' >> .cargo/config
echo 'rustflags = ["-Ctarget-cpu=apple-m1", "-Ctarget-feature=+crt-static", "-Cstrip=none"]' >> .cargo/config
echo '[target.x86_64-apple-darwin]' >> .cargo/config
echo 'linker = "x86_64-apple-darwin22.4-clang"' >> .cargo/config
echo 'ar = "x86_64-apple-darwin22.4-ar"' >> .cargo/config
echo 'rustflags = ["-Ctarget-cpu=x86-64-v2", "-Ctarget-feature=+crt-static", "-Cstrip=none"]' >> .cargo/config
echo '[target.x86_64-pc-windows-gnu]' >> .cargo/config
echo 'rustflags = ["-Ctarget-cpu=x86-64-v2", "-Ctarget-feature=+crt-static"]' >> .cargo/config
echo '[target.x86_64-unknown-linux-musl]' >> .cargo/config
echo 'rustflags = ["-Ctarget-cpu=x86-64-v2", "-Ctarget-feature=+crt-static"]' >> .cargo/config
ls osxcross/target/bin
- name: Set up Rust toolchain
uses: Systemcluster/actions@setup-rust-v0
with:
channel: ${{ matrix.toolchain }}
targets: ${{ env.WRAPPE_TARGETS }}
cache-key-job: true
components: llvm-tools
- name: Build macOS ARM release
env:
CC: "aarch64-apple-darwin22.4-clang"
CXX: "aarch64-apple-darwin22.4-clang++"
run: cargo build --release --target aarch64-apple-darwin
- name: Build macOS x64 release
env:
CC: "x86_64-apple-darwin22.4-clang"
CXX: "x86_64-apple-darwin22.4-clang++"
run: cargo build --release --target x86_64-apple-darwin
- name: Build Windows x64 release
run: cargo build --release --target x86_64-pc-windows-gnu
- name: Build Linux x64 release
run: cargo build --release --target x86_64-unknown-linux-musl
- name: Collect executables
run: |
# Collect executables
mv target/x86_64-pc-windows-gnu/release/wrappe.exe wrappe.exe
mv target/x86_64-unknown-linux-musl/release/wrappe wrappe-linux
mv target/x86_64-apple-darwin/release/wrappe wrappe-macos-x86
mv target/aarch64-apple-darwin/release/wrappe wrappe-macos-arm
chmod +x wrappe-linux
chmod +x wrappe-macos-x86
chmod +x wrappe-macos-arm
llvm-strip -x wrappe-macos-x86
llvm-strip -x wrappe-macos-arm
aarch64-apple-darwin22.4-lipo -create -output wrappe-macos wrappe-macos-arm wrappe-macos-x86
- name: Upload release
uses: Systemcluster/actions@release-github-v0
with:
tag: ${{ needs.publish.outputs.tag }}
name: ${{ needs.publish.outputs.version }}
files: |
wrappe.exe
wrappe-linux
wrappe-macos