name: Lint, Build and Test
on:
pull_request:
branches:
- "master"
jobs:
build_and_test:
runs-on: ubuntu-latest
needs: [lint]
if: success() || failure() steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build workspace
run: cargo build --verbose --workspace
- name: Test workspace
run: cargo test --verbose --workspace --no-fail-fast --tests
- name: Test docs
run: cargo test --verbose --workspace --no-fail-fast --doc
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Lint
id: lint
run: cargo fmt
- name: Detect changes
id: changes
run: git diff HEAD --exit-code
if: steps.lint.outcome == 'success'
continue-on-error: true - name: "Setup Git Credentials"
run: |
git config --global user.name "Github Action Bot: Formatting"
git config --global user.email "<>"
if: steps.changes.outcome == 'success'
- name: "Commit"
run: |
"git add ."
"git commit -m 'chore: fmt'"
if: steps.changes.outcome == 'success'
- name: "Push"
run: git push
if: steps.changes.outcome == 'success'