From fde3a93aeb1d30e476f2bba806840e22eeef0b2e Mon Sep 17 00:00:00 2001 From: Adam Cimarosti Date: Wed, 25 Sep 2024 09:43:27 +0100 Subject: [PATCH] CI attempt --- .github/workflows/ci.yml | 61 ++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 6 ---- 2 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9a68945 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + lint: + name: Linting and Formatting (Linux) + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + components: rustfmt, clippy + + - name: Run rustfmt + run: cargo fmt --check + + - name: Run clippy (all targets) + run: cargo clippy --all-targets -- -D warnings + + - name: Run clippy with no_std + run: cargo clippy --all-targets --features no_std -- -D warnings + + build_test: + name: Build and Test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest, macos-12] + features: ["", "--features=no_std"] + profile: ["", "--release"] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + + # Build + - name: Build + run: cargo build ${{ matrix.profile }} ${{ matrix.features }} + + # Test + - name: Test + run: cargo test ${{ matrix.profile }} ${{ matrix.features }} diff --git a/Cargo.toml b/Cargo.toml index 4b63f1b..b177fc8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,23 +3,17 @@ name = "alloc-checked" version = "0.1.0" edition = "2021" -# This crate requires nightly Rust due to alloc usage and other nightly features [package.metadata] rust-version = "nightly" [package.metadata.docs.rs] -# Specify to use the nightly toolchain for documentation generation rustdoc-args = ["--cfg", "nightly"] [features] -# By default, the crate compiles with the `std` feature enabled. default = [] - -# The `no_std` feature explicitly disables `std` and enables alloc and hashbrown. no_std = ["hashbrown"] [dependencies] -# `hashbrown` is only needed in `no_std` mode, so it's optional. hashbrown = { version = "0.14", optional = true } [dev-dependencies]