-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (87 loc) · 3.89 KB
/
main.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
name: Distribution Builds
on:
push:
# Manual dispatch for testing
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-latest, macos-latest, ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- name: Build Windows
if: matrix.os == 'windows-latest'
run: |
mkdir out
mkdir tmp_build
rustup target add i686-pc-windows-msvc
cargo build --release
cargo build --target i686-pc-windows-msvc --release
copy target/release/roast.exe tmp_build/roast-win-64.exe
copy target/i686-pc-windows-msvc/release/roast.exe tmp_build/roast-win-32.exe
cargo build --release --features win_console
cargo build --target i686-pc-windows-msvc --release --features win_console
copy target/release/roast.exe tmp_build/roast-win-console-64.exe
copy target/i686-pc-windows-msvc/release/roast.exe tmp_build/roast-win-console-32.exe
cargo build --release --features win_no_gpu
cargo build --target i686-pc-windows-msvc --release --features win_no_gpu
copy target/release/roast.exe tmp_build/roast-win-no-gpu-64.exe
copy target/i686-pc-windows-msvc/release/roast.exe tmp_build/roast-win-no-gpu-32.exe
Compress-Archive -Path tmp_build/roast-win-64.exe -Destination out/roast-win-64.exe.zip
Compress-Archive -Path tmp_build/roast-win-32.exe -Destination out/roast-win-32.exe.zip
Compress-Archive -Path tmp_build/roast-win-console-64.exe -Destination out/roast-win-console-64.exe.zip
Compress-Archive -Path tmp_build/roast-win-console-32.exe -Destination out/roast-win-console-32.exe.zip
Compress-Archive -Path tmp_build/roast-win-no-gpu-64.exe -Destination out/roast-win-no-gpu-64.exe.zip
Compress-Archive -Path tmp_build/roast-win-no-gpu-32.exe -Destination out/roast-win-no-gpu-32.exe.zip
- name: Build MacOS (setup)
if: matrix.os == 'macos-latest'
run: |
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
- name: Build MacOS (x86_64)
if: matrix.os == 'macos-latest'
env:
MACOSX_DEPLOYMENT_TARGET: '10.12'
run: |
cargo build --target x86_64-apple-darwin --release
- name: Build MacOS (aarch64)
if: matrix.os == 'macos-latest'
env:
MACOSX_DEPLOYMENT_TARGET: '11.0'
run: |
cargo build --target aarch64-apple-darwin --release
- name: Build MacOS (release)
if: matrix.os == 'macos-latest'
run: |
mkdir -p out
mv target/x86_64-apple-darwin/release/roast ./roast-macos-x86_64
mv target/aarch64-apple-darwin/release/roast ./roast-macos-aarch64
chmod +x ./roast-macos-x86_64 ./roast-macos-aarch64
zip out/roast-macos-x86_64.zip ./roast-macos-x86_64
zip out/roast-macos-aarch64.zip ./roast-macos-aarch64
- name: Build Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt install -y gcc-aarch64-linux-gnu
rustup target add aarch64-unknown-linux-gnu
cargo build --release
cargo build --target aarch64-unknown-linux-gnu --release
mkdir -p out
mv target/release/roast ./roast-linux-x86_64
mv target/aarch64-unknown-linux-gnu/release/roast ./roast-linux-aarch64
chmod +x ./roast-linux-x86_64 ./roast-linux-aarch64
zip out/roast-linux-x86_64.zip ./roast-linux-x86_64
zip out/roast-linux-aarch64.zip ./roast-linux-aarch64
- name: Artifact upload
uses: actions/upload-artifact@v4
with:
name: outputs-${{ matrix.os }}
path: out
retention-days: 1
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: out/*