Skip to content

Fix build on Windows and reinstate to CI #352

Fix build on Windows and reinstate to CI

Fix build on Windows and reinstate to CI #352

Workflow file for this run

on:
pull_request:
push:
branches:
- main
workflow_dispatch:
name: Continuous integration
env:
CARGO_INCREMENTAL: 0
jobs:
ci-linux:
name: Build and test (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: rust-toolchain
with:
components: rust-src
- name: Cache cargo registry and git trees
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache target dir
uses: actions/cache@v4
# https://github.com/actions/cache/blob/main/examples.md#rust---cargo
with:
path: |
target/
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
- run: cargo build
- run: cargo test
rustfmt:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo registry and git trees
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache target dir
uses: actions/cache@v4
with:
path: |
target/
key: ${{ runner.os }}-cargo-clippy-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
- run: cargo clippy --target x86_64-unknown-linux-gnu
ci-mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry and git trees
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache target dir
uses: actions/cache@v4
with:
path: |
target/
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
- run: cargo build
# Intermittent test failures have been observed on mac. Running with only one thread seems to
# help. The test failures appear to be failing to infer a variable's type, so possibly
# something related to our use of rust-analyzer.
- run: cargo test -- --test-threads 1
ci-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry and git trees
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache target dir
uses: actions/cache@v4
with:
path: |
target/
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
- run: cargo build
- run: cargo test -- --test-threads 1