Skip to content

Setup CI #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 30, 2024
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CI

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

jobs:
test:
name: Run tests
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
# Keep this in sync with `rust-toolchain.toml`.
toolchain: nightly-2024-08-21
components: rustc-dev, llvm-tools-preview

- name: Run tests
run: cargo test --workspace

clippy:
name: Check with Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
# Keep this in sync with `rust-toolchain.toml`.
toolchain: nightly-2024-08-21
components: clippy, rustc-dev, llvm-tools-preview

- name: Run Clippy
run: cargo clippy --workspace -- -D warnings

rustfmt:
name: Check with rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
# Keep this in sync with `rust-toolchain.toml`.
toolchain: nightly-2024-08-21
components: rustfmt, rustc-dev, llvm-tools-preview

- name: Run rustfmt
run: cargo fmt --all --check
2 changes: 2 additions & 0 deletions bevy_lint/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
use crate::callback::BevyLintCallback;

/// This is the main entrypoint into the driver, exported so that `bevy_cli` may call it.
// TODO(BD103): Make this return a proper error type.
#[allow(clippy::result_unit_err)]
pub fn main() -> Result<(), ()> {
let args: Vec<String> = dbg!(std::env::args().skip(1).collect());

Expand Down
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# If you modify this file, please also update `ci.yml` so that Github Actions will install the
# correct version of Rust.

[toolchain]
# Writing custom lints requires using nightly Rust. We pin to a specific version of nightly version
# so that builds are reproducible.
Expand Down