Fix macOS version #53
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: CICD | |
env: | |
MIN_SUPPORTED_RUST_VERSION: "1.56.1" | |
CICD_INTERMEDIATES_DIR: "_cicd-intermediates" | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
jobs: | |
min_version: | |
name: Minimum supported rust version | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Install rust toolchain (v${{ env.MIN_SUPPORTED_RUST_VERSION }}) | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }} | |
default: true | |
profile: minimal # minimal component installation (ie, no documentation) | |
components: clippy, rustfmt | |
- name: Ensure `cargo fmt` has been run | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: -- --check | |
- name: Run clippy (on minimum supported rust version to prevent warnings we can't fix) | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all-targets --all-features -- --allow clippy::unknown_clippy_lints | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
documentation: | |
name: Documentation | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v2 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
profile: minimal | |
- name: Check documentation | |
env: | |
RUSTDOCFLAGS: -D warnings | |
uses: actions-rs/cargo@v1 | |
with: | |
command: doc | |
args: --no-deps --document-private-items --all-features | |
build: | |
name: ${{ matrix.job.target }} (${{ matrix.job.os }}) | |
runs-on: ${{ matrix.job.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
- { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } | |
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true } | |
- { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } | |
- { target: i686-pc-windows-msvc , os: windows-2019 } | |
- { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } | |
- { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } | |
- { target: x86_64-apple-darwin , os: macos-12 } | |
- { target: x86_64-pc-windows-gnu , os: windows-2019 } | |
- { target: x86_64-pc-windows-msvc , os: windows-2019 } | |
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 } | |
- { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Install prerequisites | |
shell: bash | |
run: | | |
case ${{ matrix.job.target }} in | |
arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; | |
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; | |
esac | |
- name: Extract crate information | |
shell: bash | |
run: | | |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV | |
echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV | |
echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.job.target }} | |
override: true | |
profile: minimal # minimal component installation (ie, no documentation) | |
- name: Show version information (Rust, cargo, GCC) | |
shell: bash | |
run: | | |
gcc --version || true | |
rustup -V | |
rustup toolchain list | |
rustup default | |
cargo -V | |
rustc -V | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.job.use-cross }} | |
command: build | |
args: --release --target=${{ matrix.job.target }} | |
- name: Set testing options | |
id: test-options | |
shell: bash | |
run: | | |
# test only library unit tests for arm-type targets | |
unset CARGO_TEST_OPTIONS | |
unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib ${PROJECT_NAME}" ;; esac; | |
echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.job.use-cross }} | |
command: test | |
args: --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} -- --nocapture --test-threads 1 |