Skip to content

Build macOS and Ubuntu #76

Build macOS and Ubuntu

Build macOS and Ubuntu #76

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Build macOS and Ubuntu
# Controls when the workflow will run
on:
# Triggers the workflow on release tags
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
- 'v[0-9]+.[0-9]+.[0-9]+*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
release:
name: Release ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# Specify which operating systems these jobs are to run on
matrix:
include:
- os: ubuntu-latest
profile: release+static
target: x86_64-unknown-linux-musl
needs_musl: true
tar: tar
- os: ubuntu-latest
profile: release+static+aarch64
target: aarch64-unknown-linux-musl
needs_musl: true
tar: tar
- os: macos-11
profile: release+mac
target: x86_64-apple-darwin
tar: gtar
- os: macos-11
profile: release+mac+aarch64
target: aarch64-apple-darwin
tar: gtar
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Setup cargo make
uses: davidB/rust-cargo-make@v1
- name: Store git tag vars
shell: bash
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Install musl tools
if: matrix.needs_musl
run: >-
sudo apt-get install
clang
llvm
musl-tools
gcc-aarch64-linux-gnu
g++-aarch64-linux-gnu
binutils-aarch64-linux-gnu
qemu-user
- name: Install stable Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
default: true
- uses: Swatinem/rust-cache@v2
- name: Build
shell: bash
run: cargo make --profile ${{ matrix.profile }} build
- name: Package release
shell: bash
run: |
${{ matrix.tar }} -C target/${{ matrix.target }}/release -czf esthri-${{ env.VERSION }}-${{ matrix.target }}.tar.gz esthri${{ matrix.suffix }}
- name: Upload Release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "*.tar.gz"
tag: ${{ github.ref }}
overwrite: true
file_glob: true
post_release:
name: Post release
needs: [ release ]
runs-on: ubuntu-latest
steps:
- name: Store git tag vars
shell: bash
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Hook into package registry
uses: swift-nav/swift-cli-publisher@v2
env:
DL_LINUX_aarch64: "esthri-${{ env.VERSION }}-aarch64-unknown-linux-musl.tar.gz"
DL_LINUX_x86_64: "esthri-${{ env.VERSION }}-x86_64-unknown-linux-musl.tar.gz"
DL_MAC_aarch64: "esthri-${{ env.VERSION }}-aarch64-apple-darwin.tar.gz"
DL_MAC_x86_64: "esthri-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz"
DL_WIN: "" # Do not publish
TOOLS: "esthri"
with:
token: ${{ secrets.GH_TOKEN }}
gh-name: ${{ secrets.GH_NAME }}
gh-email: ${{ secrets.GH_EMAIL }}