Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
Signed-off-by: Keming <kemingy94@gmail.com>
  • Loading branch information
kemingy committed Oct 17, 2024
1 parent 7e902db commit 8e05433
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: crates.io Publish

on:
release:
types: [created]
workflow_dispatch:

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
publish:
name: "Publish Rust Package"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Publish Crates
env:
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
run: |
cargo login $CARGO_TOKEN
cargo publish
50 changes: 50 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Rust

on:
push:
branches: [ "main" ]
paths:
- '.github/workflows/rust.yml'
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
pull_request:
branches: [ "main" ]
paths:
- '.github/workflows/rust.yml'
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
merge_group:

env:
CARGO_TERM_COLOR: always

jobs:
lint:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install lint tools
run: rustup component add rustfmt clippy
- name: Lint
run: |
cargo fmt -- --check
cargo clippy -- -D warnings
test:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Test
run: cargo test

0 comments on commit 8e05433

Please sign in to comment.