crunchy-cli/.github/workflows/ci.yml
2022-12-16 22:42:22 +01:00

88 lines
2.2 KiB
YAML

name: ci
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
toolchain: x86_64-unknown-linux-musl
platform: linux
command: sudo apt install -y musl-tools
ext:
- os: windows-latest
toolchain: x86_64-pc-windows-gnu
platform: windows
command:
ext: .exe
- os: macos-latest
toolchain: x86_64-apple-darwin
platform: darwin
command:
ext:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Additional command
run: ${{ matrix.command }}
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.toolchain }}
default: true
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --release --all-features
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: crunchy-cli_${{ matrix.platform }}
path: ./target/release/crunchy-cli${{ matrix.ext }}
if-no-files-found: error
- name: Upload manpages artifact
uses: actions/upload-artifact@v3
with:
name: manpages
path: ./target/release/manpages
if-no-files-found: error
- name: Upload completions artifact
uses: actions/upload-artifact@v3
with:
name: completions
path: ./target/release/completions
if-no-files-found: error