-
Notifications
You must be signed in to change notification settings - Fork 17
61 lines (52 loc) · 1.82 KB
/
build.yml
File metadata and controls
61 lines (52 loc) · 1.82 KB
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
name: Build and Upload Executables
on:
push:
branches:
- main
release:
types: [published]
jobs:
build:
name: Build for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
artifact_suffix: ""
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
artifact_suffix: ""
- target: aarch64-apple-darwin
os: macos-latest
artifact_suffix: ""
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact_suffix: ".exe"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install dependencies for x86_64 musl build
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Install cross for aarch64 musl build
if: matrix.target == 'aarch64-unknown-linux-musl'
run: cargo install cross
- name: Build with cross for aarch64-musl
if: matrix.target == 'aarch64-unknown-linux-musl'
run: cross build --release --target ${{ matrix.target }}
- name: Build with cargo for other targets
if: matrix.target != 'aarch64-unknown-linux-musl'
run: cargo build --release --target ${{ matrix.target }}
env:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc
- name: Upload executable
uses: actions/upload-artifact@v4
with:
name: faucet-${{ matrix.target }}
path: target/${{ matrix.target }}/release/faucet${{ matrix.artifact_suffix }}