From c51a4dd84ca58e685f23e393dd77d311e4c9c111 Mon Sep 17 00:00:00 2001 From: fMeow Date: Sat, 3 Sep 2022 09:21:35 +0800 Subject: [PATCH 1/2] chore(CI): allow push to crates.io for version tag --- .github/workflows/tests.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5786cf6..2246142 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -119,3 +119,22 @@ jobs: with: command: clippy args: -- -D warnings + + publish: + name: Publish Package + needs: [check, lints, test] + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: login + env: + SUPER_SECRET: ${{ secrets.CARGO_TOKEN }} + run: cargo login "$SUPER_SECRET" + shell: bash + + - name: publish + uses: actions-rs/cargo@v1 + with: + command: publish \ No newline at end of file From c90aac4a3cac7e1753c4cb701e6f9ab764132e34 Mon Sep 17 00:00:00 2001 From: fMeow Date: Wed, 21 Sep 2022 21:41:15 +0800 Subject: [PATCH 2/2] chore(CI): manually trigger publish tagged commit --- .github/workflows/publish.yml | 141 ++++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 21 +---- 2 files changed, 142 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..74906d8 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,141 @@ +# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md +# +# While our "example" application has the platform-specific code, +# for simplicity we are compiling and testing everything on the Ubuntu environment only. +# For multi-OS testing see the `cross.yml` workflow. + +on: + workflow_dispatch + +name: Publish + +jobs: + check: + name: Check ${{ matrix.db_feature }} (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + rust: [stable] + db_feature: [db-sled, db-redis, db-mongo] + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + + - name: Run cargo check + uses: actions-rs/cargo@v1 + with: + command: check + args: --no-default-features --features=secure-auth,${{ matrix.db_feature }},crates-io-mirroring + + check_openid: + name: Check ${{ matrix.db_feature }} with OpenId (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + rust: [stable] + db_feature: [db-sled, db-redis, db-mongo] + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + + - name: Run cargo check + uses: actions-rs/cargo@v1 + with: + command: check + args: --no-default-features --features=secure-auth,${{ matrix.db_feature }},crates-io-mirroring,openid + + + test: + name: Test ${{ matrix.db_feature }} (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + rust: [stable] + db_feature: [db-sled, db-redis, db-mongo] + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + + - name: Run cargo test + uses: actions-rs/cargo@v1 + with: + command: test + args: --no-default-features --features=secure-auth,${{ matrix.db_feature }},crates-io-mirroring + + lints: + name: Lints (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt, clippy + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + continue-on-error: true # Set until the lints are fixed separately + with: + command: clippy + args: -- -D warnings + + publish: + name: Publish Package + needs: [check, lints, test] + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: login + env: + SUPER_SECRET: ${{ secrets.CARGO_TOKEN }} + run: cargo login "$SUPER_SECRET" + shell: bash + + - name: publish + uses: actions-rs/cargo@v1 + with: + command: publish \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2246142..1f7b86c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -118,23 +118,4 @@ jobs: continue-on-error: true # Set until the lints are fixed separately with: command: clippy - args: -- -D warnings - - publish: - name: Publish Package - needs: [check, lints, test] - if: startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: login - env: - SUPER_SECRET: ${{ secrets.CARGO_TOKEN }} - run: cargo login "$SUPER_SECRET" - shell: bash - - - name: publish - uses: actions-rs/cargo@v1 - with: - command: publish \ No newline at end of file + args: -- -D warnings \ No newline at end of file