Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(CI): allow push to crates.io for version tag #53

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 141 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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