fix: extend builder #389
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: CI | |
on: [push] | |
jobs: | |
test: | |
name: Test Suite | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --all | |
cargo-release: | |
if: startsWith(github.ref, 'refs/tags/') && !endsWith(github.ref, '-test') | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Install cargo release command | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: cargo-release | |
- name: Run cargo login | |
uses: actions-rs/cargo@v1 | |
with: | |
command: login | |
args: ${{ secrets.CARGO_TOKEN }} | |
- name: Publish crates | |
uses: actions-rs/cargo@v1 | |
with: | |
command: release | |
args: --no-dev-version --skip-push --skip-tag --no-confirm | |
github-release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [test] | |
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-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
target: ${{ matrix.target }} | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- 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-') }} | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --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/action-gh-release@v1 | |
with: | |
draft: true | |
files: "jrsonnet*" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |