ouch/.github/workflows/build-and-test.yml
2022-10-03 20:56:48 -04:00

75 lines
2.2 KiB
YAML

name: build-and-test
on: [push, pull_request]
jobs:
build:
name: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-apple-darwin
os: macos-latest
# - target: x86_64-pc-windows-gnu
# os: windows-latest
# ext: .exe
- target: x86_64-pc-windows-msvc
os: windows-latest
ext: .exe
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies (musl)
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
run: |
sudo apt-get update
sudo apt-get install help2man musl-tools
- name: Build and test on stable
run: |
rustup toolchain install stable --profile minimal -t ${{ matrix.target }}
cargo +stable build --target ${{ matrix.target }}
cargo +stable test --target ${{ matrix.target }}
- name: Release on nightly
run: |
rustup toolchain install nightly --profile minimal -t ${{ matrix.target }}
cargo +nightly build --release --target ${{ matrix.target }}
env:
OUCH_ARTIFACTS_FOLDER: artifacts
RUSTFLAGS: -C strip=symbols
- name: Upload bianry
uses: actions/upload-artifact@v2
with:
name: ouch-${{ matrix.target }}${{ matrix.ext }}
path: target/${{ matrix.target }}/release/ouch${{ matrix.ext }}
- name: Upload artifacts (musl)
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
uses: actions/upload-artifact@v2
with:
name: artifacts
path: artifacts
clippy-rustfmt:
name: clippy-rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: "Cargo: clippy, fmt"
run: |
rustup toolchain install stable --profile minimal -c clippy
rustup toolchain install nightly --profile minimal -c rustfmt
cargo +stable clippy -- -D warnings
cargo +nightly fmt -- --check