@@ -3,174 +3,129 @@ name: CI
33on :
44 push :
55 branches :
6- - master
6+ - main
77 pull_request :
88 schedule :
99 - cron : " 0 0 * * *"
1010
1111env :
12- RUST_BACKTRACE : 1
1312 RUST_CACHE_KEY : rust-cache-20241114
14- DOCSRS_PREFIX : ignored/cratesfyi-prefix
15- DOCSRS_DATABASE_URL : postgresql://cratesfyi:password@localhost:15432
16- DOCSRS_LOG : docs_rs=debug,rustwide=info
17- AWS_ACCESS_KEY_ID : cratesfyi
18- AWS_SECRET_ACCESS_KEY : secret_key
19- S3_ENDPOINT : http://localhost:9000
20- DOCSRS_INCLUDE_DEFAULT_TARGETS : false
21- DOCSRS_DOCKER_IMAGE : ghcr.io/rust-lang/crates-build-env/linux-micro
22- SENTRY_ENVIRONMENT : dev
13+ # disable incremental builds in CI, it's not needed
14+ CARGO_INCREMENTAL : 0
15+
2316
2417jobs :
2518 sqlx :
2619 runs-on : ubuntu-latest
2720 steps :
28- - uses : actions/checkout@v5
21+ - uses : actions/checkout@v6
2922
30- # We check that all github actions workflows have valid syntax
31- - name : Validate YAML file
32- uses : raven-actions/actionlint@v2
23+ - uses : taiki-e/install-action@v2
3324 with :
34- files : .github/workflow/*
35- flags : " -ignore SC2086" # ignore some shellcheck errors
36-
37- - name : install `just`
38- run : sudo snap install --edge --classic just
25+ tool : just,sqlx-cli
3926
4027 - name : restore build & cargo cache
4128 uses : Swatinem/rust-cache@v2
4229 with :
4330 prefix-key : ${{ env.RUST_CACHE_KEY }}
4431
45- - name : Launch postgres
46- run : |
47- cp .env.sample .env
48- mkdir -p ${DOCSRS_PREFIX}/public-html
49- docker compose up -d db
50- # Give the database enough time to start up
51- sleep 5
52- # Make sure the database is actually working
53- psql "${DOCSRS_DATABASE_URL}"
54-
55- - name : install SQLX CLI
56- run : cargo install sqlx-cli --no-default-features --features postgres
57-
58- - name : run database migrations
59- run : cargo sqlx migrate run --database-url $DOCSRS_DATABASE_URL
32+ - name : Set up Docker Buildx
33+ uses : docker/setup-buildx-action@v3
6034
61- - name : run sqlx prepare --check
62- run : just sqlx-prepare
63-
64- - name : test reverse migrations
35+ - name : run sqlx migration up & down
6536 run : |
66- # --target 0 means "revert everything"
67- cargo sqlx migrate revert \
68- --database-url $DOCSRS_DATABASE_URL \
69- --target-version 0
37+ just sqlx-migrate-run \
38+ sqlx-check \
39+ sqlx-migrate-revert
7040
71- - name : Clean up the database
72- run : docker compose down --volumes
41+ - name : shut down test environment
42+ if : ${{ always() }}
43+ run : just compose-down-and-wipe
7344
7445 test :
75- env :
76- SQLX_OFFLINE : 1
7746 runs-on : ubuntu-latest
7847 steps :
79- - uses : actions/checkout@v5
48+ - uses : actions/checkout@v6
49+
50+ - uses : taiki-e/install-action@v2
51+ with :
52+ tool : just
8053
8154 - name : restore build & cargo cache
8255 uses : Swatinem/rust-cache@v2
8356 with :
8457 prefix-key : ${{ env.RUST_CACHE_KEY }}
8558
86- - name : Build
87- run : cargo build --workspace --locked
59+ - name : Set up Docker Buildx
60+ uses : docker/setup-buildx-action@v3
8861
89- - name : Launch postgres and min.io
90- run : |
91- cp .env.sample .env
92- mkdir -p ${DOCSRS_PREFIX}/public-html
93- docker compose up -d db s3
94- # Give the database enough time to start up
95- sleep 5
96- # Make sure the database is actually working
97- psql "${DOCSRS_DATABASE_URL}"
98-
99- - name : run workspace tests
100- run : |
101- cargo test --workspace --locked --no-fail-fast
102-
103- - name : run slow tests
104- env :
105- DOCSRS_INCLUDE_DEFAULT_TARGETS : true
106- run : |
107- cargo test --locked -- --ignored --test-threads=1
62+ - name : run tests
63+ run : just run-tests run-builder-tests
10864
109- - name : Clean up the database
110- run : docker compose down --volumes
65+ - name : shut down test environment
66+ if : ${{ always() }}
67+ run : just compose-down-and-wipe
11168
11269 GUI_test :
11370 runs-on : ubuntu-latest
11471 steps :
115- - uses : actions/checkout@v5
72+ - uses : actions/checkout@v6
11673
117- - name : restore build & cargo cache
118- uses : Swatinem/rust-cache@v2
119- with :
120- prefix-key : ${{ env.RUST_CACHE_KEY }}
74+ - name : Set up Docker Buildx
75+ uses : docker/setup-buildx-action@v3
12176
122- - name : Launch postgres and min.io
123- run : |
124- cp .env.sample .env
125- mkdir -p ${DOCSRS_PREFIX}/public-html
126- docker compose up -d db s3
127- # Give the database enough time to start up
128- sleep 5
129- # Make sure the database is actually working
130- psql "${DOCSRS_DATABASE_URL}"
77+ - uses : taiki-e/install-action@v2
78+ with :
79+ tool : just
13180
13281 - name : Run GUI tests
133- run : ./dockerfiles/run-gui-tests.sh
134-
135- - name : Clean up the database
136- run : docker compose down --volumes
137-
138- fmt :
139- name : Rustfmt
140- runs-on : ubuntu-latest
141-
142- steps :
143- - uses : actions/checkout@v5
144- - name : update rust toolchain
145- run : rustup component add rustfmt
82+ run : just run-gui-tests
14683
147- - run : cargo fmt -- --check
84+ - name : shut down test environment
85+ if : ${{ always() }}
86+ run : just compose-down-and-wipe
14887
149- clippy :
150- name : Clippy
88+ lint-rs :
89+ name : rust linters
15190 runs-on : ubuntu-latest
15291
15392 steps :
154- - uses : actions/checkout@v5
93+ - uses : actions/checkout@v6
15594
156- - name : update rust toolchain
157- run : rustup component add clippy
158-
159- - name : install `just`
160- run : sudo snap install --edge --classic just
95+ - uses : taiki-e/install-action@v2
96+ with :
97+ tool : just,fd-find,cargo-machete
16198
16299 - name : restore build & cargo cache
163100 uses : Swatinem/rust-cache@v2
164101 with :
165102 prefix-key : ${{ env.RUST_CACHE_KEY }}
166103
167- - run : just lint
104+ - run : just lint lint-dependencies
168105
169- eslint :
106+ lint-js :
107+ name : js linters
170108 runs-on : ubuntu-latest
171109 steps :
172- - uses : actions/checkout@v5
110+ - uses : actions/checkout@v6
111+
173112 - uses : denoland/setup-deno@v2
174- - name : install `just`
175- run : sudo snap install --edge --classic just
113+
114+ - uses : taiki-e/install-action@v2
115+ with :
116+ tool : just
117+
176118 - run : just lint-js
119+
120+ lint-actions :
121+ name : gh actions linters
122+ runs-on : ubuntu-latest
123+ steps :
124+ - uses : actions/checkout@v6
125+
126+ # We check that all github actions workflows have valid syntax
127+ - name : Validate YAML file
128+ uses : raven-actions/actionlint@v2
129+ with :
130+ files : .github/workflow/*
131+ flags : " -ignore SC2086" # ignore some shellcheck errors
0 commit comments