name: Build
on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
jobs:
build:
timeout-minutes: 5
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.64.0
- name: Check default features
uses: actions-rs/cargo@v1
with:
command: check
- name: Check all features
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features
publish:
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.64.0
- name: Publish lets_expect_core
uses: nick-fields/retry@v2
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
with:
timeout_seconds: 300
max_attempts: 5
command: cd lets_expect_core && cargo publish --token $CARGO_REGISTRY_TOKEN
- name: Publish lets_expect_assertions
uses: nick-fields/retry@v2
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
with:
timeout_seconds: 300
max_attempts: 5
command: cd lets_expect_assertions && cargo publish --token $CARGO_REGISTRY_TOKEN
- name: Publish lets_expect_macro
uses: nick-fields/retry@v2
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
with:
timeout_seconds: 300
max_attempts: 5
command: cd lets_expect_macro && cargo publish --token $CARGO_REGISTRY_TOKEN
- name: Publish lets_expect
uses: nick-fields/retry@v2
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
with:
timeout_seconds: 300
max_attempts: 5
command: cargo publish --token $CARGO_REGISTRY_TOKEN
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true