-
-
Notifications
You must be signed in to change notification settings - Fork 157
138 lines (130 loc) · 3.82 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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Rust
on:
push:
branches: [dev, master]
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
grcov-version: 0.8.0
jobs:
build:
strategy:
matrix:
target:
- macos
- linux
- windows
- android
include:
- target: macos
os: macOS-latest
cbt: aarch64-apple-darwin
- target: linux
os: ubuntu-latest
cbt: x86_64-unknown-linux-gnu
- target: windows
os: windows-latest
cbt: x86_64-pc-windows-msvc
- target: android
os: ubuntu-latest
cbt: aarch64-linux-android
runs-on: ${{ matrix.os }}
env:
CARGO_BUILD_TARGET: ${{ matrix.cbt }}
steps:
- uses: actions/checkout@v2
- name: Install dependencies
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install libdbus-1-dev
- uses: actions/setup-java@v2
if: ${{ matrix.target == 'android' }}
with:
distribution: 'zulu'
java-version: '17'
- name: Setup NDK
if: ${{ matrix.target == 'android' }}
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25b
local-cache: true
- name: rust toolchain
if: ${{ matrix.target == 'android' }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: aarch64-linux-android
toolchain: stable
override: true
- name: Check
run: cargo check --all --bins --examples
- name: Check without default features
run: cargo check --all --bins --examples --no-default-features
- name: Check with all features
run: cargo check --all --bins --examples --all-features
- name: Run tests
if: ${{ matrix.target != 'android' }}
run: cargo test --all
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
name: clippy ${{ matrix.os }}
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Format Rust code
run: cargo fmt --all -- --check
# coverage:
# strategy:
# matrix:
# os:
# - macOS-latest
# - ubuntu-latest
# - windows-latest
# runs-on: ${{ matrix.os }}
#
# env:
# RUSTC_BOOTSTRAP: 1
# steps:
# - uses: actions/checkout@v2
# - name: Install dependencies
# if: ${{ runner.os == 'Linux' }}
# run: sudo apt-get install libdbus-1-dev
# - name: Cache grcov
# uses: actions/cache@v2
# with:
# path: |
# ~/.cargo/bin/grcov
# ~/.cargo/bin/grcov.exe
# ~/.cargo/.crates.toml
# ~/.cargo/.crates2.json
# key: ${{ runner.os }}-cargo-bin-${{ env.grcov-version }}
# - name: Install grcov
# uses: actions-rs/install@v0.1
# with:
# crate: grcov
# version: ${{ env.grcov-version }}
# - name: Install llvm-tools
# run: rustup component add llvm-tools-preview
# - name: Build for coverage
# run: cargo build --all-features
# env:
# RUSTFLAGS: "-Zinstrument-coverage -Ccodegen-units=1"
# - name: Run tests with coverage
# run: cargo test --all-features
# env:
# RUSTFLAGS: "-Zinstrument-coverage"
# LLVM_PROFILE_FILE: "test-coverage-%p-%m.profraw"
# - name: Convert coverage
# run: grcov . -s . --binary-path target/debug/ -t lcov --branch --ignore-not-existing -o target/debug/lcov.info
# - name: Upload coverage to codecov.io
# uses: codecov/codecov-action@v1
# with:
# directory: ./target/debug
# fail_ci_if_error: true