-
-
Notifications
You must be signed in to change notification settings - Fork 64
66 lines (62 loc) · 2.16 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
name: Rust
on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install the nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "8"
- name: Install linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt update && sudo apt install build-essential libssl-dev pkg-config libglib2.0-dev libgtk-3-dev libudev-dev
- name: Check examples
run: cargo check --examples
- name: Lint
run: cargo clippy --workspace -- -D warnings
- name: Format
run: cargo +nightly fmt --all --check -- --error-on-unformatted --unstable-features
- name: Run Linux tests
if: runner.os == 'Linux'
run: |
export RUSTFLAGS="-Cinstrument-coverage"
export LLVM_PROFILE_FILE='cargo-test-%p-%m.profraw'
cargo nextest run --workspace --exclude examples
- name: Run MacOS and Windows tests
if: runner.os != 'Linux'
run: cargo nextest run --workspace --exclude examples
- name: Run doctests
run: cargo test --workspace --doc
- name: Run coverage
if: runner.os == 'Linux'
run: |
rustup component add llvm-tools-preview
curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf -
./grcov . --binary-path ./target/debug/deps -s . -t lcov --branch --ignore-not-existing --ignore "../*" --ignore "/*" -o cov.lcov
- uses: codecov/codecov-action@v4
if: runner.os == 'Linux'
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Make sure the mocked Skia bindings are on sync
if: runner.os == 'Linux'
run: cargo build --package freya --features mocked-engine-development --no-default-features