From 7b6041989e57382c79b8e579ba62a3ab3db0b1df Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 11 Mar 2025 18:05:17 -0400 Subject: [PATCH] ci: add build and lint workflows --- .github/workflows/build.yaml | 37 ++++++++++++++++++++ .github/workflows/lint.yaml | 68 ++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..061d15d --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,37 @@ +name: Build +on: + push: + paths: + - "**.rs" + - "Cargo.*" + pull_request: + workflow_dispatch: + +jobs: + errornowatcher: + name: errornowatcher + runs-on: ubuntu-24.04 + + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Install build dependencies + run: sudo apt install -y libluajit-5.1-dev mold + + - name: Set up build cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: build-${{ runner.os }}-${{ hashFiles('Cargo.*') }} + + - name: Switch to nightly toolchain + run: rustup default nightly + + - name: Build in release mode + run: cargo build --release diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..ef716eb --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,68 @@ +name: Lint +on: + push: + paths: + - "**.rs" + - "Cargo.*" + pull_request: + workflow_dispatch: + +jobs: + cargo-toml: + name: Cargo.toml + runs-on: ubuntu-24.04 + + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Install taplo + uses: uncenter/setup-taplo@v1 + + - name: Run taplo lint + run: taplo lint Cargo.toml + + - name: Run taplo fmt + if: always() + run: taplo fmt --check Cargo.toml + + rust: + name: Rust + runs-on: ubuntu-24.04 + + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Install build dependencies + run: sudo apt install -y libluajit-5.1-dev mold + + - name: Set up build cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: build-${{ runner.os }}-${{ hashFiles('Cargo.*') }} + + - name: Switch to nightly toolchain + run: rustup default nightly + + - name: Install components + run: rustup component add clippy rustfmt + + - name: cargo clippy + run: >- + cargo clippy -- -D clippy::pedantic + -A clippy::missing_errors_doc + -A clippy::missing_panics_doc + -A clippy::must_use_candidate + -A clippy::needless-pass-by-value + -A clippy::unnecessary-wraps + + - name: cargo fmt + if: always() + run: cargo fmt --check