From 4c20ef5dc7b46e882dab7c05983c7de42ee77731 Mon Sep 17 00:00:00 2001 From: baoyachi Date: Wed, 23 Feb 2022 00:56:06 +0800 Subject: [PATCH] update github workflows ci --- .github/workflows/check.yml | 44 +++++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 24 ------------------- 2 files changed, 44 insertions(+), 24 deletions(-) delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index db33f6d..9c0dc1c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -69,3 +69,47 @@ jobs: override: true - name: Build on nightly run: cargo build --release + + test: + strategy: + matrix: + rust: [stable, beta, nightly] + runs-on: ubuntu-latest + steps: + - name: Setup Rust + uses: hecrj/setup-rust-action@v1 + with: + rust-version: ${{ matrix.rust }} + - name: Install Tarpaulin + uses: actions-rs/install@v0.1 + with: + crate: cargo-tarpaulin + version: 0.14.2 + use-tool-cache: true + - name: Checkout + uses: actions/checkout@v2 + - name: Test + run: | + cargo test --all-features + cargo test --examples + - name: Coverage + if: matrix.rust == 'stable' + run: cargo tarpaulin -o Lcov --output-dir ./coverage + - name: Coveralls + if: matrix.rust == 'stable' + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + publish-crate: + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + needs: [test] + steps: + - name: Set up Rust + uses: hecrj/setup-rust-action@v1 + - uses: actions/checkout@v2 + - name: Publish + shell: bash + run: | + cargo publish --token ${{ secrets.CRATES_GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index b9e3741..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Deploy -on: - push: - tags: - - "*" - -jobs: - # Publish starship to Crates.io - cargo_publish: - name: Publish Cargo Package - runs-on: ubuntu-latest - steps: - - name: Setup | Checkout - uses: actions/checkout@v2 - - - name: Setup | Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - - - name: Build | Publish - run: cargo publish --token ${{ secrets.CRATES_GITHUB_TOKEN }} \ No newline at end of file