From 226f59a7caadf83dcd1a7d954161e5eafff01253 Mon Sep 17 00:00:00 2001 From: Leynos Date: Sat, 21 Jun 2025 01:04:52 +0100 Subject: [PATCH 1/5] setup-rust: install sqlite on Windows --- .github/actions/setup-rust/CHANGELOG.md | 4 ++++ .github/actions/setup-rust/README.md | 22 ++++++++++++++++++++++ .github/actions/setup-rust/action.yml | 10 ++++++++++ 3 files changed, 36 insertions(+) diff --git a/.github/actions/setup-rust/CHANGELOG.md b/.github/actions/setup-rust/CHANGELOG.md index 84da6cde..6e9b73e4 100644 --- a/.github/actions/setup-rust/CHANGELOG.md +++ b/.github/actions/setup-rust/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog +## v1.0.4 + +- Install SQLite development libraries on Windows via MSYS2. + ## v1.0.3 - Install PostgreSQL client libraries on Windows via Chocolatey. diff --git a/.github/actions/setup-rust/README.md b/.github/actions/setup-rust/README.md index c37814f7..bd55ae5d 100644 --- a/.github/actions/setup-rust/README.md +++ b/.github/actions/setup-rust/README.md @@ -28,6 +28,28 @@ it uses `apt` (`libpq-dev`). On Windows, Chocolatey installs `postgresql17` and exposes its headers and import libraries through `PG_INCLUDE` and `PG_LIB` environment variables. +SQLite is also available on Windows. The action sets up an MSYS2 +environment and installs the `mingw-w64-x86_64-sqlite3` package so the +static library and headers are available when compiling crates that +depend on SQLite. + +```yaml + # Bring in MSYS2 plus the MinGW build of SQLite + - name: Set up MSYS2 and SQLite + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-sqlite3 # ships libsqlite3.a + headers + + # Build inside the MSYS2 shell so the linker sees /mingw64/lib + - name: Build + shell: msys2 {0} + run: cargo build --workspace --all-targets --verbose +``` + ## Caching This action caches `~/.cargo/registry`, `~/.cargo/git` and the build output in diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml index 50edd3e5..7c0b9149 100644 --- a/.github/actions/setup-rust/action.yml +++ b/.github/actions/setup-rust/action.yml @@ -39,3 +39,13 @@ runs: "PG_INCLUDE=$pgRoot\include" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append "PG_LIB=$pgRoot\lib" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append echo "$pgRoot\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append + + - name: Install SQLite (MSYS2) + if: ${{ runner.os == 'Windows' }} + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-sqlite3 From 1af949085d0e948fe14c0705eb092ba093e857e8 Mon Sep 17 00:00:00 2001 From: Leynos Date: Sat, 21 Jun 2025 01:15:43 +0100 Subject: [PATCH 2/5] Document and install SQLite via MSYS2 --- .github/actions/setup-rust/CHANGELOG.md | 3 ++- .github/actions/setup-rust/README.md | 8 ++++---- .github/actions/setup-rust/action.yml | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/actions/setup-rust/CHANGELOG.md b/.github/actions/setup-rust/CHANGELOG.md index 6e9b73e4..85a093cc 100644 --- a/.github/actions/setup-rust/CHANGELOG.md +++ b/.github/actions/setup-rust/CHANGELOG.md @@ -3,7 +3,8 @@ ## v1.0.4 -- Install SQLite development libraries on Windows via MSYS2. +- Install SQLite development libraries on Windows via MSYS2 alongside the GCC + toolchain. ## v1.0.3 diff --git a/.github/actions/setup-rust/README.md b/.github/actions/setup-rust/README.md index bd55ae5d..d8e85970 100644 --- a/.github/actions/setup-rust/README.md +++ b/.github/actions/setup-rust/README.md @@ -29,13 +29,13 @@ it uses `apt` (`libpq-dev`). On Windows, Chocolatey installs `PG_INCLUDE` and `PG_LIB` environment variables. SQLite is also available on Windows. The action sets up an MSYS2 -environment and installs the `mingw-w64-x86_64-sqlite3` package so the -static library and headers are available when compiling crates that -depend on SQLite. +environment and installs both the `mingw-w64-x86_64-toolchain` and +`mingw-w64-x86_64-sqlite3` packages so the static library and headers +are available when compiling crates that depend on SQLite. ```yaml # Bring in MSYS2 plus the MinGW build of SQLite - - name: Set up MSYS2 and SQLite + - name: Install MSYS2 toolchain and SQLite uses: msys2/setup-msys2@v2 with: msystem: MINGW64 diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml index 7c0b9149..8f8497a6 100644 --- a/.github/actions/setup-rust/action.yml +++ b/.github/actions/setup-rust/action.yml @@ -40,7 +40,7 @@ runs: "PG_LIB=$pgRoot\lib" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append echo "$pgRoot\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append - - name: Install SQLite (MSYS2) + - name: Install MSYS2 toolchain and SQLite if: ${{ runner.os == 'Windows' }} uses: msys2/setup-msys2@v2 with: From db9cd9709b4b2d0e511b637430ffa45dda1b69ad Mon Sep 17 00:00:00 2001 From: Leynos Date: Sat, 21 Jun 2025 01:40:31 +0100 Subject: [PATCH 3/5] Make SQLite installation optional --- .github/actions/setup-rust/CHANGELOG.md | 4 ++-- .github/actions/setup-rust/README.md | 16 +++++++++++----- .github/actions/setup-rust/action.yml | 6 +++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/actions/setup-rust/CHANGELOG.md b/.github/actions/setup-rust/CHANGELOG.md index 85a093cc..9d0445e0 100644 --- a/.github/actions/setup-rust/CHANGELOG.md +++ b/.github/actions/setup-rust/CHANGELOG.md @@ -3,8 +3,8 @@ ## v1.0.4 -- Install SQLite development libraries on Windows via MSYS2 alongside the GCC - toolchain. +- Optionally install SQLite development libraries on Windows via MSYS2 using the + `install-sqlite-deps` input. ## v1.0.3 diff --git a/.github/actions/setup-rust/README.md b/.github/actions/setup-rust/README.md index d8e85970..c2726a78 100644 --- a/.github/actions/setup-rust/README.md +++ b/.github/actions/setup-rust/README.md @@ -1,13 +1,15 @@ # Setup Rust Install the Rust toolchain and cache your build dependencies. Optionally -install PostgreSQL system libraries for crates that require them. +install PostgreSQL and SQLite system libraries for crates that require +them. ## Inputs | Name | Description | Required | Default | | --- | --- | --- | --- | | install-postgres-deps | Install PostgreSQL system dependencies | no | `false` | +| install-sqlite-deps | Install SQLite development libraries (Windows) | no | `false` | | BUILD_PROFILE | Build profile used for caching | no | `release` | ## Outputs @@ -20,6 +22,7 @@ None uses: ./.github/actions/setup-rust@v1 with: install-postgres-deps: true + install-sqlite-deps: true ``` When `install-postgres-deps` is enabled, the action installs PostgreSQL @@ -28,10 +31,13 @@ it uses `apt` (`libpq-dev`). On Windows, Chocolatey installs `postgresql17` and exposes its headers and import libraries through `PG_INCLUDE` and `PG_LIB` environment variables. -SQLite is also available on Windows. The action sets up an MSYS2 -environment and installs both the `mingw-w64-x86_64-toolchain` and -`mingw-w64-x86_64-sqlite3` packages so the static library and headers -are available when compiling crates that depend on SQLite. +When `install-sqlite-deps` is enabled, the action installs SQLite +development files using MSYS2 on Windows. + +Enable SQLite support on Windows by setting up an MSYS2 environment +with the MinGW toolchain and the `mingw-w64-x86_64-sqlite3` package so +the static library and headers are available when compiling crates that +depend on SQLite. ```yaml # Bring in MSYS2 plus the MinGW build of SQLite diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml index 8f8497a6..11c3a0ef 100644 --- a/.github/actions/setup-rust/action.yml +++ b/.github/actions/setup-rust/action.yml @@ -5,6 +5,10 @@ inputs: description: Install PostgreSQL system dependencies required: false default: false + install-sqlite-deps: + description: Install SQLite development libraries on Windows + required: false + default: false runs: using: composite steps: @@ -41,7 +45,7 @@ runs: echo "$pgRoot\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append - name: Install MSYS2 toolchain and SQLite - if: ${{ runner.os == 'Windows' }} + if: ${{ inputs.install-sqlite-deps == 'true' && runner.os == 'Windows' }} uses: msys2/setup-msys2@v2 with: msystem: MINGW64 From 9d957d7b3247704fbde00ba36b261d3432259b20 Mon Sep 17 00:00:00 2001 From: Leynos Date: Sat, 21 Jun 2025 01:52:04 +0100 Subject: [PATCH 4/5] docs(setup-rust): clarify sqlite instructions --- .github/actions/setup-rust/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-rust/README.md b/.github/actions/setup-rust/README.md index c2726a78..631258d8 100644 --- a/.github/actions/setup-rust/README.md +++ b/.github/actions/setup-rust/README.md @@ -35,8 +35,8 @@ When `install-sqlite-deps` is enabled, the action installs SQLite development files using MSYS2 on Windows. Enable SQLite support on Windows by setting up an MSYS2 environment -with the MinGW toolchain and the `mingw-w64-x86_64-sqlite3` package so -the static library and headers are available when compiling crates that +with the MinGW toolchain and the `mingw-w64-x86_64-sqlite3` package, +so the static library and headers are available when compiling crates that depend on SQLite. ```yaml From fe3706d05e39b9cbc421bc1385929ea09427fa9c Mon Sep 17 00:00:00 2001 From: Leynos Date: Sat, 21 Jun 2025 02:16:11 +0100 Subject: [PATCH 5/5] docs(setup-rust): clarify SQLite setup wording --- .github/actions/setup-rust/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-rust/README.md b/.github/actions/setup-rust/README.md index 631258d8..4fc30e5e 100644 --- a/.github/actions/setup-rust/README.md +++ b/.github/actions/setup-rust/README.md @@ -34,7 +34,7 @@ it uses `apt` (`libpq-dev`). On Windows, Chocolatey installs When `install-sqlite-deps` is enabled, the action installs SQLite development files using MSYS2 on Windows. -Enable SQLite support on Windows by setting up an MSYS2 environment +SQLite support on Windows is enabled by setting up an MSYS2 environment with the MinGW toolchain and the `mingw-w64-x86_64-sqlite3` package, so the static library and headers are available when compiling crates that depend on SQLite.