1
0
mirror of https://github.com/mre/mos6502.git synced 2024-12-01 11:51:51 +00:00
mre-mos6502/.github/workflows/ci.yml
2023-04-20 17:42:18 +02:00

104 lines
2.4 KiB
YAML

name: CI
on:
repository_dispatch:
workflow_dispatch:
push:
branches:
- master
tags:
- "*.*.*"
pull_request:
types:
- opened
- synchronize
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Run cargo fmt (check if all code is rustfmt-ed)
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run cargo clippy (deny warnings)
uses: actions-rs/cargo@v1
with:
command: clippy
# --all-targets makes it lint tests too
args: --all-targets --all-features -- -D warnings
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install cargo-audit
uses: actions-rs/install@v0.1
with:
crate: cargo-audit
version: latest
use-tool-cache: true
- name: Run cargo-audit
run: cargo audit --deny yanked
publish-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: cargo publish
uses: actions-rs/cargo@v1
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
with:
command: publish
args: --dry-run
publish:
if: startsWith(github.ref, 'refs/tags/')
needs:
- test
- lint
- audit
- publish-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: cargo publish
uses: actions-rs/cargo@v1
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
with:
command: publish