-
Notifications
You must be signed in to change notification settings - Fork 47
88 lines (88 loc) · 2.72 KB
/
rust.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
name: Rust Build
on:
workflow_dispatch:
push:
branches: [master]
tags: ["v*"]
pull_request:
branches: [master]
permissions:
contents: write
pull-requests: read
jobs:
build:
name: Build
runs-on: ${{ matrix.config.runs-on }}
strategy:
fail-fast: false
matrix:
config:
- runs-on: macos-latest
target: aarch64-apple-darwin
test: true
cross: false
- runs-on: macos-latest
target: x86_64-apple-darwin
test: true
cross: false
- runs-on: ubuntu-latest
target: x86_64-unknown-linux-gnu
test: true
cross: true
- runs-on: ubuntu-latest
target: x86_64-unknown-linux-musl
test: true
cross: true
- runs-on: ubuntu-latest
target: aarch64-unknown-linux-gnu
test: true
cross: true
- runs-on: ubuntu-latest
target: aarch64-unknown-linux-musl
test: true
cross: true
- runs-on: windows-latest
target: x86_64-pc-windows-msvc
test: true
cross: false
- runs-on: windows-latest
target: i686-pc-windows-msvc
test: true
cross: false
- runs-on: ubuntu-latest
target: x86_64-pc-windows-gnu
test: false
cross: true
- runs-on: windows-latest
target: aarch64-pc-windows-msvc
test: false
cross: false
- runs-on: ubuntu-latest
target: x86_64-unknown-freebsd
test: false
cross: true
env:
CARGO_CMD: ${{ matrix.config.cross && 'cross' || 'cargo' }}
ARTIFACT_SUFFIX: ${{ contains(matrix.config.target, 'windows') && '.exe' || '' }}
TAG: ${{ github.ref_type == 'tag' && github.ref_name || github.sha }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.config.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cross
if: matrix.config.cross
run: type cross > /dev/null || cargo install cross
- name: Install toolchain
run: rustup target install ${{ matrix.config.target }}
- name: Build
run: ${{ env.CARGO_CMD }} build --verbose --release --target ${{ matrix.config.target }}
- name: Test
if: matrix.config.test
run: ${{ env.CARGO_CMD }} test --verbose --release --target ${{ matrix.config.target }}