-
Notifications
You must be signed in to change notification settings - Fork 52
114 lines (104 loc) · 3.41 KB
/
ci.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
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
114
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
env:
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Install Rust
run: rustup update stable && rustup default stable
- name: Install cargo deny
run: cargo install --locked cargo-deny
- name: Lint
run: ./scripts/lint.sh
shell: bash
check-features:
name: Check feature combinations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Install Rust
run: rustup update stable && rustup default stable
- name: Install cargo deny
run: cargo install --locked cargo-hack
- name: Check
run: ./scripts/check-features.sh
shell: bash
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
thing:
- x86_64-linux
- aarch64-linux
- arm64-android
- x86_64-macos
include:
- apt_packages: ""
- custom_env: {}
- build_only: false
- cargo_args: ""
- thing: x86_64-linux
target: x86_64-unknown-linux-gnu
rust: stable
os: ubuntu-latest
- thing: aarch64-linux
build_only: true
target: aarch64-unknown-linux-gnu
rust: stable
os: ubuntu-latest
apt_packages: crossbuild-essential-arm64
custom_env:
CC: aarch64-linux-gnu-gcc
CXX: aarch64-linux-gnu-g++
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-g++
- thing: arm64-android
build_only: true
target: aarch64-linux-android
rust: stable
os: ubuntu-latest
cargo_args: --no-default-features --features server-client-common-default
- thing: x86_64-macos
target: x86_64-apple-darwin
rust: stable
os: macos-latest
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Install Rust (rustup)
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
shell: bash
- name: Install target-specific APT dependencies
if: "matrix.apt_packages != ''"
run: sudo apt update && sudo apt install -y ${{ matrix.apt_packages }}
shell: bash
- run: rustup target add ${{ matrix.target }}
- name: Set Android Linker path
if: endsWith(matrix.thing, '-android')
run: echo "CARGO_TARGET_$(echo ${{ matrix.target }} | tr \\-a-z _A-Z)_LINKER=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/$(echo ${{ matrix.target }} | sed s/armv7/armv7a/)21-clang++" >> "$GITHUB_ENV"
- name: Build tests
# We `build` because we want the linker to verify we are cross-compiling correctly for check-only targets.
run: cargo build --target ${{ matrix.target }} ${{matrix.cargo_args}}
shell: bash
env: ${{ matrix.custom_env }}
- name: Run tests
if: "!matrix.build_only"
run: _RJEM_MALLOC_CONF=prof:true cargo test --target ${{ matrix.target }} ${{matrix.cargo_args}}
shell: bash
env: ${{ matrix.custom_env }}