diff --git a/.github/actions/setup-rust/CHANGELOG.md b/.github/actions/setup-rust/CHANGELOG.md index 84da6cde..9d0445e0 100644 --- a/.github/actions/setup-rust/CHANGELOG.md +++ b/.github/actions/setup-rust/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog +## v1.0.4 + +- Optionally install SQLite development libraries on Windows via MSYS2 using the + `install-sqlite-deps` input. + ## 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..4fc30e5e 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,6 +31,31 @@ 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. +When `install-sqlite-deps` is enabled, the action installs SQLite +development files using MSYS2 on Windows. + +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. + +```yaml + # Bring in MSYS2 plus the MinGW build of SQLite + - name: Install MSYS2 toolchain 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..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: @@ -39,3 +43,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 MSYS2 toolchain and SQLite + if: ${{ inputs.install-sqlite-deps == 'true' && runner.os == 'Windows' }} + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-sqlite3