From 6f77fb90085b47164772c7e98d76d77736b0545b Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 5 Jul 2024 21:57:00 +0000 Subject: [PATCH] Add CI (#1) Reviewed-on: https://msrd0.dev/spielemarmelade/turtlegame/pulls/1 Co-authored-by: Dominic Co-committed-by: Dominic --- .forgejo/workflows/rust.yml | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .forgejo/workflows/rust.yml diff --git a/.forgejo/workflows/rust.yml b/.forgejo/workflows/rust.yml new file mode 100644 index 0000000..84e04f9 --- /dev/null +++ b/.forgejo/workflows/rust.yml @@ -0,0 +1,68 @@ +name: Rust +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + rustfmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: https://github.com/dtolnay/rust-toolchain@nightly + with: + components: rustfmt + - run: cargo fmt --all -- --check + + clippy: + runs-on: ubuntu-latest + steps: + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + g++ pkg-config libx11-dev libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev + - uses: actions/checkout@v4 + - uses: https://github.com/dtolnay/rust-toolchain@1.79.0 + id: rust-toolchain + with: + components: clippy + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/git + ~/.cargo/registry + target + key: "${{runner.os}} Rust+Clippy ${{steps.rust-toolchain.outputs.cachekey}}" + - run: cargo clippy --locked --all-targets -- -D warnings + env: + RUSTFLAGS: "-D warnings" + + build: + runs-on: ubuntu-latest + steps: + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + g++ pkg-config libx11-dev libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev + - uses: actions/checkout@v4 + - uses: https://github.com/dtolnay/rust-toolchain@stable + id: rust-toolchain + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/git + ~/.cargo/registry + target + key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}" + - run: mkdir .ci-destdir + - run: cargo install --path . --locked --root .ci-destdir + - run: find .ci-destdir + - uses: forgejo/upload-artifact@v3 + with: + name: Powercreep + path: + .ci-destdir/*