ci: add macos & windows runners for testing #1108
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: | |
pull_request: | |
merge_group: | |
push: | |
branches: [ main ] | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
msrv: | |
name: Build with MSRV | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Get current MSRV from Cargo.toml | |
id: current_msrv | |
run: | | |
msrv=$(cat Cargo.toml | grep rust-version | sed 's/.* = "//; s/"//') | |
echo "msrv=$msrv" >> $GITHUB_OUTPUT | |
- name: Setup Rust version | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{steps.current_msrv.outputs.msrv}} | |
- uses: Swatinem/[email protected] | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-hack | |
- name: Build | |
run: cargo hack build --each-feature --keep-going | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: | |
- stable | |
- nightly | |
os: | |
- name: Ubuntu | |
version: ubuntu-latest | |
- name: Windows | |
version: windows-latest | |
- name: MacOS | |
version: macos-latest | |
name: Test - ${{ matrix.os.name }} (${{ matrix.toolchain }}) | |
runs-on: ${{ matrix.os.version }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
# Install NASM on Windows (because of aws-lc-rs requirements) | |
- uses: ilammy/setup-nasm@v1 | |
if: ${{ matrix.os.name == 'Windows' }} | |
# we need this to simplify build of `testimages` | |
- name: Switch to Linux containers | |
if: ${{ matrix.os.name == 'Windows' }} | |
run: | | |
$Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchDaemon | |
- name: Setup Docker MacOS | |
if: runner.os == 'MacOS' | |
run: | | |
brew install colima | |
brew services start colima | |
brew install docker | |
colima start | |
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock | |
- uses: Swatinem/rust-cache@v2 | |
- name: Setup Rust - ${{ matrix.toolchain }} | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
- name: Generate Cargo.lock for cache | |
uses: actions-rs/cargo@v1 | |
with: | |
command: generate-lockfile | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-hack | |
- name: Tests | |
run: cargo hack test --each-feature --clean-per-run | |
fmt: | |
name: Rustfmt check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
components: rustfmt | |
override: true | |
- name: Rustfmt check | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
clippy: | |
name: Clippy check | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: | |
- stable | |
- nightly | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: clippy | |
- name: Clippy check | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-features | |
prlint: | |
name: PR name check | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: CondeNast/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
# For PRs we gonna use squash-strategy, so commits names not so matter | |
ignoreCommits: "true" |