From 1990c29393ff50fa0e86e692069eba5c8f22a95e 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..872677b --- /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 -- ip -d + + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features