@@ -3,55 +3,186 @@ name: CI
3
3
on :
4
4
workflow_dispatch :
5
5
pull_request :
6
+ # paths: # Only run when changes are made to rust code or root Cargo
7
+ # - "crates/**"
8
+ # - "fuzz/**"
9
+ # - "xtask/**"
10
+ # - "Cargo.toml"
11
+ # - "Cargo.lock"
12
+ # - "rust-toolchain.toml"
13
+ # - "rustfmt.toml"
6
14
7
15
concurrency :
8
16
group : ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
9
17
cancel-in-progress : true
10
18
11
19
env :
12
20
RUSTFLAGS : --deny warnings
21
+ RUST_LOG : info
22
+ RUST_BACKTRACE : 1
23
+ RUSTUP_WINDOWS_PATH_ADD_BIN : 1
13
24
14
25
jobs :
15
- ci :
16
- name : CI
17
- timeout-minutes : 10
26
+ format :
27
+ name : Format
18
28
runs-on : ubuntu-latest
29
+ steps :
30
+ - name : Checkout PR branch
31
+ uses : actions/checkout@v4
32
+ - name : Free Disk Space
33
+ uses : ./.github/actions/free-disk-space
34
+ - name : Install toolchain
35
+ uses : moonrepo/setup-rust@v1
36
+ with :
37
+ components : rustfmt
38
+ bins : taplo-cli
39
+ cache-base : main
40
+ env :
41
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
42
+ - name : Run format
43
+ run : |
44
+ cargo fmt --all --check
45
+ taplo format --check
19
46
20
- services :
21
- postgres :
22
- image : postgres:latest
47
+ lint :
48
+ name : Lint
49
+ runs-on : ubuntu-latest
50
+ steps :
51
+ - name : Checkout PR Branch
52
+ uses : actions/checkout@v4
53
+ - name : Free Disk Space
54
+ uses : ./.github/actions/free-disk-space
55
+ - name : Install toolchain
56
+ uses : moonrepo/setup-rust@v1
57
+ with :
58
+ components : clippy
59
+ cache-base : main
23
60
env :
24
- POSTGRES_USER : postgres
25
- POSTGRES_PASSWORD : postgres
26
- POSTGRES_DB : postgres
27
- ports :
28
- - 5432:5432
61
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
62
+ - name : Run clippy
63
+ run : |
64
+ cargo lint
65
+ cargo run -p rules_check
29
66
30
- env :
31
- DATABASE_URL : postgresql://postgres:postgres@localhost:5432/postgres
67
+ check-dependencies :
68
+ name : Check Dependencies
69
+ runs-on : ubuntu-latest
70
+ steps :
71
+ - name : Checkout PR Branch
72
+ uses : actions/checkout@v4
73
+ - name : Free Disk Space
74
+ uses : ./.github/actions/free-disk-space
75
+ - name : Install toolchain
76
+ run : rustup toolchain install nightly
77
+ - name : Install udeps
78
+ run : cargo install cargo-udeps --locked
79
+ - name : Detect unused dependencies using udeps
80
+ run : cargo +nightly udeps --all-targets
32
81
82
+ test :
83
+ name : Test
84
+ runs-on : ${{ matrix.os }}
85
+ strategy :
86
+ matrix :
87
+ include :
88
+ - os : windows-latest
89
+ - os : ubuntu-latest
33
90
steps :
34
- - name : 🏗 Setup repository
35
- uses : actions/checkout@v3
91
+ - name : Checkout PR branch
92
+ uses : actions/checkout@v4
93
+ - name : Free Disk Space
94
+ uses : ./.github/actions/free-disk-space
95
+ - name : Install toolchain
96
+ uses : moonrepo/setup-rust@v1
36
97
with :
37
- submodules : true
98
+ cache-base : main
99
+ env :
100
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
101
+ - name : Run tests
102
+ run : cargo test --workspace
38
103
39
- - name : 🏗 Setup monorepo
40
- uses : ./.github/actions/setup-monorepo
104
+ codegen :
105
+ name : Codegen
106
+ runs-on : ubuntu-latest
107
+ steps :
108
+ - name : Checkout PR branch
109
+ uses : actions/checkout@v4
110
+ - name : Free Disk Space
111
+ uses : ./.github/actions/free-disk-space
112
+ - name : Install toolchain
113
+ uses : moonrepo/setup-rust@v1
41
114
with :
42
- github-token : ${{ secrets.GITHUB_TOKEN }}
43
-
44
- - name : Run test migrations
45
- run : psql -f test-db/seed.sql postgresql://postgres:postgres@localhost:5432/postgres
46
-
47
- - name : 📦 Build
48
- id : build
49
- run : RUSTFLAGS="-A dead_code" cargo build
50
-
51
- - name : ⚡️ Check
52
- id : check
53
- run : RUSTFLAGS="-A dead_code" cargo check
115
+ cache-base : main
116
+ env :
117
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
118
+ - name : Run the analyser codegen
119
+ run : cargo codegen analyser
120
+ - name : Run the configuration codegen
121
+ run : cargo codegen-configuration
122
+ - name : Check for git diff
123
+ run : |
124
+ if [[ `git status --porcelain` ]]; then
125
+ git status
126
+ git diff
127
+ exit 1
128
+ fi
54
129
55
- - name : 🦺 Test
56
- id : test
57
- run : RUSTFLAGS="-A dead_code" cargo test
130
+ # ci:
131
+ # name: CI
132
+ # timeout-minutes: 10
133
+ # runs-on: ubuntu-latest
134
+ #
135
+ # services:
136
+ # postgres:
137
+ # image: postgres:latest
138
+ # env:
139
+ # POSTGRES_USER: postgres
140
+ # POSTGRES_PASSWORD: postgres
141
+ # POSTGRES_DB: postgres
142
+ # ports:
143
+ # - 5432:5432
144
+ #
145
+ # env:
146
+ # DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
147
+ #
148
+ # steps:
149
+ # - name: 🏗 Setup repository
150
+ # uses: actions/checkout@v4
151
+ # with:
152
+ # submodules: true
153
+ #
154
+ # - name: Free Disk Space
155
+ # uses: ./.github/actions/free-disk-space
156
+ #
157
+ # - name: Install toolchain
158
+ # uses: moonrepo/setup-rust@e013866c4215f77c925f42f60257dec7dd18836e # v1.2.1
159
+ # with:
160
+ # components: rustfmt
161
+ # bins: taplo-cli
162
+ # cache-base: main
163
+ # env:
164
+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165
+ # - name: Run format
166
+ # run: |
167
+ # cargo fmt --all --check
168
+ # taplo format --check
169
+ #
170
+ # - name: 🏗 Setup monorepo
171
+ # uses: ./.github/actions/setup-monorepo
172
+ # with:
173
+ # github-token: ${{ secrets.GITHUB_TOKEN }}
174
+ #
175
+ # - name: Run test migrations
176
+ # run: psql -f test-db/seed.sql postgresql://postgres:postgres@localhost:5432/postgres
177
+ #
178
+ # - name: 📦 Build
179
+ # id: build
180
+ # run: RUSTFLAGS="-A dead_code" cargo build
181
+ #
182
+ # - name: ⚡️ Check
183
+ # id: check
184
+ # run: RUSTFLAGS="-A dead_code" cargo check
185
+ #
186
+ # - name: 🦺 Test
187
+ # id: test
188
+ # run: RUSTFLAGS="-A dead_code" cargo test
0 commit comments