add shell specific command execution #31
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: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
tags: ["v**"] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
rust: [stable] | |
include: | |
- os: ubuntu-latest | |
sccache-path: /home/runner/.cache/sccache | |
target: x86_64-unknown-linux-gnu | |
suffix: '' | |
- os: macos-latest | |
sccache-path: /Users/runner/Library/Caches/Mozilla.sccache | |
target: x86_64-apple-darwin | |
suffix: '' | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
suffix: .exe | |
env: | |
RUST_BACKTRACE: full | |
RUSTV: ${{ matrix.rust }} | |
SCCACHE_CACHE_SIZE: 2G | |
SCCACHE_DIR: ${{ matrix.sccache-path }} | |
# SCCACHE_RECACHE: 1 # Uncomment this to clear cache, then comment it back out | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install sccache (ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
env: | |
LINK: https://github.com/mozilla/sccache/releases/download | |
SCCACHE_VERSION: 0.2.13 | |
run: | | |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl | |
mkdir -p $HOME/.local/bin | |
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz | |
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Install sccache (macos) | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew update | |
brew install sccache | |
- name: Install cargo-make (macos and ubuntu) | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
env: | |
RUSTC_WRAPPER: sccache | |
run: cargo install --debug cargo-make | |
- name: Install cargo-make (windows) | |
if: matrix.os == 'windows-latest' | |
run: cargo install --debug cargo-make | |
- name: Cache cargo registry | |
uses: actions/cache@v2 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo- | |
- name: Save sccache (macos and ubuntu) | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
uses: actions/cache@v2 | |
continue-on-error: false | |
with: | |
path: ${{ matrix.sccache-path }} | |
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-sccache- | |
- name: Run ci-flow (macos and ubuntu) | |
if: matrix.os == 'macos-latest' | |
env: | |
RUSTC_WRAPPER: sccache | |
run: cargo make ci-flow | |
- name: Run ci-flow (ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
env: | |
RUSTC_WRAPPER: sccache | |
run: cargo make ci-flow-ubuntu | |
- name: Run ci-flow (windows) | |
if: matrix.os == 'windows-latest' | |
run: cargo make ci-flow-windows | |
- name: Create/upload gh releases | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ./target/release/${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}${{ matrix.suffix }} | |
body_path: ./CHANGELOG.md | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Stop sccache server | |
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
run: sccache --stop-server || true | |