From 42e2dfea4bfd2bb6d4b6e392134d4a3a308b649a Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 10:36:23 -0400 Subject: [PATCH 01/27] 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. --- .woodpecker.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 65dc8a8a67..6fcc585820 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -79,9 +79,11 @@ steps: cargo_machete: image: rustlang/rust:nightly 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 cargo-machete - cargo binstall -y cargo-machete - cargo machete when: @@ -133,11 +135,17 @@ 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 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 print-schema --config-file=diesel.toml > tmp.schema - diff tmp.schema crates/db_schema/src/schema.rs @@ -197,7 +205,12 @@ steps: PGHOST: database PGDATABASE: lemmy 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" # Run all migrations - diesel migration run @@ -276,7 +289,12 @@ steps: publish_to_crates_io: image: *rust_image 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/ - 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] From 8f34d977b3f092a296213619a7b1aed1e3d84dc3 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 10:50:47 -0400 Subject: [PATCH 02/27] Trying out a multiline var. --- .woodpecker.yml | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 6fcc585820..4441097a46 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -24,6 +24,10 @@ variables: "diesel.toml", ".gitmodules", ] + - &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 # Broken for cron jobs currently, see # https://github.com/woodpecker-ci/woodpecker/issues/1716 @@ -79,11 +83,7 @@ steps: cargo_machete: image: rustlang/rust:nightly 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 cargo-machete + - *install_binstall - cargo binstall -y cargo-machete - cargo machete when: @@ -140,12 +140,9 @@ steps: CARGO_HOME: .cargo_home DATABASE_URL: postgres://lemmy:password@database:5432/lemmy 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_binstall # Install diesel_cli - - cargo binstall -y diesel_cli --no-default-features --features postgres + - cargo binstall -y diesel_cli -- --no-default-features --features postgres - diesel migration run - diesel print-schema --config-file=diesel.toml > tmp.schema - diff tmp.schema crates/db_schema/src/schema.rs @@ -205,12 +202,9 @@ steps: PGHOST: database PGDATABASE: lemmy 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_binstall # Install diesel_cli - - cargo binstall -y diesel_cli --no-default-features --features postgres + - cargo binstall -y diesel_cli -- --no-default-features --features postgres - export PATH="$CARGO_HOME/bin:$PATH" # Run all migrations - diesel migration run @@ -289,10 +283,7 @@ steps: publish_to_crates_io: image: *rust_image 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_binstall # Install cargo-workspaces - cargo binstall -y cargo-workspaces - cp -r migrations crates/db_schema/ From 7cb5289064d662a234ddd8ae2cc642da96b405be Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 11:10:13 -0400 Subject: [PATCH 03/27] Try sequence merges 1 --- .woodpecker.yml | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 4441097a46..71a83c9398 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -24,10 +24,10 @@ variables: "diesel.toml", ".gitmodules", ] - - &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_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 # Broken for cron jobs currently, see # https://github.com/woodpecker-ci/woodpecker/issues/1716 @@ -48,6 +48,20 @@ steps: when: - event: [pull_request, tag] + check_diesel_schema: + image: *rust_image + environment: + CARGO_HOME: .cargo_home + DATABASE_URL: postgres://lemmy:password@database:5432/lemmy + commands: + - <<: *install_binstall + # Install diesel_cli + - cargo binstall -y diesel_cli -- --no-default-features --features postgres + - diesel migration run + - diesel print-schema --config-file=diesel.toml > tmp.schema + - diff tmp.schema crates/db_schema/src/schema.rs + when: *slow_check_paths + prettier_check: image: tmknom/prettier:3.0.0 commands: @@ -83,7 +97,7 @@ steps: cargo_machete: image: rustlang/rust:nightly commands: - - *install_binstall + - <<: *install_binstall - cargo binstall -y cargo-machete - cargo machete when: @@ -134,20 +148,6 @@ steps: - diff config/defaults.hjson config/defaults_current.hjson when: *slow_check_paths - check_diesel_schema: - image: *rust_image - environment: - CARGO_HOME: .cargo_home - DATABASE_URL: postgres://lemmy:password@database:5432/lemmy - commands: - - *install_binstall - # Install diesel_cli - - cargo binstall -y diesel_cli -- --no-default-features --features postgres - - diesel migration run - - diesel print-schema --config-file=diesel.toml > tmp.schema - - diff tmp.schema crates/db_schema/src/schema.rs - when: *slow_check_paths - check_db_perf_tool: image: *rust_image environment: @@ -202,7 +202,7 @@ steps: PGHOST: database PGDATABASE: lemmy commands: - - *install_binstall + - <<: *install_binstall # Install diesel_cli - cargo binstall -y diesel_cli -- --no-default-features --features postgres - export PATH="$CARGO_HOME/bin:$PATH" @@ -283,7 +283,7 @@ steps: publish_to_crates_io: image: *rust_image commands: - - *install_binstall + - <<: *install_binstall # Install cargo-workspaces - cargo binstall -y cargo-workspaces - cp -r migrations crates/db_schema/ From 054910305fc79b6c3e1e89f6883b189121a43acb Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 11:11:56 -0400 Subject: [PATCH 04/27] Try removing features. --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 71a83c9398..9a13826bd5 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -56,7 +56,7 @@ steps: commands: - <<: *install_binstall # Install diesel_cli - - cargo binstall -y diesel_cli -- --no-default-features --features postgres + - cargo binstall -y diesel_cli - diesel migration run - diesel print-schema --config-file=diesel.toml > tmp.schema - diff tmp.schema crates/db_schema/src/schema.rs From 02036cf1a4a756d6800115ad3bd0286ce1cb3ced Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 11:13:44 -0400 Subject: [PATCH 05/27] Try path fix. --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 9a13826bd5..38900e6232 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -28,6 +28,7 @@ variables: - 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 + - export PATH="$CARGO_HOME/bin:$PATH" # Broken for cron jobs currently, see # https://github.com/woodpecker-ci/woodpecker/issues/1716 @@ -205,7 +206,6 @@ steps: - <<: *install_binstall # Install diesel_cli - cargo binstall -y diesel_cli -- --no-default-features --features postgres - - export PATH="$CARGO_HOME/bin:$PATH" # Run all migrations - diesel migration run # Dump schema to before.sqldump (PostgreSQL apt repo is used to prevent pg_dump version mismatch error) From 5cf116bf4594628e0c4158d7d96039b273f2a59f Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 11:17:47 -0400 Subject: [PATCH 06/27] Abstracting diesel cli install. --- .woodpecker.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 38900e6232..5c1670b4eb 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -28,17 +28,10 @@ variables: - 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 + - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" -# 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 - steps: prepare_repo: image: alpine:3 @@ -56,8 +49,7 @@ steps: DATABASE_URL: postgres://lemmy:password@database:5432/lemmy commands: - <<: *install_binstall - # Install diesel_cli - - cargo binstall -y diesel_cli + - <<: *install_diesel_cli - diesel migration run - diesel print-schema --config-file=diesel.toml > tmp.schema - diff tmp.schema crates/db_schema/src/schema.rs From e75d5020c4efe26f71eee414affcddf07111ee31 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 11:26:15 -0400 Subject: [PATCH 07/27] Try installing mysql and postgres. --- .woodpecker.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index 5c1670b4eb..e34c025902 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -31,6 +31,10 @@ variables: - install_diesel_cli: &install_diesel_cli - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" + - apt update && apt install -y lsb-release + - 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 default-mysql-client steps: prepare_repo: From 2c834beec433e9d2b6897757713f79c27151cefe Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 11:29:38 -0400 Subject: [PATCH 08/27] Try installing mysql and postgres 2. --- .woodpecker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index e34c025902..afb1fe18eb 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -31,10 +31,10 @@ variables: - install_diesel_cli: &install_diesel_cli - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" - - apt update && apt install -y lsb-release - - 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 default-mysql-client + # - apt update && apt install -y lsb-release + # - 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 default-libmysqlclient-dev steps: prepare_repo: From b556975e933fa804011003e4b6882553cac9285f Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 11:58:48 -0400 Subject: [PATCH 09/27] Try installing mysql and postgres 3. --- .woodpecker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index afb1fe18eb..cc14c5c896 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -31,9 +31,9 @@ variables: - install_diesel_cli: &install_diesel_cli - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" - # - apt update && apt install -y lsb-release - # - 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 lsb-release + - 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 default-libmysqlclient-dev steps: From 0c9124e94f627179b017b7c4b497292dc5b32420 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 12:05:29 -0400 Subject: [PATCH 10/27] Try installing mysql and postgres 4. --- .woodpecker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index cc14c5c896..63802d2868 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -29,12 +29,12 @@ variables: - tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz - cp cargo-binstall /usr/local/cargo/bin - install_diesel_cli: &install_diesel_cli - - cargo binstall -y diesel_cli - - export PATH="$CARGO_HOME/bin:$PATH" - apt update && apt install -y lsb-release - 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 default-libmysqlclient-dev + - apt update && apt install -y postgresql-client-16 default-libmysqlclient-dev libmysqlclient-dev + - cargo binstall -y diesel_cli + - export PATH="$CARGO_HOME/bin:$PATH" steps: prepare_repo: From 1a913e109132fd0d6b442cd41b4a4e63e0b66031 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 12:07:41 -0400 Subject: [PATCH 11/27] Try installing mysql and postgres 5. --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 63802d2868..bd806f6d27 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,7 +32,7 @@ variables: - apt update && apt install -y lsb-release - 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 default-libmysqlclient-dev libmysqlclient-dev + - apt update && apt install -y postgresql-client-16 default-libmysqlclient-dev - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" From 7f7381589f5fae229d605a54809fb6af6e9ee49c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 12:11:01 -0400 Subject: [PATCH 12/27] Try installing mysql and postgres 6. --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index bd806f6d27..fdade261f9 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,7 +32,7 @@ variables: - apt update && apt install -y lsb-release - 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 default-libmysqlclient-dev + - apt update && apt install -y postgresql-client-16 default-libmysqlclient-dev libmariadbclient-dev-compat libsqlite3-dev libpq-dev - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" From 7b9db7998e85048b86eb3a4882c71c813de71f56 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 12:14:53 -0400 Subject: [PATCH 13/27] Try installing mysql and postgres 7. --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index fdade261f9..a13db64e2f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,7 +32,7 @@ variables: - apt update && apt install -y lsb-release - 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 default-libmysqlclient-dev libmariadbclient-dev-compat libsqlite3-dev libpq-dev + - apt update && apt install -y postgresql-client-16 libmariadbclient-dev-compat libsqlite3-dev libpq-dev - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" From 6f757053d466fdf79b8d3e73c83972851203f169 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 12:16:36 -0400 Subject: [PATCH 14/27] Try installing mysql and postgres 8. --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index a13db64e2f..24a636b758 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,7 +32,7 @@ variables: - apt update && apt install -y lsb-release - 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 libmariadbclient-dev-compat libsqlite3-dev libpq-dev + - apt update && apt install -y postgresql-client-16 libsqlite3-dev libmysqlclient20 libpq-dev - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" From eabc8465af35387f8ab2077de522c6de0582f798 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 12:20:00 -0400 Subject: [PATCH 15/27] Try installing mysql and postgres 9. --- .woodpecker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 24a636b758..33cd1ee27e 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -29,10 +29,10 @@ variables: - 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 + - 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 libsqlite3-dev libmysqlclient20 libpq-dev + - apt update && apt install -y postgresql-client-16 libsqlite3-dev libpq-dev default-libmysqlclient-dev - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" From 136f0f38f8ac2d65b44e2e320e27212d25367996 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 12:24:06 -0400 Subject: [PATCH 16/27] Try installing mysql and postgres 10. --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 33cd1ee27e..904cc2b9c0 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,7 +32,7 @@ variables: - 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 libsqlite3-dev libpq-dev default-libmysqlclient-dev + - apt update && apt install -y postgresql-client-16 libsqlite3-dev libpq-dev default-mysqlclient - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" From b05a53e664c4c95c3cfabb17d8800469db0db0e0 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 12:25:49 -0400 Subject: [PATCH 17/27] Try installing mysql and postgres 11. --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 904cc2b9c0..3340981acd 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,7 +32,7 @@ variables: - 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 libsqlite3-dev libpq-dev default-mysqlclient + - apt update && apt install -y postgresql-client-16 libsqlite3-dev libpq-dev mysql-server - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" From bc227d16725ce2e095466b1b83b58ae23e01d468 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 12:27:53 -0400 Subject: [PATCH 18/27] Try installing mysql and postgres 12. --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 3340981acd..af7eb032da 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,7 +32,7 @@ variables: - 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 libsqlite3-dev libpq-dev mysql-server + - apt update && apt install -y postgresql-client-16 libsqlite3-dev libpq-dev default-mysql-client - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" From ca65ddc631976d8dfd9313f153d3009c2332dbd2 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 12:31:28 -0400 Subject: [PATCH 19/27] Try installing mysql and postgres 13. --- .woodpecker.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index af7eb032da..4096f92288 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,7 +32,8 @@ variables: - 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 libsqlite3-dev libpq-dev default-mysql-client + - apt update && apt install -y postgresql-client-16 libsqlite3-dev libpq-dev default-libmysqlclient-dev + - export LD_LIBRARY_PATH=/usr/local/mysql/lib - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" From f60c2df2228a9d73ac3788b58a848f7e08f9a265 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 12:33:21 -0400 Subject: [PATCH 20/27] Add logging line. --- .woodpecker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index 4096f92288..eec5e0d4ca 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -34,6 +34,7 @@ variables: - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - - apt update && apt install -y postgresql-client-16 libsqlite3-dev libpq-dev default-libmysqlclient-dev - export LD_LIBRARY_PATH=/usr/local/mysql/lib + - ls -al /usr/local/lib/ - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" From 332c7ef45423eefacabd4d2c5a3559e700ff7045 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 14:24:41 -0400 Subject: [PATCH 21/27] Add logging line 2. --- .woodpecker.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index eec5e0d4ca..2ae79ed762 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,9 +32,10 @@ variables: - 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 libsqlite3-dev libpq-dev default-libmysqlclient-dev - - export LD_LIBRARY_PATH=/usr/local/mysql/lib + - apt update && apt install -y postgresql-client-16 libsqlite3-dev libpq-dev libmariaclient-dev-compat - ls -al /usr/local/lib/ + - ls -al /usr/local/mysql/lib/ + - export LD_LIBRARY_PATH=/usr/local/mysql/lib - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" From 3340ab3a7af7d552de734c102f5aa82a8bc5dca3 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 14:28:40 -0400 Subject: [PATCH 22/27] Add logging line 3. --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 2ae79ed762..2d76719c80 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,7 +32,7 @@ variables: - 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 libsqlite3-dev libpq-dev libmariaclient-dev-compat + - apt update && apt install -y postgresql-client-16 libsqlite3-dev libpq-dev libmariadbclient-dev-compat - ls -al /usr/local/lib/ - ls -al /usr/local/mysql/lib/ - export LD_LIBRARY_PATH=/usr/local/mysql/lib From 6aafc2066c032e7c37793011846b656ffa5ad8fd Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 14:37:56 -0400 Subject: [PATCH 23/27] Add logging line 4. --- .woodpecker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 2d76719c80..d50a616f2c 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,10 +32,10 @@ variables: - 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 libsqlite3-dev libpq-dev libmariadbclient-dev-compat - - ls -al /usr/local/lib/ - - ls -al /usr/local/mysql/lib/ - - export LD_LIBRARY_PATH=/usr/local/mysql/lib + - apt update && apt install -y postgresql-client-16 libsqlite3-dev default-libmysqlclient-dev libpq-dev + - ls -al /usr/lib/ + # - ls -al /usr/local/mysql/lib/ + - export LD_LIBRARY_PATH=/usr/lib - cargo binstall -y diesel_cli - export PATH="$CARGO_HOME/bin:$PATH" From 5dad74b73240e4ee7bebdd08faa8e7f3eb8c0222 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 14:42:29 -0400 Subject: [PATCH 24/27] Removing binstall. --- .woodpecker.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index d50a616f2c..268ad14124 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -32,11 +32,8 @@ variables: - 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 libsqlite3-dev default-libmysqlclient-dev libpq-dev - - ls -al /usr/lib/ - # - ls -al /usr/local/mysql/lib/ - - export LD_LIBRARY_PATH=/usr/lib - - cargo binstall -y diesel_cli + - apt update && apt install -y postgresql-client-16 + - cargo install diesel_cli --no-default-features --features postgres - export PATH="$CARGO_HOME/bin:$PATH" steps: @@ -55,7 +52,6 @@ steps: CARGO_HOME: .cargo_home DATABASE_URL: postgres://lemmy:password@database:5432/lemmy commands: - - <<: *install_binstall - <<: *install_diesel_cli - diesel migration run - diesel print-schema --config-file=diesel.toml > tmp.schema @@ -202,9 +198,8 @@ steps: PGHOST: database PGDATABASE: lemmy commands: - - <<: *install_binstall # Install diesel_cli - - cargo binstall -y diesel_cli -- --no-default-features --features postgres + - <<: *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) From ae8c062f6954d7ffc4bff2467882988054aa48c1 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 14:49:03 -0400 Subject: [PATCH 25/27] Extract taplo into its own image, ignore binstall. --- .woodpecker.yml | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 268ad14124..ebc3623e0f 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -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 @@ -46,18 +47,6 @@ steps: when: - event: [pull_request, tag] - check_diesel_schema: - 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 - - diff tmp.schema crates/db_schema/src/schema.rs - when: *slow_check_paths - prettier_check: image: tmknom/prettier:3.0.0 commands: @@ -66,8 +55,10 @@ steps: - event: pull_request toml_fmt: - image: tamasfe/taplo:0.8.1 + image: *rust_image commands: + - <<: *install_binstall + - cargo binstall -y taplo-cli - taplo format --check when: - event: pull_request @@ -80,7 +71,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 @@ -91,7 +82,7 @@ steps: - event: pull_request cargo_machete: - image: rustlang/rust:nightly + image: *rust_nightly_image commands: - <<: *install_binstall - cargo binstall -y cargo-machete @@ -144,6 +135,18 @@ steps: - diff config/defaults.hjson config/defaults_current.hjson when: *slow_check_paths + check_diesel_schema: + 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 + - diff tmp.schema crates/db_schema/src/schema.rs + when: *slow_check_paths + check_db_perf_tool: image: *rust_image environment: From 4b8118dce94b4c7c7ecd35de2ddd578dd5ddf6f7 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 14:50:38 -0400 Subject: [PATCH 26/27] Use a smaller taplo. --- .woodpecker.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index ebc3623e0f..6d2b488d98 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -55,10 +55,8 @@ steps: - event: pull_request toml_fmt: - image: *rust_image + image: tamasfe/taplo:0.8.1-alpine commands: - - <<: *install_binstall - - cargo binstall -y taplo-cli - taplo format --check when: - event: pull_request From 16a0f3932119c5cb8c899a598aeea74a7d1a887d Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 May 2024 14:51:59 -0400 Subject: [PATCH 27/27] taplo is the same image. --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 6d2b488d98..f8f4eb5f39 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -55,7 +55,7 @@ steps: - event: pull_request toml_fmt: - image: tamasfe/taplo:0.8.1-alpine + image: tamasfe/taplo:0.8.1 commands: - taplo format --check when: