From 916705645e42f42b76657bfdeba79d1678edf218 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 02:49:21 +0000 Subject: [PATCH 1/6] Initial plan From f20aeeda3beb4dc54f0674d5cb4a4d61cd21c59d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 02:52:06 +0000 Subject: [PATCH 2/6] Add GitHub Actions workflow for running cargo tests on PRs Co-authored-by: affandar <1480118+affandar@users.noreply.github.com> --- .github/workflows/test.yml | 67 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f391ebd --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,67 @@ +name: Tests + +on: + pull_request: + branches: + - main + +env: + CARGO_TERM_COLOR: always + +jobs: + test: + name: Run Cargo Tests + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:15 + env: + POSTGRES_PASSWORD: postgres + POSTGRES_USER: postgres + POSTGRES_DB: duroxide_test + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Cache cargo registry + uses: actions/cache@v4 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache cargo index + uses: actions/cache@v4 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-index- + + - name: Cache cargo build + uses: actions/cache@v4 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-build-target- + + - name: Run tests + env: + # Use the configured DATABASE_URL secret if available, + # otherwise use the PostgreSQL service container + DATABASE_URL: ${{ secrets.DATABASE_URL || 'postgres://postgres:postgres@localhost:5432/duroxide_test' }} + run: cargo test --verbose From 48b60a144abb4107c7fcd430eab2088acc1fa9c7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 02:53:45 +0000 Subject: [PATCH 3/6] Add permissions block to workflow for security Co-authored-by: affandar <1480118+affandar@users.noreply.github.com> --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f391ebd..7abcc73 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,8 @@ jobs: test: name: Run Cargo Tests runs-on: ubuntu-latest + permissions: + contents: read services: postgres: From 17ca5fecd3ae56bbdf047d7c9c62e5e7a209db1e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 03:03:28 +0000 Subject: [PATCH 4/6] Pin duroxide dependency to exact version 0.1.5 Co-authored-by: affandar <1480118+affandar@users.noreply.github.com> --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5a36730..018d1c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ exclude = [ ] [dependencies] -duroxide = { version = "0.1.5", features = ["provider-test"] } +duroxide = { version = "=0.1.5", features = ["provider-test"] } async-trait = "0.1" tokio = { version = "1", features = ["full"] } sqlx = { version = "0.8", features = ["runtime-tokio-rustls", "postgres", "chrono"], default-features = false } From 4a90850340626ba9aa8ea9c46f4b00667571cf63 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 03:31:34 +0000 Subject: [PATCH 5/6] Fix workflow to use service container DATABASE_URL instead of secrets Co-authored-by: affandar <1480118+affandar@users.noreply.github.com> --- .github/workflows/test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7abcc73..86f86b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,7 +63,6 @@ jobs: - name: Run tests env: - # Use the configured DATABASE_URL secret if available, - # otherwise use the PostgreSQL service container - DATABASE_URL: ${{ secrets.DATABASE_URL || 'postgres://postgres:postgres@localhost:5432/duroxide_test' }} + # Use the PostgreSQL service container for CI tests + DATABASE_URL: postgres://postgres:postgres@localhost:5432/duroxide_test run: cargo test --verbose From 68d3d3504b269daab1c409a5526fbf80833c7aed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 28 Dec 2025 03:47:58 +0000 Subject: [PATCH 6/6] Trigger workflow run with comment to verify tests pass Co-authored-by: affandar <1480118+affandar@users.noreply.github.com> --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 86f86b6..c80066e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,7 @@ name: Tests +# Runs cargo tests on pull requests + on: pull_request: branches: