debug #25
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: | |
branches: | |
- '*' | |
tags: | |
- 'v*' | |
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-latest | |
target: x86_64-apple-darwin | |
binary-check: otool -L | |
- name: macOS aarch64 | |
os: macos-latest | |
target: aarch64-apple-darwin | |
skip-tests: true | |
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: matrix.os == 'macos-latest' | |
shell: bash | |
run: | | |
brew install coreutils | |
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/v') | |
with: | |
files: elan-${{ matrix.release-target-name || matrix.target }}* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |