name: CI
on:
push:
tags:
- '*'
branches:
- main
- 'ci-*'
- 'rc-*'
jobs:
build:
runs-on: ubuntu-latest
container:
image: rust
steps:
- uses: actions/checkout@v4
- name: Configure toolchain
run: rustup default nightly
- name: Build with all features
run: cargo build --all-features
test:
runs-on: ubuntu-latest
container:
image: rust
steps:
- uses: actions/checkout@v4
- name: Configure toolchain
run: rustup default nightly
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- name: Build and Test
run: cargo tarpaulin --verbose --out html --engine llvm
- name: Emit codecov html
uses: actions/upload-artifact@v4
with:
name: codecov-report
path: tarpaulin-report.html
release:
needs: [build, test]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download codecov report
uses: actions/download-artifact@v4
with:
name: codecov-report
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: tarpaulin-report.html
name: ${{ github.ref_name }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
publish:
needs: [build, test]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: rust
steps:
- uses: actions/checkout@v4
- name: Configure toolchain
run: rustup default nightly
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}
publish-dry-run:
needs: [build, test]
if: startsWith(github.ref, 'refs/heads/rc-')
runs-on: ubuntu-latest
container:
image: rust
steps:
- uses: actions/checkout@v4
- name: Configure toolchain
run: rustup default nightly
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CRATES_TOKEN }} --dry-run