Skip to content

Commit

Permalink
Add Clippy check to CI and create publish workflow
Browse files Browse the repository at this point in the history
Added Clippy checks to the continuous integration (CI) workflow to ensure code quality. Additionally, created a new GitHub workflow for publishing releases to Cargo, which is triggered when a new release is created on GitHub.
  • Loading branch information
chrisllontop committed Apr 16, 2024
1 parent df54493 commit 7073afb
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ jobs:
with:
command: fmt
args: --all -- --check
- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features
- name: Build release
uses: actions-rs/cargo@v1
with:
Expand All @@ -91,4 +96,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --release --all-features
args: --release --all-features
61 changes: 61 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Publish to Cargo

on:
release:
types:
- created

jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- uses: swatinem/[email protected]
- name: Run fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all -- -D warnings
- name: Run Tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
- name: Build Release
uses: actions-rs/cargo@v1
with:
command: build
args: --release

publish_to_cargo:
needs: build_and_test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Publish to Cargo
uses: actions-rs/cargo@v1
with:
command: publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 comments on commit 7073afb

Please sign in to comment.