diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e57b03f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: Continuous Integration + +# run for pull requests and pushes to master branch +on: + push: + branches: + - 'master' + pull_request: + +# always use pretty colors +env: + CARGO_TERM_COLOR: always + +jobs: + # check formatting (use nightly rustfmt) + formatting: + name: Check Formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: rustup update nightly + - run: rustup component add rustfmt --toolchain nightly + - run: cargo default nightly + - run: cargo fmt --check + + # check style (using clippy) + style: + name: Check Style + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@4 + - run: cargo clippy --check + + # build and test code + build_and_test: + name: Rust project - latest + runs-on: ubuntu-latest + strategy: + matrix: + toolchain: + - stable + - beta + - nightly + steps: + - uses: actions/checkout@v4 + - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} + - run: cargo build --verbose + - run: cargo test --verbose