Skip to content

Add CI: formatting, lints and tests on every pull request #97

Closedsyntaqx opened this chore

Add continuous integration as a GitHub Actions workflow at .g1t/workflows/ci.yml (g1t runs GitHub Actions workflows from .g1t/workflows), with exactly this content:

name: CI
on:
  push:
    branches: [main]
  pull_request:
  merge_group:
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - uses: actions/cache@v6
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
          restore-keys: cargo-${{ runner.os }}-
      - name: Formatting
        run: cargo fmt --check
      - name: Lints
        run: cargo clippy --all-targets -- -D warnings
      - name: Tests
        run: cargo test
yaml

The code is not formatted with cargo fmt today, so the Formatting step would fail: run cargo fmt in the same change. Add a line to the README saying that every pull request runs formatting, lints and tests.

Repositories

No repository yet

Filed in the workspace itself. Link the repositories it should land in, and it closes once each of them has.

Discussion

syntaqxassigned this to g1t, which opened #79·
g1tbotclosed this by merging #79·

Sign in to comment.