updating cd #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build | |
run: cargo build --release --verbose | |
- name: rust-clippy-check | |
uses: actions-rs/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-targets --all-features -- -D warnings | |
- name: Run tests | |
run: cargo test --verbose | |
coverage: | |
runs-on: ubuntu-latest | |
needs: build | |
container: | |
image: xd009642/tarpaulin:develop-nightly | |
options: --security-opt seccomp=unconfined | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Generate code coverage | |
run: | | |
cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out xml | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{secrets.CODECOV_TOKEN}} | |
fail_ci_if_error: true | |
publish: | |
name: Publish | |
needs: coverage | |
runs-on: ubuntu-latest | |
if: ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' ) | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: install cargo release | |
run: if [ ! -f ~/.cargo/bin/cargo-release ]; then cargo install cargo-release; fi; | |
- name: cargo release | |
run: | | |
git config --global user.name 'Git Hub Actions (rust)' | |
git config --global user.email '[email protected] ' | |
cargo release patch --execute --no-confirm --token $CARGO_REGISTRY_TOKEN | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |