forked from rust-lang/crates.io
-
Notifications
You must be signed in to change notification settings - Fork 1
198 lines (156 loc) · 5.03 KB
/
ci.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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: CI
on:
push:
branches:
- main
- master
pull_request:
concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# renovate: datasource=crate depName=cargo-deny versioning=semver
CARGO_DENY_VERSION: 0.14.0
# renovate: datasource=crate depName=diesel_cli versioning=semver
DIESEL_CLI_VERSION: 2.1.0
# renovate: datasource=npm depName=pnpm
PNPM_VERSION: 8.6.10
jobs:
changed-files:
name: Changed Files
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- uses: tj-actions/[email protected]
id: changed-files-non-js
with:
files_ignore: |
app/**
mirage/**
public/**
tests/**
.eslintrc
.template-lintrc.js
ember-cli-build.js
package.json
pnpm-lock.yaml
testem.js
- uses: tj-actions/[email protected]
id: changed-files-non-rust
with:
files_ignore: |
crates_io_*/**
migrations/**
src/**
build.rs
Cargo.lock
Cargo.toml
rust-toolchain.toml
- uses: tj-actions/[email protected]
id: changed-files-rust-lockfile
with:
files: Cargo.lock
outputs:
non-js: ${{ steps.changed-files-non-js.outputs.any_modified }}
non-rust: ${{ steps.changed-files-non-rust.outputs.any_modified }}
rust-lockfile: ${{ steps.changed-files-rust-lockfile.outputs.any_modified }}
backend-lint:
name: Backend / Lint
runs-on: ubuntu-22.04
needs: changed-files
if: needs.changed-files.outputs.non-js == 'true'
env:
RUSTFLAGS: "-D warnings"
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/[email protected]
- run: rustup component add rustfmt
- run: rustup component add clippy
- uses: Swatinem/[email protected]
- run: cargo fmt --check --all
- run: cargo clippy --all-targets --all-features --workspace
- run: cargo doc --no-deps --document-private-items
backend-cargo-deny:
name: Backend / cargo-deny
runs-on: ubuntu-22.04
needs: changed-files
if: github.event_name != 'pull_request' || needs.changed-files.outputs.rust-lockfile == 'true'
steps:
- uses: actions/[email protected]
- uses: Swatinem/[email protected]
- run: cargo install cargo-deny --vers ${{ env.CARGO_DENY_VERSION }}
- run: cargo deny check
backend-test:
name: Backend / Test
runs-on: ubuntu-22.04
needs: changed-files
if: needs.changed-files.outputs.non-js == 'true'
env:
RUST_BACKTRACE: 1
DATABASE_URL: postgres://postgres:postgres@localhost/cargo_registry_test
TEST_DATABASE_URL: postgres://postgres:postgres@localhost/cargo_registry_test
RUSTFLAGS: "-D warnings"
MALLOC_CONF: "background_thread:true,abort_conf:true,abort:true,junk:true"
services:
postgres:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/[email protected]
- uses: Swatinem/[email protected]
- run: cargo install diesel_cli --vers ${{ env.DIESEL_CLI_VERSION }} --no-default-features --features postgres --debug
- run: diesel database setup --locked-schema
- run: cargo test --workspace
frontend-lint:
name: Frontend / Lint
runs-on: ubuntu-22.04
needs: changed-files
if: needs.changed-files.outputs.non-rust == 'true'
steps:
- uses: actions/[email protected]
- uses: pnpm/[email protected]
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/[email protected]
with:
cache: pnpm
node-version-file: package.json
- run: pnpm install
- run: pnpm lint:hbs
- run: pnpm lint:js
- run: pnpm lint:deps
frontend-test:
name: Frontend / Test
runs-on: ubuntu-22.04
needs: changed-files
if: needs.changed-files.outputs.non-rust == 'true'
env:
JOBS: 1 # See https://git.io/vdao3 for details.
# Percy secrets are included here to enable Percy's GitHub integration
# on community-submitted PRs
PERCY_TOKEN: 0d8707a02b19aebbec79bb0bf302b8d2fa95edb33169cfe41b084289596670b1
PERCY_PROJECT: crates-io/crates.io
steps:
- uses: actions/[email protected]
- uses: pnpm/[email protected]
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/[email protected]
with:
cache: pnpm
node-version-file: package.json
- run: pnpm install
- if: github.repository == 'rust-lang/crates.io'
run: pnpm percy exec -- pnpm test-coverage
- if: github.repository != 'rust-lang/crates.io'
run: pnpm test-coverage