-
Notifications
You must be signed in to change notification settings - Fork 6
128 lines (118 loc) · 3.7 KB
/
ci.yaml
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
name: Fmt and Clippy
# This job runs rustfmt and clippy linting,
on:
push:
branches: main
pull_request:
branches: main
workflow_dispatch: # allows manual trigger
env:
RUST_FMT_VERSION: nightly-2023-04-01-x86_64-unknown-linux-gnu
CRATE_TO_RUST_VERSION_MAP: '{}'
DEFAULT_RUST_VERSION: "1.76"
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
name: 'Detect changes'
outputs:
crates: ${{ steps.filter.outputs.changes }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
wallet-proxy-load-simulator/Cargo.toml:
- 'wallet-proxy-load-simulator/**'
- '.github/**'
state-compare/Cargo.toml:
- 'state-compare/**'
- '.github/**'
genesis-creator/Cargo.toml:
- 'genesis-creator/**'
- '.github/**'
id-verifier/Cargo.toml:
- 'id-verifier/**'
- '.github/**'
kpi-tracker/Cargo.toml:
- 'kpi-tracker/**'
- '.github/**'
chain-prometheus-exporter/Cargo.toml:
- 'chain-prometheus-exporter/**'
- '.github/**'
recover-id-object/Cargo.toml:
- 'recover-id-object/**'
- '.github/**'
generator/Cargo.toml:
- 'generator/**'
- '.github/**'
wallet-connect-test-bench/smart-contract/Cargo.toml:
- 'wallet-connect-test-bench/**'
- '.github/**'
notification-server/Cargo.toml:
- 'notification-server/**'
- '.github/**'
"lint_fmt":
name: lint:fmt
runs-on: ubuntu-latest
if: needs.changes.outputs.crates != '[]' && !github.event.pull_request.draft
needs: [changes]
strategy:
fail-fast: false
matrix:
crates: ${{ fromJSON(needs.changes.outputs.crates) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
run: |
rustup default ${{ env.RUST_FMT_VERSION }}
rustup component add rustfmt
- name: Format
run: |
cargo fmt --manifest-path=${{ matrix.crates }} -- --check
"lint_clippy":
name: lint:clippy
needs: [changes, lint_fmt]
if: needs.changes.outputs.crates != '[]' && !github.event.pull_request.draft
strategy:
fail-fast: false
matrix:
crates: ${{ fromJSON(needs.changes.outputs.crates) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
run: |
RUST_VERSION=$(echo '${{ env.CRATE_TO_RUST_VERSION_MAP }}' | jq -r '.["${{ matrix.crates }}"] // "${{ env.DEFAULT_RUST_VERSION }}"')
rustup default $RUST_VERSION
rustup component add clippy
- name: Clippy
run: |
cargo clippy --manifest-path ${{ matrix.crates }} --locked -- -D warnings
tests:
name: tests
runs-on: ubuntu-latest
needs: [changes, lint_fmt]
strategy:
fail-fast: false
matrix:
crates: ${{ fromJSON(needs.changes.outputs.crates) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
run: |
RUST_VERSION=$(echo '${{ env.CRATE_TO_RUST_VERSION_MAP }}' | jq -r '.["${{ matrix.crates }}"] // "${{ env.DEFAULT_RUST_VERSION }}"')
rustup default $RUST_VERSION
- name: Cargo tests
run: |
cargo test --manifest-path ${{ matrix.crates }} --locked