From 5d726e6f528792b1d484171e9beaf6d80f751d2e Mon Sep 17 00:00:00 2001 From: hhs629629 Date: Thu, 28 Sep 2023 12:08:46 +0900 Subject: [PATCH] cicd: introduce CI --- .github/workflows/ci.yaml | 51 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..a321446 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,51 @@ +name: CI + +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + +env: + CARGO_TERM_COLOR: always + +jobs: + format: + name: rustfmt + runs-on: [windows-latest, macos-latest, ubuntu-latest] + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Install toolchain + uses: dtolnay/rust-toolchain@1.72.0 + with: + components: rustfmt + + - name: Cache dependencies + uses: Swatinem/rust-cache@v2 + + - name: Run cargo fmt + run: cargo fmt --all -- --check + + test: + name: cargo test + runs-on: [windows-latest, macos-latest, ubuntu-latest] + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Cache dependencies + uses: Swatinem/rust-cache@v2 + + - name: Install cargo-nextest + uses: baptiste0928/cargo-install@v2 + with: + crate: cargo-nextest + locked: true + cache-key: ${{ runner.arch }}_${{ runner.os }} + + - name: Run tests + run: cargo nextest run --all-targets --all-features