From fba34265feac0f80c59781ddb420bc2a922768e2 Mon Sep 17 00:00:00 2001 From: tiye Date: Fri, 5 Jul 2024 02:30:42 +0800 Subject: [PATCH] reuse github workflows --- .github/workflows/publish.yaml | 24 +++++++++++++++++++++++ .github/workflows/test.yaml | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 .github/workflows/publish.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..13f6f1f --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,24 @@ +on: + release: + types: [created] + +name: Publish to crate + +jobs: + publish: + name: Publish to cargo + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + + - uses: Swatinem/rust-cache@v2 + + - run: cargo test + + - uses: katyo/publish-crates@v1 + with: + registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..22514b0 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,35 @@ +on: + push: + branches: + - main + + pull_request: {} + +name: Test + +jobs: + build_and_test: + name: Test + runs-on: ubuntu-latest + + permissions: + checks: write + contents: read + pull-requests: write + + steps: + - uses: actions/checkout@v3 + + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + components: clippy + + - uses: Swatinem/rust-cache@v2 + + - run: cargo run -- wd + + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features