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 5786cf6..1f7b86c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -118,4 +118,4 @@ jobs: continue-on-error: true # Set until the lints are fixed separately with: command: clippy - args: -- -D warnings + args: -- -D warnings \ No newline at end of file