Skip to content

chore: update to build with rust 1.80 (#134) #310

chore: update to build with rust 1.80 (#134)

chore: update to build with rust 1.80 (#134) #310

Workflow file for this run

name: CI
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
branches:
- '*'
jobs:
Build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: Linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl
# back compat
release-target-name: x86_64-unknown-linux-gnu
binary-check: ldd -v
- name: Linux aarch64
os: ubuntu-latest
target: aarch64-unknown-linux-musl
skip-tests: true
# back compat
release-target-name: aarch64-unknown-linux-gnu
binary-check: true
- name: macOS
os: macos-13
target: x86_64-apple-darwin
binary-check: otool -L
- name: macOS aarch64
os: macos-14
target: aarch64-apple-darwin
binary-check: otool -L
- name: Windows
os: windows-latest
target: x86_64-pc-windows-msvc
RUSTFLAGS: -C target-feature=+crt-static
binary-check: ldd
# complete all jobs
fail-fast: false
name: ${{ matrix.name }}
env:
RELEASE_TARGET_NAME: ${{ matrix.release-target-name || matrix.target }}
RUSTFLAGS: ${{ matrix.RUSTFLAGS }}
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ matrix.name }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup macOS
if: startsWith(matrix.os, 'macos-')
shell: bash
run: |
echo $HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin >> $GITHUB_PATH
# still necessary??
echo /usr/local/opt/gnu-tar/libexec/gnubin >> $GITHUB_PATH
- name: Build
run: |
cargo install cross --locked
cross build --release --target ${{ matrix.target }}
- name: Check Binaries
run: ${{ matrix.binary-check }} target/${{ matrix.target }}/release/elan-init
- name: Package
shell: bash
run: |
cd target/${{ matrix.target }}/release
tar --portability -czf ../../../elan-${{ matrix.release-target-name || matrix.target }}.tar.gz elan-init
if: matrix.os != 'windows-latest'
- name: Package
run: |
cd target/${{ matrix.target }}/release
Compress-Archive elan-init.exe ../../../elan-${{ matrix.release-target-name || matrix.target }}.zip
if: matrix.os == 'windows-latest'
- uses: actions/upload-artifact@v2
with:
name: build-${{ matrix.name }}
path: elan-${{ matrix.release-target-name || matrix.target }}*
if-no-files-found: error
- name: Test
if: ${{ !matrix.skip-tests }}
run: |
cross test --release --target ${{ matrix.target }}
- name: Install Test
if: ${{ !matrix.skip-tests }}
shell: bash
run: |
RUST_BACKTRACE=1 target/${{ matrix.target }}/release/elan-init -y
# not created on Windows
[ -f ~/.elan/env ] && source ~/.elan/env || export PATH=$PATH:~/.elan/bin
lake new foo
cd foo
lake build
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: elan-${{ matrix.release-target-name || matrix.target }}*
prerelease: ${{ !startsWith(github.ref, 'refs/tags/v') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}