Skip to content

CI

CI #2

Workflow file for this run

name: CI
on:
push:
branches: [ "master" ]
paths-ignore:
- "/README.md"
- "/LICENSE"
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
outputs:
publish: ${{ steps.publish.outputs.publish }}
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Do we publish?
id: publish
run: |
if (git show -- Cargo.toml | grep -q '+version') then echo 'publish=true';else echo 'publish=false'; fi >> $GITHUB_OUTPUT
test:
name: coverage
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v4
- 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@v4
with:
fail_ci_if_error: true
token: ${{secrets.CODECOV_TOKEN}}
publish:
needs: build
if: ${{ needs.build.outputs.publish == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish
run: cargo publish --verbose --token ${{ secrets.CARGO_REGISTRY_TOKEN }}