name: CI
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy -- -D warnings
test:
name: Test (${{ matrix.os }})
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test
convco:
name: Conventional commits
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- run: |
curl -sSfL https://github.com/convco/convco/releases/latest/download/convco-ubuntu.zip -o /tmp/convco.zip
unzip -o /tmp/convco.zip -d /usr/local/bin
chmod +x /usr/local/bin/convco
- run: convco check ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
shellcheck:
name: ShellCheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: shellcheck install.sh
ci:
name: CI
if: always()
needs: [fmt, clippy, test, convco, shellcheck]
runs-on: ubuntu-latest
steps:
- name: Check results
run: |
results="${{ join(needs.*.result, ' ') }}"
for r in $results; do
if [ "$r" = "failure" ] || [ "$r" = "cancelled" ]; then
exit 1
fi
done