Automate publishing of crates #201
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: CI | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: ${{ matrix.platform }}-build | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fetch dependencies | |
run: cargo fetch | |
- name: Build in release mode | |
run: cargo build --release --frozen | |
test: | |
name: ${{ matrix.platform }}-test | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-latest, windows-latest, macos-latest] | |
env: | |
CLICOLOR_FORCE: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add Ruby for a test that requires it | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 | |
- name: Fetch dependencies | |
run: cargo fetch | |
- name: Build in test mode | |
run: cargo build --tests --frozen | |
- name: Make mask available globally (windows) | |
run: copy ./target/debug/mask.exe ~/.cargo/bin/ | |
if: matrix.platform == 'windows-latest' | |
- name: Make mask available globally (linux / mac) | |
run: cp ./target/debug/mask ~/.cargo/bin | |
if: matrix.platform != 'windows-latest' | |
- name: Run tests | |
run: cargo test --frozen | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Verify formatting is correct | |
run: cargo fmt --all -- --check |