ci: refactor ci workflow for homebrew updates and taps #24
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: | |
branches: | |
- ci | |
defaults: | |
run: | |
shell: bash # necessary for windows | |
jobs: | |
fmt: | |
name: cargo fmt | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
toolchain: [stable, nightly] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install stable toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: rustfmt | |
- name: cargo fmt | |
run: cargo fmt --all --check | |
clippy: | |
name: cargo clippy | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
toolchain: [stable, nightly] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: restore cache | |
uses: Swatinem/rust-cache@v2 | |
- name: install toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: clippy | |
- name: Show toolchain info | |
run: cargo --version --verbose | |
- name: Run Clippy | |
run: cargo clippy --all-targets -- -D warnings | |
continue-on-error: ${{ matrix.toolchain == 'nightly' }} | |
event-upload: | |
needs: test | |
name: Upload Test Event | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: test-event | |
path: ${{ github.event_path }} | |
test: | |
name: cargo test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
toolchain: [stable, nightly] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: restore cache | |
uses: Swatinem/rust-cache@v2 | |
- name: install stable toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Install Fonts | |
run: | | |
if [[ $RUNNER_OS == "macOS" ]]; then | |
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh && brew upgrade | |
brew install font-monaspace | |
brew install font-fira-code-nerd-font | |
brew install font-profont-nerd-font | |
brew install font-caskaydia-cove-nerd-font | |
brew install font-monaspace-nerd-font | |
brew install font-noto-nerd-font | |
elif [[ $RUNNER_OS == "Linux" ]]; then | |
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
brew upgrade | |
brew install --cask font-monaspace | |
brew install --cask font-fira-code-nerd-font | |
brew install --cask font-profont-nerd-font | |
brew install --cask font-caskaydia-cove-nerd-font | |
brew install --cask font-monaspace-nerd-font | |
brew install --cask font-noto-nerd-font | |
fi | |
- name: cargo test | |
run: cargo test --workspace --locked --all-features | |
build: | |
name: cargo build | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
toolchain: [stable, nightly] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build | |
run: cargo build --locked --release |