-
Notifications
You must be signed in to change notification settings - Fork 32
128 lines (121 loc) · 3.76 KB
/
ci-rust.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: CI
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
types: [ opened, reopened, synchronize ]
paths:
- ".github/workflows/ci-rust.yaml"
- "Cargo.*"
- "crates/**"
- "extra/**"
- "modules/meteroid/**"
- "modules/metering/**"
- "modules/adapters/**"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
naming:
permissions:
pull-requests: read
name: Validate PR title
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
check:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake clang unzip libsasl2-dev
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.8/protoc-21.8-linux-x86_64.zip
unzip protoc*.zip
sudo mv bin/protoc /usr/local/bin
sudo mv include/google /usr/local/include
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.6
- name: Install nextest
uses: taiki-e/cache-cargo-install-action@v2
with:
tool: cargo-nextest
- name: Test
run: cargo nextest run
- name: Compile
run: cargo check
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake clang unzip libsasl2-dev
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.8/protoc-21.8-linux-x86_64.zip
unzip protoc*.zip
sudo mv bin/protoc /usr/local/bin
sudo mv include/google /usr/local/include
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.6
- name: Linting
run: cargo clippy -- -D warnings
openapi:
name: Open API
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake clang unzip libsasl2-dev
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.8/protoc-21.8-linux-x86_64.zip
unzip protoc*.zip
sudo mv bin/protoc /usr/local/bin
sudo mv include/google /usr/local/include
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.6
- name: Validate OpenAPI
run: |
cargo run -p meteroid --bin openapi-generate
if [[ -n "$(git status --porcelain spec/api/v1/openapi.json)" ]]; then
echo "openapi.json is not up to date. Please run `cargo run -p meteroid --bin openapi-generate` and commit changes."
exit 1
fi