From e1a32ba46cd50d8d465b705e1aba038fc1b0d833 Mon Sep 17 00:00:00 2001 From: kubectl Date: Sat, 28 Sep 2024 19:07:03 +0200 Subject: [PATCH] Add workflow to check PRs (build/test/check_fmt) (#18) * fix: add ci * fix: remove rust-toolchain.toml - deemed unessecary * Check Compile even when formatting is wrong * Update sccache-action to 0.0.6 * Allow manual runs --------- Co-authored-by: C0D3 M4513R <28912031+C0D3-M4513R@users.noreply.github.com> --- .github/workflows/check_pr.yaml | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/check_pr.yaml diff --git a/.github/workflows/check_pr.yaml b/.github/workflows/check_pr.yaml new file mode 100644 index 0000000..a04ef3b --- /dev/null +++ b/.github/workflows/check_pr.yaml @@ -0,0 +1,36 @@ +name: CI Check + +on: + pull_request: + branches: + - main + push: + branches: + - main + workflow_dispatch: + +jobs: + build_and_test: + runs-on: ubuntu-latest + name: Build and Test + steps: + - uses: actions/checkout@v4 + - uses: moonrepo/setup-rust@v1 + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.6 + - name: Configure sccache env var and set build profile to ephemeral build + run: | + echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV + echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV + - run: cargo build --all + - run: cargo test --all + + check-fmt: + runs-on: ubuntu-latest + name: Check formatting + steps: + - uses: actions/checkout@v4 + - uses: moonrepo/setup-rust@v1 + with: + components: rustfmt + - run: cargo fmt --all -- --check