From 82456393ad7d05597b236cf3a403875b9bcb02de Mon Sep 17 00:00:00 2001 From: Kikuo Emoto Date: Mon, 4 Mar 2024 07:50:42 +0900 Subject: [PATCH] chore: Introduce GitHub Actions workflow for linting and building (codemonger-io/xray-lite#1) * chore: add GitHub Actions workflow to lint and build `.github/workflows/build.yml` runs `rustfmt` and `cargo test` when commits are pushed to the repository, or a PR is made to `main` branch. --- .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..488661b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: Lint and build + +on: + push: + pull_request: + branches: + - main + +jobs: + rustfmt: + name: rustfmt + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v4 + - name: Install Rust toolchain (rustfmt) + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - name: Check format + run: cargo fmt --all -- --check + + test: + name: Build and test + strategy: + matrix: + os: [ubuntu-latest] + toolchain: [stable, nightly] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout the code + uses: actions/checkout@v4 + - name: Install Rust toolchain ${{ matrix.toolchain }} + uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ matrix.toolchain }} + - name: Run tests + run: cargo test --release -vv