Skip to content

Commit 077694a

Browse files
committed
ci(build): experimental switch to new cross build action
1 parent 132aac3 commit 077694a

File tree

1 file changed

+86
-91
lines changed

1 file changed

+86
-91
lines changed

.github/workflows/build.yml

+86-91
Original file line numberDiff line numberDiff line change
@@ -14,104 +14,99 @@ env:
1414
CARGO_TERM_COLOR: always
1515

1616
jobs:
17-
linux:
18-
name: Linux Build
19-
runs-on: ubuntu-latest
17+
release:
18+
name: Build Commit - ${{ matrix.platform.release_for }}
2019
strategy:
2120
matrix:
22-
target: [ x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu, i686-unknown-linux-gnu, aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf ]
23-
steps:
24-
- name: Checkout Source code
25-
uses: actions/checkout@v4
26-
- name: Cache Rust dependencies
27-
uses: actions/cache@v4
28-
with:
29-
path: |
30-
~/.cargo/registry
31-
~/.cargo/git
32-
target
33-
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
34-
- name: Install Rust Toolchain
35-
uses: dtolnay/rust-toolchain@master
36-
with:
37-
toolchain: stable
38-
target: ${{ matrix.target }}
39-
- name: Install Build-Tools
40-
run: sudo apt-get update && sudo apt-get install build-essential gcc-multilib
41-
- name: Build target
42-
uses: actions-rs/cargo@v1
43-
with:
44-
use-cross: true
45-
command: build
46-
args: --release --target ${{ matrix.target }}
47-
- name: Upload Action Artifact
48-
uses: actions/upload-artifact@v4
49-
with:
50-
name: red_oxide_${{ runner.OS }}_${{ matrix.target }}
51-
path: target/${{ matrix.target }}/release/red_oxide
21+
platform:
22+
- release_for: FreeBSD-x86_64
23+
os: ubuntu-20.04
24+
target: x86_64-unknown-freebsd
25+
bin: red_oxide
26+
name: red_oxide-FreeBSD-x86_64
27+
command: build
5228

53-
windows:
54-
name: Windows Build
55-
runs-on: windows-latest
56-
strategy:
57-
matrix:
58-
target: [ i686-pc-windows-msvc, x86_64-pc-windows-msvc ]
59-
steps:
60-
- name: Checkout Source code
61-
uses: actions/checkout@v4
62-
- name: Cache Rust dependencies
63-
uses: actions/cache@v4
64-
with:
65-
path: |
66-
~/.cargo/registry
67-
~/.cargo/git
68-
target
69-
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
70-
- name: Install Rust Toolchain
71-
uses: dtolnay/rust-toolchain@master
72-
with:
73-
toolchain: stable
74-
target: ${{ matrix.target }}
75-
- name: Build target
76-
uses: actions-rs/cargo@v1
77-
with:
78-
command: build
79-
args: --release --target ${{ matrix.target }}
80-
- name: Upload Action Artifact
81-
uses: actions/upload-artifact@v4
82-
with:
83-
name: red_oxide_${{ runner.OS }}_${{ matrix.target }}.exe
84-
path: target/${{ matrix.target }}/release/red_oxide.exe
29+
- release_for: Linux-x86_64-gnu
30+
os: ubuntu-20.04
31+
target: x86_64-unknown-linux-gnu
32+
bin: red_oxide
33+
name: red_oxide-Linux-x86_64-gnu
34+
command: build
8535

86-
macos:
87-
name: MacOS Build
88-
runs-on: macos-latest
89-
strategy:
90-
matrix:
91-
target: [ x86_64-apple-darwin, aarch64-apple-darwin ]
36+
- release_for: Linux-x86_64-musl
37+
os: ubuntu-20.04
38+
target: x86_64-unknown-linux-musl
39+
bin: red_oxide
40+
name: red_oxide-Linux-x86_64-musl
41+
command: build
42+
43+
- release_for: Linux-i686
44+
os: ubuntu-20.04
45+
target: i686-unknown-linux
46+
bin: red_oxide
47+
name: red_oxide-Linux-i686
48+
command: build
49+
50+
- release_for: Linux-aarch64
51+
os: ubuntu-20.04
52+
target: aarch64-unknown-linux
53+
bin: red_oxide
54+
name: red_oxide-Linux-aarch64
55+
command: build
56+
57+
- release_for: Linux-armv7
58+
os: ubuntu-20.04
59+
target: armv7-unknown-linux-gnueabihf
60+
bin: red_oxide
61+
name: red_oxide-Linux-armv7
62+
command: build
63+
64+
- release_for: Windows-x86_64
65+
os: windows-latest
66+
target: x86_64-pc-windows-msvc
67+
bin: red_oxide.exe
68+
name: red_oxide-Windows-x86_64.exe
69+
command: build
70+
71+
- release_for: Windows-i686
72+
os: windows-latest
73+
target: i686-pc-windows-msvc
74+
bin: red_oxide.exe
75+
name: red_oxide-Windows-i686.exe
76+
command: build
77+
78+
- release_for: macOS-x86_64
79+
os: macOS-latest
80+
target: x86_64-apple-darwin
81+
bin: red_oxide
82+
name: red_oxide-Darwin-x86_64
83+
command: build
84+
85+
- release_for: macOS-aarch64
86+
os: macOS-latest
87+
target: aarch64-apple-darwin
88+
bin: red_oxide
89+
name: red_oxide-Darwin-aarch64
90+
command: build
91+
92+
runs-on: ${{ matrix.platform.os }}
9293
steps:
9394
- name: Checkout Source code
94-
uses: actions/checkout@v4
95-
- name: Cache Rust dependencies
96-
uses: actions/cache@v4
97-
with:
98-
path: |
99-
~/.cargo/registry
100-
~/.cargo/git
101-
target
102-
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
103-
- name: Install Rust Toolchain
104-
uses: dtolnay/rust-toolchain@master
105-
with:
106-
toolchain: stable
107-
target: ${{ matrix.target }}
108-
- name: Build target
109-
uses: actions-rs/cargo@v1
95+
uses: actions/checkout@v3
96+
- name: Cache cargo & target directories
97+
uses: Swatinem/rust-cache@v2
98+
- name: Install musl-tools on Linux
99+
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
100+
if: contains(matrix.platform.name, 'musl')
101+
- name: Build binary
102+
uses: houseabsolute/actions-rust-cross@v0
110103
with:
111-
command: build
112-
args: --release --target ${{ matrix.target }}
104+
command: ${{ matrix.platform.command }}
105+
target: ${{ matrix.platform.target }}
106+
args: "--locked --release"
107+
strip: true
113108
- name: Upload Action Artifact
114109
uses: actions/upload-artifact@v4
115110
with:
116-
name: red_oxide_${{ runner.OS }}_${{ matrix.target }}
117-
path: target/${{ matrix.target }}/release/red_oxide
111+
name: ${{ matrix.platform.name }}
112+
path: target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}

0 commit comments

Comments
 (0)