66 lines
2.2 KiB
YAML
66 lines
2.2 KiB
YAML
# Cross-compiles reqlite for Windows (x86_64-pc-windows-gnu, MinGW-w64) on the
|
|
# standard Ubuntu runner and uploads a portable zip with both binaries.
|
|
name: windows
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*"]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
TARGET: x86_64-pc-windows-gnu
|
|
# Link the MinGW C runtime pieces statically so the .exe files need no DLLs.
|
|
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS: -C target-feature=+crt-static
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install MinGW-w64 and zip
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64 zip
|
|
|
|
- name: Install Rust (version from rust-toolchain.toml)
|
|
run: |
|
|
if ! command -v rustup >/dev/null; then
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain none
|
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
fi
|
|
rustup show active-toolchain || rustup toolchain install
|
|
rustup target add "$TARGET"
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: windows-gnu-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
|
|
restore-keys: windows-gnu-
|
|
|
|
- name: Build
|
|
run: cargo build --release --locked --target "$TARGET" -p reqlite-app -p reqlite-cli
|
|
|
|
- name: Package
|
|
id: package
|
|
run: |
|
|
version=$(cargo pkgid -p reqlite-app | sed 's/.*[#@]//')
|
|
name="reqlite-${version}-windows-x86_64"
|
|
dir="target/dist/${name}"
|
|
rm -rf "$dir" && mkdir -p "$dir"
|
|
cp "target/$TARGET/release/reqlite-gui.exe" "target/$TARGET/release/reqlite.exe" README.md "$dir/"
|
|
(cd target/dist && rm -f "${name}.zip" && zip -r9 "${name}.zip" "$name")
|
|
echo "name=${name}" >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ steps.package.outputs.name }}
|
|
path: target/dist/${{ steps.package.outputs.name }}.zip
|