11name : Rust
22
33on :
4- push :
5- branches : [ "dev" ]
64 pull_request :
7- branches : [ "dev" ]
5+ branches : ["dev"]
6+ push :
7+ branches : ["dev"]
8+ workflow_dispatch :
89
910env :
1011 CARGO_TERM_COLOR : always
1112
1213jobs :
1314 build :
14- runs-on : ubuntu-latest
15+ runs-on : ${{ matrix.os }}
16+ strategy :
17+ matrix :
18+ include :
19+ - os : macos-14
20+ target : aarch64-apple-darwin
21+ - os : ubuntu-latest
22+ target : x86_64-unknown-linux-gnu
23+ - os : windows-latest
24+ target : x86_64-pc-windows-msvc
1525
1626 steps :
17- - uses : actions/checkout@v4
18-
19- - name : Install Rust nightly
20- uses : actions-rs/toolchain@v1
21- with :
22- toolchain : nightly
23- override : true
27+ - name : Checkout repository
28+ uses : actions/checkout@v4
2429
2530 - name : Cache dependencies
26- uses : actions/cache@v3
31+ uses : swatinem/rust-cache@v2
32+
33+ - name : Install Rust nightly
34+ uses : dtolnay/rust-toolchain@nightly
2735 with :
28- path : |
29- ~/.cargo/bin/
30- ~/.cargo/registry/index/
31- ~/.cargo/registry/cache/
32- ~/.cargo/git/db/
33- target/
34- key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
35- restore-keys : |
36- ${{ runner.os }}-cargo-
36+ targets : ${{ matrix.target }}
3737
3838 - name : Build
39- uses : actions-rs /cargo@v1
39+ uses : ClementTsang /cargo-action@v0.0.6
4040 with :
41+ args : --release --target ${{ matrix.target }} --verbose
4142 command : build
42- args : --release --verbose
4343
4444 - name : Run tests
45- uses : actions-rs /cargo@v1
45+ uses : ClementTsang /cargo-action@v0.0.6
4646 with :
47+ args : --target ${{ matrix.target }} --verbose
4748 command : test
48- args : --verbose
4949
5050 - name : Upload executable
5151 uses : actions/upload-artifact@v4
5252 with :
53- name : ferrumc
54- path : target/release/ferrumc
53+ name : ferrumc-${{ matrix.os }}
54+ path : target/${{ matrix.target }}/ release/ferrumc*
5555
5656 # Uncomment the following block if you want to send a message to Discord:
5757 # - name: Send message to Discord
6161 # with:
6262 # args: 'A new commit has been pushed!
6363 #
64- # {{ EVENT_PAYLOAD.head_commit.url }}'
64+ # {{ EVENT_PAYLOAD.head_commit.url }}'
0 commit comments