From f5fd91f717714c3581b777405e7cbcf9ce4a11a8 Mon Sep 17 00:00:00 2001 From: Alphonse Paix Date: Sun, 28 Sep 2025 17:07:21 +0200 Subject: [PATCH] deleted cargo config and fmt --- .cargo/config.toml | 3 --- .dockerignore | 1 - .github/workflows/general.yml | 33 ++++++--------------------------- tests/api/unsubscribe.rs | 4 +++- 4 files changed, 9 insertions(+), 32 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 0c38d57..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,3 +0,0 @@ -[target.x86_64-unknown-linux-gnu] -linker = "clang" -rustflags = ["-C", "link-arg=-fuse-ld=/usr/bin/mold"] diff --git a/.dockerignore b/.dockerignore index 8b2ecb7..878418f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,7 +6,6 @@ Dockerfile /migrations /node_modules /assets/css/main.css -/.cargo /.github README.md /tests diff --git a/.github/workflows/general.yml b/.github/workflows/general.yml index e3058c6..5c26678 100644 --- a/.github/workflows/general.yml +++ b/.github/workflows/general.yml @@ -13,11 +13,8 @@ env: CARGO_TERM_COLOR: always SQLX_VERSION: 0.8.6 SQLX_FEATURES: "rustls,postgres" - APP_USER: app - APP_USER_PWD: secret - APP_DB_NAME: newsletter - APP_DATABASE__PORT: 15432 - APP_REDIS_URI: redis://127.0.0.1:16379 + APP_REDIS_URI: redis://redis:6379 + DATABASE_URL: postgres://postgres:password@postgres:5432/newsletter jobs: test: @@ -29,7 +26,7 @@ jobs: env: POSTGRES_USER: postgres POSTGRES_PASSWORD: password - POSTGRES_DB: postgres + POSTGRES_DB: newsletter ports: - 15432:5432 redis: @@ -49,17 +46,8 @@ jobs: --features ${{ env.SQLX_FEATURES }} --no-default-features --locked - - name: Create app user in Postgres - run: | - sudo apt-get update && sudo apt-get install postgresql-client - - CREATE_QUERY="CREATE USER ${APP_USER} WITH PASSWORD '${APP_USER_PWD}';" - PGPASSWORD="password" psql -U postgres -h localhost -p 15432 -c "${CREATE_QUERY}" - - GRANT_QUERY="ALTER USER ${APP_USER} CREATEDB;" - PGPASSWORD="password" psql -U postgres -h localhost -p 15432 -c "${GRANT_QUERY}" - name: Migrate database - run: SKIP_DOCKER=true ./scripts/init_db.sh + run: cargo sqlx migrate run - name: Run tests run: cargo test - name: Check that queries are fresh @@ -102,7 +90,7 @@ jobs: env: POSTGRES_USER: postgres POSTGRES_PASSWORD: password - POSTGRES_DB: postgres + POSTGRES_DB: newsletter ports: - 15432:5432 redis: @@ -122,17 +110,8 @@ jobs: --features ${{ env.SQLX_FEATURES }} --no-default-features --locked - - name: Create app user in Postgres - run: | - sudo apt-get update && sudo apt-get install postgresql-client - - CREATE_QUERY="CREATE USER ${APP_USER} WITH PASSWORD '${APP_USER_PWD}';" - PGPASSWORD="password" psql -U postgres -h localhost -p 15432 -c "${CREATE_QUERY}" - - GRANT_QUERY="ALTER USER ${APP_USER} CREATEDB;" - PGPASSWORD="password" psql -U postgres -h localhost -p 15432 -c "${GRANT_QUERY}" - name: Migrate database - run: SKIP_DOCKER=true ./scripts/init_db.sh + run: cargo sqlx migrate run - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov - name: Generate code coverage diff --git a/tests/api/unsubscribe.rs b/tests/api/unsubscribe.rs index 1d2c52b..23227b3 100644 --- a/tests/api/unsubscribe.rs +++ b/tests/api/unsubscribe.rs @@ -48,7 +48,9 @@ async fn subscriber_can_unsubscribe(connection_pool: PgPool) { } #[sqlx::test] -async fn a_valid_unsubscribe_link_is_present_in_new_post_email_notifications(connection_pool: PgPool) { +async fn a_valid_unsubscribe_link_is_present_in_new_post_email_notifications( + connection_pool: PgPool, +) { let app = TestApp::spawn(connection_pool).await; app.create_confirmed_subscriber().await; app.admin_login().await;