-
Notifications
You must be signed in to change notification settings - Fork 15
150 lines (132 loc) · 4.66 KB
/
rust-fmt-lint.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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: nightly-2023-04-01-x86_64-unknown-linux-gnu
RUST_VERSION: 1.74
CARGO_CONCORDIUM_VERSION: "3.2.0"
jobs:
lint_fmt:
name: Running formatting
# Don't run on draft pull requests
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
strategy:
matrix:
crates:
- gallery/verifier/Cargo.toml
- low-code-nft-marketplace/cis2-market/Cargo.toml
- sponsoredTransactions/backend/Cargo.toml
- sponsoredTransactionsAuction/backend/Cargo.toml
- trackAndTrace/smart-contract/Cargo.toml
- trackAndTrace/test-scripts/Cargo.toml
- trackAndTrace/indexer/Cargo.toml
- trackAndTrace/sponsored-transaction-service/Cargo.toml
- compliant-reward-distribution/indexer-and-server/Cargo.toml
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get toolchain
# Ensure rustfmt is installed and setup problem matcher
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_FMT }}
components: rustfmt
- name: Rustfmt Check
run: cargo fmt --manifest-path=${{ matrix.crates }} -- --check
lint_clippy:
name: Running clippy
needs: lint_fmt
# Don't run on draft pull requests
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
strategy:
matrix:
crates:
- gallery/verifier/Cargo.toml
- low-code-nft-marketplace/cis2-market/Cargo.toml
- sponsoredTransactions/backend/Cargo.toml
- sponsoredTransactionsAuction/backend/Cargo.toml
- trackAndTrace/smart-contract/Cargo.toml
- trackAndTrace/test-scripts/Cargo.toml
- trackAndTrace/indexer/Cargo.toml
- trackAndTrace/sponsored-transaction-service/Cargo.toml
- compliant-reward-distribution/indexer-and-server/Cargo.toml
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get toolchain
# Ensure rustfmt is installed and setup problem matcher
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy
- name: Run cargo clippy
run: cargo clippy --manifest-path=${{ matrix.crates }} --locked -- -D warnings
build:
name: Build Rust project
# Don't run on draft pull requests
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
strategy:
matrix:
crates:
- trackAndTrace/indexer/Cargo.toml
- trackAndTrace/sponsored-transaction-service/Cargo.toml
- trackAndTrace/test-scripts/Cargo.toml
- compliant-reward-distribution/indexer-and-server/Cargo.toml
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get toolchain
# Ensure rustfmt is installed and setup problem matcher
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Run cargo build
run: cargo build --manifest-path=${{ matrix.crates }} --locked
test:
name: Running cargo-concordium tests
# Don't run on draft pull requests
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
crates:
- low-code-nft-marketplace/cis2-market
- trackAndTrace/smart-contract
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.target }}
override: true
- name: Install Wasm target
run: rustup target install wasm32-unknown-unknown
- name: Download and install Cargo Concordium
run: |
CARGO_CCD=cargo-concordium_${{ env.CARGO_CONCORDIUM_VERSION }}
wget https://distribution.concordium.software/tools/linux/$CARGO_CCD
chmod +x $CARGO_CCD
sudo mv $CARGO_CCD /usr/bin/cargo-concordium
- name: Run cargo concordium test
run: cargo concordium test --out "${{ matrix.crates }}/concordium-out/module.wasm.v1" -- --manifest-path "${{ matrix.crates }}/Cargo.toml"