Skip to content

Commit 090f841

Browse files
committed
merge mainMerge branch 'main' into cargo-metadata
2 parents ec80a20 + 42f000b commit 090f841

File tree

134 files changed

+7660
-5398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+7660
-5398
lines changed

.cargo/config.toml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1-
[profile.debug]
2-
# rustc spends an inordinate amount of time on LLVM
3-
rustflags = ["-C", "no-prepopulate-passes"]
1+
[profile.dev]
2+
# recommendation coming from
3+
# https://doc.rust-lang.org/nightly/cargo/guide/build-performance.html#reduce-amount-of-generated-debug-information
4+
# for our normal dev work, line-tables are good enough to see line numbers in backtraces.
5+
debug = "line-tables-only"
6+
# mostly for mac os, splits debug info into separate files to speed up incremental builds
7+
# https://corrode.dev/blog/tips-for-faster-rust-compile-times/#macos-only-faster-incremental-debug-builds
8+
split-debuginfo = "unpacked"
9+
10+
[profile.dev.build-override]
11+
# optimize proc macros & build scripts, make them execute faster
12+
# https://corrode.dev/blog/tips-for-faster-rust-compile-times/#avoid-procedural-macro-crates
13+
opt-level = 3
14+
15+
[profile.dev.package."*"]
16+
# no debug information for dependencies
17+
debug = false
18+
19+
[profile.debugging]
20+
# big "debugging" profile, if you need to do real interactive debugging
21+
inherits = "dev"
22+
debug = true

.docker.env.sample

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# environment overrides for the app instances running inside docker compose
2+
DOCSRS_LOG=docs_rs=debug,rustwide=info
3+
DOCSRS_INCLUDE_DEFAULT_TARGETS=false
4+
DOCSRS_DOCKER_IMAGE=ghcr.io/rust-lang/crates-build-env/linux-micro
5+
# To build with a PR that hasn't landed in a rust dist toolchain yet,
6+
# you can set this to the git sha of a try build:
7+
# https://forge.rust-lang.org/infra/docs/rustc-ci.html#try-builds
8+
DOCSRS_TOOLCHAIN=nightly
9+
10+
# for the registry watcher, automatically queued reqbuidls.
11+
DOCSRS_MAX_QUEUED_REBUILDS: 10
12+

.dockerignore

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1+
/.docker.env
2+
/.env.*
3+
/.envrc
14
/.rustwide
25
/.rustwide-docker
6+
/Justfile
7+
/LICENSE
8+
/README.md
9+
/clippy.toml
10+
/docker-compose.yml
11+
/dockerfiles/
12+
/docs/
313
/ignored
4-
**/target
14+
/justfiles/
15+
/mcps
16+
/target/
17+
/triagebot.toml
18+
archive_cache

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ insert_final_newline = true
88
indent_style = space
99
indent_size = 4
1010

11+
[Justfile]
12+
indent_size = 2
13+
1114
[*.js]
1215
max_line_length = 100
16+

.env.sample

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
export DOCSRS_PREFIX=ignored/cratesfyi-prefix
2-
export DOCSRS_DATABASE_URL=postgresql://cratesfyi:password@localhost:15432
1+
# environment overrides for local development outside docker.
2+
DOCSRS_PREFIX=ignored/cratesfyi-prefix
3+
DOCSRS_DATABASE_URL=postgresql://cratesfyi:password@localhost:15432
34

45
# for local development with sqlx
5-
export DATABASE_URL=postgresql://cratesfyi:password@localhost:15432
6+
DATABASE_URL=postgresql://cratesfyi:password@localhost:15432
67

7-
export DOCSRS_LOG=docs_rs=debug,rustwide=info
8+
DOCSRS_LOG=docs_rs=debug,rustwide=info
9+
AWS_ACCESS_KEY_ID=cratesfyi
10+
AWS_SECRET_ACCESS_KEY=secret_key
11+
S3_ENDPOINT=http://localhost:9000
12+
DOCSRS_S3_STATIC_ROOT_PATH=http://localhost:9000/rust-docs-rs
13+
14+
15+
# build specific
16+
DOCSRS_INCLUDE_DEFAULT_TARGETS=false
17+
DOCSRS_DOCKER_IMAGE=ghcr.io/rust-lang/crates-build-env/linux-micro
18+
SENTRY_ENVIRONMENT=dev
819
# To build with a PR that hasn't landed in a rust dist toolchain yet,
920
# you can set this to the git sha of a try build:
1021
# https://forge.rust-lang.org/infra/docs/rustc-ci.html#try-builds
11-
export DOCSRS_TOOLCHAIN=nightly
12-
export AWS_ACCESS_KEY_ID=cratesfyi
13-
export AWS_SECRET_ACCESS_KEY=secret_key
14-
export S3_ENDPOINT=http://localhost:9000
15-
export DOCSRS_S3_STATIC_ROOT_PATH=http://localhost:9000/rust-docs-rs
16-
export DOCSRS_INCLUDE_DEFAULT_TARGETS=false
17-
export DOCSRS_DOCKER_IMAGE=ghcr.io/rust-lang/crates-build-env/linux-micro
18-
export SENTRY_ENVIRONMENT=dev
22+
DOCSRS_TOOLCHAIN=nightly
23+
24+
# NOTE: when running services in docker-compose, you can override the settings in
25+
# `.docker.env`, you'll fine an example in `.docker.env.sample`.

.git_hooks/pre-commit

Lines changed: 0 additions & 17 deletions
This file was deleted.

.git_hooks/pre-push

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/audit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
security_audit:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v5
22+
- uses: actions/checkout@v6
2323
- id: install
2424
run: |
2525
rustup override set stable

.github/workflows/ci.yml

Lines changed: 67 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -3,174 +3,129 @@ name: CI
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
pull_request:
88
schedule:
99
- cron: "0 0 * * *"
1010

1111
env:
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

2417
jobs:
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

Comments
 (0)