mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-29 15:51:20 +00:00
Try 9
This commit is contained in:
parent
c48e7d469a
commit
cf371e604d
1 changed files with 34 additions and 40 deletions
|
@ -7,12 +7,6 @@ variables:
|
||||||
- &install_pnpm "corepack enable pnpm"
|
- &install_pnpm "corepack enable pnpm"
|
||||||
- &install_binstall "wget -O- https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz | tar -xvz -C /usr/local/cargo/bin"
|
- &install_binstall "wget -O- https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz | tar -xvz -C /usr/local/cargo/bin"
|
||||||
- install_diesel_cli: &install_diesel_cli
|
- install_diesel_cli: &install_diesel_cli
|
||||||
# - apt-get update && apt-get install lsb-release
|
|
||||||
# Instructions taken from here: https://www.postgresql.org/download/linux/ubuntu/
|
|
||||||
# - install -d /usr/share/postgresql-common/pgdg
|
|
||||||
# - curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
|
||||||
# - sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
|
||||||
# - apt-get update && apt-get -y install postgresql-client
|
|
||||||
- apt-get update && apt-get -y install postgresql-client
|
- apt-get update && apt-get -y install postgresql-client
|
||||||
- cargo install diesel_cli --no-default-features --features postgres
|
- cargo install diesel_cli --no-default-features --features postgres
|
||||||
- export PATH="$CARGO_HOME/bin:$PATH"
|
- export PATH="$CARGO_HOME/bin:$PATH"
|
||||||
|
@ -47,6 +41,40 @@ steps:
|
||||||
when:
|
when:
|
||||||
- event: [pull_request, tag]
|
- event: [pull_request, tag]
|
||||||
|
|
||||||
|
check_diesel_migration:
|
||||||
|
# TODO: use willsquire/diesel-cli image when shared libraries become optional in lemmy_server
|
||||||
|
image: *rust_image
|
||||||
|
environment:
|
||||||
|
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
||||||
|
RUST_BACKTRACE: "1"
|
||||||
|
CARGO_HOME: .cargo_home
|
||||||
|
DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
||||||
|
PGUSER: lemmy
|
||||||
|
PGPASSWORD: password
|
||||||
|
PGHOST: database
|
||||||
|
PGDATABASE: lemmy
|
||||||
|
commands:
|
||||||
|
# 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)
|
||||||
|
- psql -c "DROP SCHEMA IF EXISTS r CASCADE;"
|
||||||
|
- pg_dump --no-owner --no-privileges --no-table-access-method --schema-only --no-sync -f before.sqldump
|
||||||
|
# Make sure that the newest migration is revertable without the `r` schema
|
||||||
|
- diesel migration redo
|
||||||
|
# Run schema setup twice, which fails on the 2nd time if `DROP SCHEMA IF EXISTS r CASCADE` drops the wrong things
|
||||||
|
- alias lemmy_schema_setup="target/lemmy_server --disable-scheduled-tasks --disable-http-server --disable-activity-sending"
|
||||||
|
- lemmy_schema_setup
|
||||||
|
- lemmy_schema_setup
|
||||||
|
# Make sure that the newest migration is revertable with the `r` schema
|
||||||
|
- diesel migration redo
|
||||||
|
# Check for changes in the schema, which would be caused by an incorrect migration
|
||||||
|
- psql -c "DROP SCHEMA IF EXISTS r CASCADE;"
|
||||||
|
- pg_dump --no-owner --no-privileges --no-table-access-method --schema-only --no-sync -f after.sqldump
|
||||||
|
- diff before.sqldump after.sqldump
|
||||||
|
when: *slow_check_paths
|
||||||
|
|
||||||
check_diesel_schema:
|
check_diesel_schema:
|
||||||
image: *rust_image
|
image: *rust_image
|
||||||
environment:
|
environment:
|
||||||
|
@ -187,40 +215,6 @@ steps:
|
||||||
- cargo test --workspace --no-fail-fast
|
- cargo test --workspace --no-fail-fast
|
||||||
when: *slow_check_paths
|
when: *slow_check_paths
|
||||||
|
|
||||||
check_diesel_migration:
|
|
||||||
# TODO: use willsquire/diesel-cli image when shared libraries become optional in lemmy_server
|
|
||||||
image: *rust_image
|
|
||||||
environment:
|
|
||||||
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
|
||||||
RUST_BACKTRACE: "1"
|
|
||||||
CARGO_HOME: .cargo_home
|
|
||||||
DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
|
||||||
PGUSER: lemmy
|
|
||||||
PGPASSWORD: password
|
|
||||||
PGHOST: database
|
|
||||||
PGDATABASE: lemmy
|
|
||||||
commands:
|
|
||||||
# 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)
|
|
||||||
- psql -c "DROP SCHEMA IF EXISTS r CASCADE;"
|
|
||||||
- pg_dump --no-owner --no-privileges --no-table-access-method --schema-only --no-sync -f before.sqldump
|
|
||||||
# Make sure that the newest migration is revertable without the `r` schema
|
|
||||||
- diesel migration redo
|
|
||||||
# Run schema setup twice, which fails on the 2nd time if `DROP SCHEMA IF EXISTS r CASCADE` drops the wrong things
|
|
||||||
- alias lemmy_schema_setup="target/lemmy_server --disable-scheduled-tasks --disable-http-server --disable-activity-sending"
|
|
||||||
- lemmy_schema_setup
|
|
||||||
- lemmy_schema_setup
|
|
||||||
# Make sure that the newest migration is revertable with the `r` schema
|
|
||||||
- diesel migration redo
|
|
||||||
# Check for changes in the schema, which would be caused by an incorrect migration
|
|
||||||
- psql -c "DROP SCHEMA IF EXISTS r CASCADE;"
|
|
||||||
- pg_dump --no-owner --no-privileges --no-table-access-method --schema-only --no-sync -f after.sqldump
|
|
||||||
- diff before.sqldump after.sqldump
|
|
||||||
when: *slow_check_paths
|
|
||||||
|
|
||||||
run_federation_tests:
|
run_federation_tests:
|
||||||
image: node:20-bookworm-slim
|
image: node:20-bookworm-slim
|
||||||
environment:
|
environment:
|
||||||
|
|
Loading…
Reference in a new issue