From 8bd1d292b60f9d26ddac283b2d7d2da88a410fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Andr=C3=A9s=20Dorado=20Su=C3=A1rez?= Date: Thu, 10 Oct 2024 20:58:18 -0500 Subject: [PATCH] feat: add some github actions --- .github/workflows/ci.yml | 84 +++++++++++++++++++++++++++++++++++ .github/workflows/lint-pr.yml | 20 +++++++++ 2 files changed, 104 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/lint-pr.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3637c56 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,84 @@ +name: Lint, check, clippy and test + +on: + push: + branches: [ main ] + pull_request: + types: [ opened, synchronize, reopened, ready_for_review ] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Check formatting + run: cargo fmt --all -- --check + + check: + needs: lint + runs-on: ubuntu-latest + steps: + - name: Setup Ubuntu dependencies + shell: bash + run: sudo apt update && sudo apt install -y protobuf-compiler + + - uses: actions/checkout@v4 + + - name: Rust Cache + uses: Swatinem/rust-cache@v2.7.3 + with: + cache-on-failure: true + cache-all-crates: true + key: check + + - name: Check Build + run: | + cargo check --release --locked --all-features --workspace + + clippy: + needs: lint + runs-on: ubuntu-latest + permissions: + checks: write + env: + SKIP_WASM_BUILD: 1 + steps: + - name: Setup Ubuntu dependencies + shell: bash + run: sudo apt update && sudo apt install -y protobuf-compiler + + - uses: actions/checkout@v4 + + - name: Rust Cache + uses: Swatinem/rust-cache@v2.7.3 + with: + cache-on-failure: true + cache-all-crates: true + key: check + + - name: Annotate with Clippy warnings + uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --release --locked --all-features --workspace + + test: + needs: lint + runs-on: ubuntu-latest + steps: + - name: Setup Ubuntu dependencies + shell: bash + run: sudo apt update && sudo apt install -y protobuf-compiler + + - uses: actions/checkout@v4 + + - name: Rust Cache + uses: Swatinem/rust-cache@v2.7.3 + with: + cache-on-failure: true + cache-all-crates: true + key: test + + - name: Run tests + run: cargo test --release --locked --all-features --workspace diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml new file mode 100644 index 0000000..047030c --- /dev/null +++ b/.github/workflows/lint-pr.yml @@ -0,0 +1,20 @@ +name: "Lint PR" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + pull-requests: read + +jobs: + lint: + name: Validate PR title for conventional commit compliance + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file