Stop using a diesel_cli docker image, use cargo-binstall in woodpecker.

- The diesel_cli image is 500MB, and rebuilt daily. Much easier to use
  binstall to install it.
This commit is contained in:
Dessalines 2024-05-16 10:36:23 -04:00
parent 93c9a5f2b1
commit 42e2dfea4b

View File

@ -79,9 +79,11 @@ steps:
cargo_machete: cargo_machete:
image: rustlang/rust:nightly image: rustlang/rust:nightly
commands: commands:
# Install cargo binstall
- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz - wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
- tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz - tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
- cp cargo-binstall /usr/local/cargo/bin - cp cargo-binstall /usr/local/cargo/bin
# Install cargo-machete
- cargo binstall -y cargo-machete - cargo binstall -y cargo-machete
- cargo machete - cargo machete
when: when:
@ -133,11 +135,17 @@ steps:
when: *slow_check_paths when: *slow_check_paths
check_diesel_schema: check_diesel_schema:
image: willsquire/diesel-cli image: *rust_image
environment: environment:
CARGO_HOME: .cargo_home CARGO_HOME: .cargo_home
DATABASE_URL: postgres://lemmy:password@database:5432/lemmy DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
commands: commands:
# Install cargo binstall
- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
- tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
- cp cargo-binstall /usr/local/cargo/bin
# Install diesel_cli
- cargo binstall -y diesel_cli --no-default-features --features postgres
- diesel migration run - diesel migration run
- diesel print-schema --config-file=diesel.toml > tmp.schema - diesel print-schema --config-file=diesel.toml > tmp.schema
- diff tmp.schema crates/db_schema/src/schema.rs - diff tmp.schema crates/db_schema/src/schema.rs
@ -197,7 +205,12 @@ steps:
PGHOST: database PGHOST: database
PGDATABASE: lemmy PGDATABASE: lemmy
commands: commands:
- cargo install diesel_cli # Install cargo binstall
- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
- tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
- cp cargo-binstall /usr/local/cargo/bin
# Install diesel_cli
- cargo binstall -y diesel_cli --no-default-features --features postgres
- export PATH="$CARGO_HOME/bin:$PATH" - export PATH="$CARGO_HOME/bin:$PATH"
# Run all migrations # Run all migrations
- diesel migration run - diesel migration run
@ -276,7 +289,12 @@ steps:
publish_to_crates_io: publish_to_crates_io:
image: *rust_image image: *rust_image
commands: commands:
- cargo install cargo-workspaces # Install cargo binstall
- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
- tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
- cp cargo-binstall /usr/local/cargo/bin
# Install cargo-workspaces
- cargo binstall -y cargo-workspaces
- cp -r migrations crates/db_schema/ - cp -r migrations crates/db_schema/
- cargo workspaces publish --token "$CARGO_API_TOKEN" --from-git --allow-dirty --no-verify --allow-branch "${CI_COMMIT_TAG}" --yes custom "${CI_COMMIT_TAG}" - cargo workspaces publish --token "$CARGO_API_TOKEN" --from-git --allow-dirty --no-verify --allow-branch "${CI_COMMIT_TAG}" --yes custom "${CI_COMMIT_TAG}"
secrets: [cargo_api_token] secrets: [cargo_api_token]