feat: grow os stack on demand #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | ||
on: | ||
push: | ||
tags: [ 'v*' ] | ||
jobs: | ||
tests: | ||
uses: ./.github/workflows/test.yaml | ||
cargo-release: | ||
if: !endsWith(github.ref, '-test') | ||
needs: [ tests ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Install stable toolchain | ||
uses: actions-rust-lang/[email protected] | ||
with: | ||
toolchain: stable | ||
- run: cargo install cargo-release | ||
- run: cargo login ${{ secrets.CARGO_TOKEN }} | ||
- run: cargo release --no-dev-version --skip-push --skip-tag --no-confirm | ||
github-release: | ||
needs: [ tests ] | ||
strategy: | ||
matrix: | ||
target: | ||
# Linux build notes: | ||
# While musl targets are not as supported as gnu, those are most relevant to users, | ||
# which want to download binaries from github, as glibc has compatibility issues | ||
# with older distros | ||
# Tier 1 | ||
- i686-pc-windows-msvc | ||
- x86_64-apple-darwin | ||
- x86_64-pc-windows-msvc | ||
# Tier 2 | ||
- aarch64-apple-darwin | ||
- aarch64-unknown-linux-musl | ||
- i686-unknown-linux-musl | ||
- x86_64-unknown-linux-musl | ||
include: | ||
# Linux | ||
- target: aarch64-unknown-linux-musl | ||
os: ubuntu-latest | ||
bin: jrsonnet | ||
name: jrsonnet-linux-aarch64 | ||
- target: i686-unknown-linux-musl | ||
os: ubuntu-latest | ||
bin: jrsonnet | ||
name: jrsonnet-linux-i686 | ||
- target: x86_64-unknown-linux-musl | ||
os: ubuntu-latest | ||
bin: jrsonnet | ||
name: jrsonnet-linux-amd64 | ||
# Windows | ||
- target: i686-pc-windows-msvc | ||
os: windows-latest | ||
bin: jrsonnet.exe | ||
name: jrsonnet-windows-i686.exe | ||
- target: x86_64-pc-windows-msvc | ||
os: windows-latest | ||
bin: jrsonnet.exe | ||
name: jrsonnet-windows-amd64.exe | ||
# Apple | ||
- target: aarch64-apple-darwin | ||
os: macOS-latest | ||
bin: jrsonnet | ||
name: jrsonnet-darwin-aarch64 | ||
- target: x86_64-apple-darwin | ||
os: macOS-latest | ||
bin: jrsonnet | ||
name: jrsonnet-darwin-amd64 | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Fetch apt repo updates | ||
if: ${{ startsWith(matrix.os, 'ubuntu-') }} | ||
run: sudo apt update | ||
- name: Install stable toolchain | ||
uses: actions-rust-lang/[email protected] | ||
with: | ||
toolchain: stable | ||
target: ${{ matrix.target }} | ||
- uses: actions/[email protected] | ||
- name: Add experimental flags | ||
if: ${{ endsWith(github.ref, '-test' )}} | ||
run: echo 'EXPERIMENTAL_FLAGS=--features=experimental' >> $GITHUB_ENV | ||
- name: Linux x86 cross compiler | ||
if: ${{ startsWith(matrix.target, 'i686-unknown-linux-') }} | ||
run: sudo apt install gcc-multilib | ||
- name: ARM cross compiler | ||
if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }} | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: install | ||
args: cross | ||
- name: ARM gcc | ||
if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }} | ||
run: sudo apt install gcc-aarch64-linux-gnu | ||
- name: Musl gcc | ||
if: ${{ endsWith(matrix.target, '-musl') }} | ||
run: sudo apt install musl musl-tools | ||
- name: Run cross build | ||
if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }} | ||
shell: bash | ||
run: cross build --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }} | ||
- name: Run build | ||
if: ${{ !startsWith(matrix.target, 'aarch64-unknown-linux-') }} | ||
run: cargo build --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }} | ||
- name: Package | ||
shell: bash | ||
run: | | ||
cd target/${{ matrix.target }}/release | ||
cp ${{ matrix.bin }} ../../../${{ matrix.name }} | ||
cd - | ||
- name: Generate SHA-256 | ||
run: shasum -a 256 ${{ matrix.name }} > ${{ matrix.name }}.sha256 | ||
- name: Publish | ||
uses: softprops/[email protected] | ||
with: | ||
draft: true | ||
files: "jrsonnet*" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |