chore: fix some clippy (#925) #2041
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: {} | |
jobs: | |
check: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
package: | |
- name: poem-derive | |
path: poem-derive | |
- name: poem | |
path: poem | |
- name: poem-openapi-derive | |
path: poem-openapi-derive | |
- name: poem-openapi | |
path: poem-openapi | |
- name: poem-lambda | |
path: poem-lambda | |
- name: poem-grpc | |
path: poem-grpc | |
services: | |
redis: | |
image: redis:5.0.7 | |
ports: | |
- 6379:6379 | |
options: --entrypoint redis-server | |
mysql: | |
image: mysql:8.0 | |
ports: | |
- 3306:3306 | |
options: -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_DATABASE=test_poem_sessions | |
postgres: | |
image: postgres:14 | |
ports: | |
- 5432:5432 | |
options: -e POSTGRES_PASSWORD=123456 -e POSTGRES_DB=test_poem_sessions | |
steps: | |
- uses: actions/checkout@v3 | |
# Use nightly Rust to check the format | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
components: rustfmt, clippy | |
override: true | |
- name: Check Format | |
run: cargo fmt --all -- --check | |
# Switch to stable Rust | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
override: true | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Install Protoc | |
if: matrix.package.name == 'poem-grpc' || matrix.package.name == 'poem-openapi' | |
uses: arduino/setup-protoc@v1 | |
# Do tests | |
- name: Check With Clippy | |
run: cargo clippy --all-features | |
working-directory: ${{ matrix.package.path }} | |
- name: Run Tests | |
run: cargo test --all-features | |
working-directory: ${{ matrix.package.path }} | |
check-examples: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
# Use nightly Rust to check the format | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
components: rustfmt, clippy | |
- name: Check Format | |
run: cargo fmt --all -- --check | |
working-directory: examples | |
# Switch to stable Rust | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Check With Clippy | |
run: cargo clippy | |
working-directory: examples |