Skip to content

Commit

Permalink
feat: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-something committed Jan 31, 2025
1 parent 9491985 commit c0ffeec
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 56 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: audit check

on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'

jobs:
audit:
timeout-minutes: 10
name: 'Rust audit check'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rustsec/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
60 changes: 60 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: tests

on:
pull_request:
branches:
- dev
- main

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
fmt:
name: Format
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Cache cargo output
uses: Swatinem/rust-cache@v2
- name: Fmt check
run: cargo fmt --check

check:
name: Check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Cache cargo output
uses: Swatinem/rust-cache@v2
- name: Check
run: cargo check

clippy:
name: Clippy
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Cache cargo output
uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo clippy --no-deps --all-targets -- -D warnings

docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache cargo output
uses: Swatinem/rust-cache@v2
- name: Build docs
run: cargo doc --no-deps --all-features
env:
RUSTFLAGS: "-D warnings"
56 changes: 32 additions & 24 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,36 @@ env:
CARGO_TERM_COLOR: always

jobs:
crates-io:
name: crates-io
runs-on: ubuntu-latest
environment: prod
steps:
- uses: actions/checkout@v4
- run: cargo publish --token ${CRATES_API_TOKEN}
env:
CRATES_API_TOKEN: ${{ secrets.CRATES_API_TOKEN }}
crates-io:
timeout-minutes: 10
name: crates-io
runs-on: ubuntu-latest
environment: prod
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Verify package
run: cargo package --locked
- name: Publish
run: cargo publish --token ${CRATES_API_TOKEN}
env:
CRATES_API_TOKEN: ${{ secrets.CRATES_API_TOKEN }}

github-release:
name: github-release
runs-on: ubuntu-latest
environment: prod
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ github.ref_name }}
generate_release_notes: true
github-release:
timeout-minutes: 10
name: github-release
needs: [crates-io]
runs-on: ubuntu-latest
environment: prod
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ github.ref_name }}
generate_release_notes: true
42 changes: 10 additions & 32 deletions .github/workflows/rust.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,17 @@ env:
CARGO_TERM_COLOR: always

jobs:
fmt:
name: Format
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Fmt check
run: cargo fmt --check

check:
name: Check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Check
run: cargo check

clippy:
name: Clippy
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Run clippy
run: cargo clippy --no-deps --all-targets

tests:
name: Unit and Integration Tests
runs-on: ubuntu-latest
name: Unit and Integration Tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v4
- name: Cache cargo output
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build
- name: Run tests
Expand All @@ -64,8 +42,8 @@ jobs:
- name: Cache cargo output
uses: Swatinem/rust-cache@v2

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
# - name: Install toolchain
# uses: dtolnay/rust-toolchain@stable

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
Expand All @@ -90,4 +68,4 @@ jobs:
```
${{ steps.codecov.outputs.new_cov_comment }}
```
```
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ categories = ["command-line-utilities"]
name = "medusa-gen"
path = "src/main.rs"



[dependencies]
anyhow = "1.0.92"
askama = "0.12.1"
Expand Down

0 comments on commit c0ffeec

Please sign in to comment.