-
Notifications
You must be signed in to change notification settings - Fork 79
87 lines (79 loc) · 2.33 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
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Format
run: cargo fmt --check
- name: Clippy
run: cargo clippy && cargo clippy --all-features
- name: Build
run: cargo build --verbose --all-features
- name: Run tests
run: cargo test --verbose
- name: Doc
run: cargo doc --all-features
cross-linux:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- arch: 'aarch64'
rust: 'aarch64-unknown-linux-gnu'
os: 'aarch64-linux-gnu'
- arch: 'arm'
rust: 'armv7-unknown-linux-gnueabihf'
os: 'arm-linux-gnueabihf'
- arch: 'i386'
rust: 'i686-unknown-linux-gnu'
os: 'i686-linux-gnu'
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
target: ${{ matrix.target.rust }}
- name: Install QEMU and toolchain
run: |
sudo apt update
sudo apt -y install qemu-user qemu-user-static gcc-${{ matrix.target.os }} binutils-${{ matrix.target.os }} binutils-${{ matrix.target.os }}-dbg
- name: Append .cargo config
run: |
echo "[target.${{ matrix.target.rust }}]" >> ~/.cargo/config
echo "runner = \"qemu-${{ matrix.target.arch }} -L /usr/${{ matrix.target.os }}/\"" >> ~/.cargo/config
echo "linker = \"${{ matrix.target.os }}-gcc\"" >> ~/.cargo/config
- name: Build
run: cargo build --target ${{ matrix.target.rust }}
- name: Run tests
run: cargo test --target ${{ matrix.target.rust }}
- name: Doc
run: cargo doc --target ${{ matrix.target.rust }}
freebsd:
runs-on: ubuntu-latest
name: build (FreeBSD)
steps:
- uses: actions/checkout@v3
- name: Build
uses: vmactions/freebsd-vm@v1
with:
envs: 'RUSTFLAGS'
usesh: true
prepare: |
pkg install -y curl
run: |
curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal -y
. "$HOME/.cargo/env"
cargo build --all-features
cargo test