-
Notifications
You must be signed in to change notification settings - Fork 36
113 lines (96 loc) · 3.13 KB
/
Copy pathbuild.yml
File metadata and controls
113 lines (96 loc) · 3.13 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
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
name: Build
on:
workflow_call:
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
permissions: {}
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
jobs:
build:
name: Build (${{ matrix.target }})
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
- os: windows-latest
target: x86_64-pc-windows-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
env:
MATRIX_OS: ${{ matrix.os }}
MATRIX_TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Install linux build tools
shell: bash
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y gcc-arm-linux-gnueabihf \
libc6-dev-armhf-cross \
gcc-aarch64-linux-gnu \
musl-tools
- name: Toolchain
run: rustup toolchain install
- name: Add Rust target
shell: bash
run: rustup target add "${MATRIX_TARGET}"
- name: Cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
lookup-only: true
- name: Build binary
shell: bash
run: cargo build --locked --release --target "${MATRIX_TARGET}"
- name: Prepare artifact
shell: bash
run: |
ref_name="${GITHUB_REF_NAME}"
version="${ref_name##*/v}"
target="${MATRIX_TARGET}"
bin_path="target/${target}/release"
archive="basalt-${version}-${target}"
if [ "${MATRIX_OS}" = "windows-latest" ]; then
archive="${archive}.zip"
7z a "${archive}" "${bin_path}/basalt.exe"
certutil -hashfile "${archive}" SHA256 > "${archive}.sha256"
else
archive="${archive}.tar.gz"
tar -czf "${archive}" "${bin_path}/basalt"
shasum -a 256 "${archive}" > "${archive}.sha256"
fi
- name: Upload artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: artifacts-${{ matrix.target }}
path: |
basalt-*.tar.gz
basalt-*.zip
basalt-*.sha256
retention-days: 1