diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b47621..b9d1c52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,3 +61,32 @@ jobs: run: ./ci/install-rust.sh "${{ matrix.rust-version }}" --profile minimal - name: Build and test run: ./ci/build-and-test.sh + + build-dist: + strategy: + matrix: + include: + - name: linux-x86_64 + image: quay.io/pypa/manylinux2014_x86_64 + command: bash ./ci/build-dist-linux.sh x86_64-unknown-linux-gnu + output: target/x86_64-unknown-linux-gnu/release/rsjsonnet + artifact: rsjsonnet_linux-x86_64 + name: build-dist (${{ matrix.name }}) + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - name: Pull image + run: docker pull ${{ matrix.image }} + - name: Build + run: | + docker run \ + -v "$(pwd):/workdir" \ + -w /workdir \ + ${{ matrix.image }} \ + ${{ matrix.command }} + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact }} + path: ${{ matrix.output }} + if-no-files-found: error diff --git a/ci/build-dist-linux.sh b/ci/build-dist-linux.sh new file mode 100755 index 0000000..ff87ad0 --- /dev/null +++ b/ci/build-dist-linux.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -euo pipefail + +target="$1" + +rust_version="$(cat "ci/rust-versions/stable.txt")" +rustup_args=("$rust_version" --profile minimal) + +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ + sh -s -- -y --default-toolchain "${rustup_args[@]}" -t "$target" + +# shellcheck disable=SC1091 +. "$HOME/.cargo/env" + +cargo fetch --locked +cargo build -p rsjsonnet --target "$target" --release --frozen