forked from notify-rs/notify
-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (113 loc) · 4.03 KB
/
ci.yml
File metadata and controls
140 lines (113 loc) · 4.03 KB
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
139
140
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
common-quality:
name: Common Quality Checks
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1
- uses: oxc-project/setup-rust@cd82e1efec7fef815e2c23d296756f31c7cdc03d # v1.0.0
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: warm
tools: typos-cli,cargo-deny,cargo-shear
- name: Check for typos
run: typos
- name: Run cargo-deny
run: cargo deny check
- name: Run cargo-shear
run: cargo shear
# Code quality checks
quality:
name: Quality Checks ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1
- uses: oxc-project/setup-rust@cd82e1efec7fef815e2c23d296756f31c7cdc03d # v1.0.0
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: warm
components: clippy rustfmt
tools: typos-cli,cargo-deny,cargo-shear
- name: Check formatting
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
# Test on multiple platforms with different Rust versions
test:
name: Test ${{ matrix.os }} ${{ matrix.features != '' && format('({0})', matrix.features) || '' }}
runs-on: ${{ matrix.os }}
needs: quality
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
features: [""]
include:
# MacOS with fsevent
- os: macos-latest
features: "--no-default-features --features macos_fsevent"
# MacOS with kqueue
- os: macos-latest
features: "--no-default-features --features macos_kqueue"
steps:
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1
- uses: oxc-project/setup-rust@cd82e1efec7fef815e2c23d296756f31c7cdc03d # v1.0.0
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: warm
- name: Build
run: cargo build --verbose ${{ matrix.features }}
- name: Build examples
run: cargo build --examples --verbose ${{ matrix.features }}
- name: Run tests
run: cargo test --verbose ${{ matrix.features }}
# Android cross-compilation
android:
name: Android
runs-on: ubuntu-latest
needs: quality
steps:
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1
- uses: oxc-project/setup-rust@f03aedf4620c1d3aa169a2510e24787d362bbe0b # v1.0.8
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: warm-android
tools: cargo-ndk
- name: Add Rust targets
run: |
rustup target add armv7-linux-androideabi
rustup target add aarch64-linux-android
- name: Build for Android (arm64)
run: cargo ndk --target aarch64-linux-android build --verbose
- name: Build for Android (arm)
run: cargo ndk --target armv7-linux-androideabi build --verbose
# WebAssembly System Interface (WASI)
wasi:
name: WASI
runs-on: ubuntu-latest
needs: quality
steps:
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1
- uses: oxc-project/setup-rust@f03aedf4620c1d3aa169a2510e24787d362bbe0b # v1.0.8
with:
save-cache: ${{ github.ref_name == 'main' }}
cache-key: warm-wasi
- name: Add Rust target
run: rustup target add wasm32-wasip2
- name: Build for WASI
run: cargo build --target wasm32-wasip2 --workspace --verbose
- name: Build examples for WASI
run: cargo build --examples --target wasm32-wasip2 --verbose