Skip to content

Commit

Permalink
feat: update CI configs & README (#39)
Browse files Browse the repository at this point in the history
* fix: update ci configs

* fix: update README

* fix: update README
  • Loading branch information
MuZhou233 authored Feb 22, 2024
1 parent 5f85509 commit 25435b2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 63 deletions.
47 changes: 15 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,54 +13,37 @@ jobs:
name: Auto Build CI
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [nightly, beta, stable]
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [nightly, beta, stable]

steps:
- name: Checkout Repository
uses: actions/checkout@master
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
override: true
run: |
rustup set profile minimal
rustup update --no-self-update ${{ matrix.rust }}
rustup component add --toolchain ${{ matrix.rust }} rustfmt clippy
rustup default ${{ matrix.rust }}
- name: Install Dependencies (for ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install libssl-dev
sudo apt-get install libssl-dev
- name: Cargo Build
uses: actions-rs/cargo@v1
with:
command: build
run: cargo build

- name: Cargo Test For tokio
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features runtime-tokio rt
run: cargo test --no-default-features --features runtime-tokio rt

- name: Cargo Test For async-std
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features runtime-async-std
run: cargo test --no-default-features --features runtime-async-std

- name: Cargo Clippy
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly'
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
run: cargo clippy -- -D warnings

- name: Cargo Fmt Check
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly'
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all -- --check
21 changes: 10 additions & 11 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Coverage
name: Code Coverage

on:
push:
Expand All @@ -15,21 +15,20 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@master
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
run: |
rustup set profile minimal
rustup update --no-self-update stable
rustup default stable
- name: Run cargo-tarpaulin
uses: actions-rs/[email protected]
with:
args: --out Xml
run: |
cargo install cargo-tarpaulin
cargo tarpaulin --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{secrets.CODECOV_TOKEN}}
20 changes: 7 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,19 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@master
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
run: |
rustup set profile minimal
rustup update --no-self-update stable
rustup default stable
- name: Cargo Login
uses: actions-rs/cargo@v1
with:
command: login
args: -- ${{ secrets.CARGO_TOKEN }}
run: cargo login ${{ secrets.CARGO_TOKEN }}

- name: Cargo Publish
uses: actions-rs/cargo@v1
with:
command: publish
run: cargo publish

- name: GitHub Release
id: create_release
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

[![Crates.io](https://img.shields.io/crates/d/actix-casbin-auth)](https://crates.io/crates/actix-casbin-auth)
[![Docs](https://docs.rs/actix-casbin-auth/badge.svg)](https://docs.rs/actix-casbin-auth)
[![CI](https://github.com/casbin-rs/actix-casbin-auth/workflows/CI/badge.svg)](https://github.com/casbin-rs/actix-casbin-auth/actions)
[![CI](https://github.com/casbin-rs/actix-casbin-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/casbin-rs/actix-casbin-auth/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/casbin-rs/actix-casbin-auth/branch/master/graph/badge.svg)](https://codecov.io/gh/casbin-rs/actix-casbin-auth)

[Casbin](https://github.com/casbin/casbin-rs) access control middleware for [actix-web](https://github.com/actix/actix-web) framework

## Install

Add it to `Cargo.toml`
Add dependencies

```rust
actix-rt = "1.1.1"
actix-web = "3.0.2"
actix-casbin= {version = "0.4.2", default-features = false, features = [ "runtime-async-std" ]}
actix-casbin-auth = {version = "0.4.4", default-features = false, features = [ "runtime-async-std" ]}
```bash
cargo add actix-rt
cargo add actix-web
cargo add actix-casbin --no-default-features --features runtime-async-std
cargo add actix-casbin-auth --no-default-features --features runtime-async-std
```

## Requirement
Expand Down

0 comments on commit 25435b2

Please sign in to comment.