Skip to content

Commit

Permalink
ci: add distribution builds for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardosm committed Apr 11, 2024
1 parent d80441a commit 5159143
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,29 @@ jobs:
name: dist-linux-i686
path: output/rsjsonnet-linux-i686
if-no-files-found: error

build-dist-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Pull image
run: docker pull debian:buster
- name: Build
run: |
docker run \
-v "$(pwd):/workdir" \
-w /workdir \
debian:buster \
bash ./ci/build-dist-windows.sh
- name: Upload windows-x86_64 artifact
uses: actions/upload-artifact@v4
with:
name: dist-windows-x86_64
path: output/rsjsonnet-windows-x86_64
if-no-files-found: error
- name: Upload windows-i686 artifact
uses: actions/upload-artifact@v4
with:
name: dist-windows-i686
path: output/rsjsonnet-windows-i686
if-no-files-found: error
42 changes: 42 additions & 0 deletions ci/build-dist-windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail

echo "::group::Install dependencies"
apt-get update
apt-get install -y --no-install-recommends gcc gcc-mingw-w64-x86-64 gcc-mingw-w64-i686
echo "::endgroup::"

echo "::group::Install Rust"

rust_version="$(cat "ci/rust-versions/stable.txt")"

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y --default-toolchain "$rust_version" --profile minimal \
-t x86_64-pc-windows-gnu \
-t i686-pc-windows-gnu

# shellcheck disable=SC1090
. "$HOME/.cargo/env"

echo "::endgroup::"

export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_CODEGEN_PANIC=abort
export CARGO_PROFILE_RELEASE_STRIP=debuginfo

echo "::group::Fetch Rust dependencies"
cargo fetch --locked
mkdir output
echo "::endgroup::"

echo "::group::Build x86_64"
cargo build -p rsjsonnet --target x86_64-pc-windows-gnu --release --frozen
mkdir output/rsjsonnet-linux-x86_64
cp -t output/rsjsonnet-linux-x86_64 target/x86_64-pc-windows-gnu/release/rsjsonnet.exe
echo "::endgroup::"

echo "::group::Build i686"
cargo build -p rsjsonnet --target i686-pc-windows-gnu --release --frozen
mkdir output/rsjsonnet-linux-i686
cp -t output/rsjsonnet-linux-i686 target/i686-pc-windows-gnu/release/rsjsonnet.exe
echo "::endgroup::"

0 comments on commit 5159143

Please sign in to comment.