Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using a diesel_cli docker image, use cargo-install in woodpecker. #4723

Merged
merged 27 commits into from
May 16, 2024
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
42e2dfe
Stop using a diesel_cli docker image, use cargo-binstall in woodpecker.
dessalines May 16, 2024
8f34d97
Trying out a multiline var.
dessalines May 16, 2024
7cb5289
Try sequence merges 1
dessalines May 16, 2024
0549103
Try removing features.
dessalines May 16, 2024
02036cf
Try path fix.
dessalines May 16, 2024
5cf116b
Abstracting diesel cli install.
dessalines May 16, 2024
e75d502
Try installing mysql and postgres.
dessalines May 16, 2024
2c834be
Try installing mysql and postgres 2.
dessalines May 16, 2024
b556975
Try installing mysql and postgres 3.
dessalines May 16, 2024
0c9124e
Try installing mysql and postgres 4.
dessalines May 16, 2024
1a913e1
Try installing mysql and postgres 5.
dessalines May 16, 2024
7f73815
Try installing mysql and postgres 6.
dessalines May 16, 2024
7b9db79
Try installing mysql and postgres 7.
dessalines May 16, 2024
6f75705
Try installing mysql and postgres 8.
dessalines May 16, 2024
eabc846
Try installing mysql and postgres 9.
dessalines May 16, 2024
136f0f3
Try installing mysql and postgres 10.
dessalines May 16, 2024
b05a53e
Try installing mysql and postgres 11.
dessalines May 16, 2024
bc227d1
Try installing mysql and postgres 12.
dessalines May 16, 2024
ca65ddc
Try installing mysql and postgres 13.
dessalines May 16, 2024
f60c2df
Add logging line.
dessalines May 16, 2024
332c7ef
Add logging line 2.
dessalines May 16, 2024
3340ab3
Add logging line 3.
dessalines May 16, 2024
6aafc20
Add logging line 4.
dessalines May 16, 2024
5dad74b
Removing binstall.
dessalines May 16, 2024
ae8c062
Extract taplo into its own image, ignore binstall.
dessalines May 16, 2024
4b8118d
Use a smaller taplo.
dessalines May 16, 2024
16a0f39
taplo is the same image.
dessalines May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions .woodpecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

variables:
- &rust_image "rust:1.77"
- &rust_nightly_image "rustlang/rust:nightly"
- &install_pnpm "corepack enable pnpm"
- &slow_check_paths
- event: pull_request
Expand All @@ -24,15 +25,17 @@ variables:
"diesel.toml",
".gitmodules",
]

# Broken for cron jobs currently, see
# https://github.com/woodpecker-ci/woodpecker/issues/1716
# clone:
# git:
# image: woodpeckerci/plugin-git
# settings:
# recursive: true
# submodule_update_remote: true
- install_binstall: &install_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: &install_diesel_cli
- apt update && apt install -y lsb-release build-essential
- sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
- wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
- apt update && apt install -y postgresql-client-16
- cargo install diesel_cli --no-default-features --features postgres
- export PATH="$CARGO_HOME/bin:$PATH"

steps:
prepare_repo:
Expand Down Expand Up @@ -66,7 +69,7 @@ steps:
- event: pull_request

cargo_fmt:
image: rustlang/rust:nightly
image: *rust_nightly_image
environment:
# store cargo data in repo folder so that it gets cached between steps
CARGO_HOME: .cargo_home
Expand All @@ -77,11 +80,9 @@ steps:
- event: pull_request

cargo_machete:
image: rustlang/rust:nightly
image: *rust_nightly_image
commands:
- 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_binstall
- cargo binstall -y cargo-machete
- cargo machete
when:
Expand Down Expand Up @@ -133,11 +134,12 @@ steps:
when: *slow_check_paths

check_diesel_schema:
image: willsquire/diesel-cli
image: *rust_image
environment:
CARGO_HOME: .cargo_home
DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
commands:
- <<: *install_diesel_cli
- diesel migration run
- diesel print-schema --config-file=diesel.toml > tmp.schema
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After #4673 is finished, this will be the only place where diesel cli is needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

- diff tmp.schema crates/db_schema/src/schema.rs
Expand Down Expand Up @@ -197,8 +199,8 @@ steps:
PGHOST: database
PGDATABASE: lemmy
commands:
- cargo install diesel_cli
- export PATH="$CARGO_HOME/bin:$PATH"
# Install diesel_cli
- <<: *install_diesel_cli
# Run all migrations
- diesel migration run
# Dump schema to before.sqldump (PostgreSQL apt repo is used to prevent pg_dump version mismatch error)
Expand Down Expand Up @@ -276,7 +278,9 @@ steps:
publish_to_crates_io:
image: *rust_image
commands:
- cargo install cargo-workspaces
- <<: *install_binstall
# Install cargo-workspaces
- cargo binstall -y cargo-workspaces
- 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}"
secrets: [cargo_api_token]
Expand Down