-
Notifications
You must be signed in to change notification settings - Fork 9
79 lines (74 loc) · 2.02 KB
/
pr-check.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
name: PR Check
on:
pull_request:
push:
branches: [main]
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
override: true
- name: Check formatting
run: cargo fmt --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
override: true
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Lint with Clippy
run: cargo clippy --workspace --all-features -- -D warnings -A clippy::needless_lifetimes
test:
strategy:
matrix:
crate:
[pubky, pubky-common, pubky-homeserver, pubky-testnet, http-relay]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install Nextest
uses: taiki-e/install-action@nextest
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Run doctests and nextest
run: |
set -e
# nextest does not support doctests yet.
cargo test --doc -p ${{ matrix.crate }} --all-features
if cargo nextest run \
-p ${{ matrix.crate }} \
--all-features \
--test-threads num-cpus \
--retries 2 \
--no-fail-fast \
--verbose; then
echo "Tests passed for ${{ matrix.crate }}"
else
if [ $? -eq 4 ]; then
echo "No tests found for ${{ matrix.crate }}"
exit 0
else
echo "Tests failed for ${{ matrix.crate }}"
exit 1
fi
fi