mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-14 00:14:03 +00:00
Stop using a diesel_cli docker image, use cargo-install in woodpecker. (#4723)
* 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. * Trying out a multiline var. * Try sequence merges 1 * Try removing features. * Try path fix. * Abstracting diesel cli install. * Try installing mysql and postgres. * Try installing mysql and postgres 2. * Try installing mysql and postgres 3. * Try installing mysql and postgres 4. * Try installing mysql and postgres 5. * Try installing mysql and postgres 6. * Try installing mysql and postgres 7. * Try installing mysql and postgres 8. * Try installing mysql and postgres 9. * Try installing mysql and postgres 10. * Try installing mysql and postgres 11. * Try installing mysql and postgres 12. * Try installing mysql and postgres 13. * Add logging line. * Add logging line 2. * Add logging line 3. * Add logging line 4. * Removing binstall. * Extract taplo into its own image, ignore binstall. * Use a smaller taplo. * taplo is the same image.
This commit is contained in:
parent
93c9a5f2b1
commit
1a4aa3eaba
1 changed files with 22 additions and 18 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
- &rust_image "rust:1.77"
|
- &rust_image "rust:1.77"
|
||||||
|
- &rust_nightly_image "rustlang/rust:nightly"
|
||||||
- &install_pnpm "corepack enable pnpm"
|
- &install_pnpm "corepack enable pnpm"
|
||||||
- &slow_check_paths
|
- &slow_check_paths
|
||||||
- event: pull_request
|
- event: pull_request
|
||||||
|
@ -24,15 +25,17 @@ variables:
|
||||||
"diesel.toml",
|
"diesel.toml",
|
||||||
".gitmodules",
|
".gitmodules",
|
||||||
]
|
]
|
||||||
|
- install_binstall: &install_binstall
|
||||||
# Broken for cron jobs currently, see
|
- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
|
||||||
# https://github.com/woodpecker-ci/woodpecker/issues/1716
|
- tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
|
||||||
# clone:
|
- cp cargo-binstall /usr/local/cargo/bin
|
||||||
# git:
|
- install_diesel_cli: &install_diesel_cli
|
||||||
# image: woodpeckerci/plugin-git
|
- apt update && apt install -y lsb-release build-essential
|
||||||
# settings:
|
- sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||||
# recursive: true
|
- wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
||||||
# submodule_update_remote: true
|
- apt update && apt install -y postgresql-client-16
|
||||||
|
- cargo install diesel_cli --no-default-features --features postgres
|
||||||
|
- export PATH="$CARGO_HOME/bin:$PATH"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
prepare_repo:
|
prepare_repo:
|
||||||
|
@ -66,7 +69,7 @@ steps:
|
||||||
- event: pull_request
|
- event: pull_request
|
||||||
|
|
||||||
cargo_fmt:
|
cargo_fmt:
|
||||||
image: rustlang/rust:nightly
|
image: *rust_nightly_image
|
||||||
environment:
|
environment:
|
||||||
# store cargo data in repo folder so that it gets cached between steps
|
# store cargo data in repo folder so that it gets cached between steps
|
||||||
CARGO_HOME: .cargo_home
|
CARGO_HOME: .cargo_home
|
||||||
|
@ -77,11 +80,9 @@ steps:
|
||||||
- event: pull_request
|
- event: pull_request
|
||||||
|
|
||||||
cargo_machete:
|
cargo_machete:
|
||||||
image: rustlang/rust:nightly
|
image: *rust_nightly_image
|
||||||
commands:
|
commands:
|
||||||
- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
|
- <<: *install_binstall
|
||||||
- tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
|
|
||||||
- cp cargo-binstall /usr/local/cargo/bin
|
|
||||||
- cargo binstall -y cargo-machete
|
- cargo binstall -y cargo-machete
|
||||||
- cargo machete
|
- cargo machete
|
||||||
when:
|
when:
|
||||||
|
@ -133,11 +134,12 @@ 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_diesel_cli
|
||||||
- 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,8 +199,8 @@ steps:
|
||||||
PGHOST: database
|
PGHOST: database
|
||||||
PGDATABASE: lemmy
|
PGDATABASE: lemmy
|
||||||
commands:
|
commands:
|
||||||
- cargo install diesel_cli
|
# Install diesel_cli
|
||||||
- export PATH="$CARGO_HOME/bin:$PATH"
|
- <<: *install_diesel_cli
|
||||||
# Run all migrations
|
# Run all migrations
|
||||||
- diesel migration run
|
- diesel migration run
|
||||||
# Dump schema to before.sqldump (PostgreSQL apt repo is used to prevent pg_dump version mismatch error)
|
# Dump schema to before.sqldump (PostgreSQL apt repo is used to prevent pg_dump version mismatch error)
|
||||||
|
@ -276,7 +278,9 @@ steps:
|
||||||
publish_to_crates_io:
|
publish_to_crates_io:
|
||||||
image: *rust_image
|
image: *rust_image
|
||||||
commands:
|
commands:
|
||||||
- cargo install cargo-workspaces
|
- <<: *install_binstall
|
||||||
|
# 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]
|
||||||
|
|
Loading…
Reference in a new issue