Skip to content

Merge pull request #19 from SolidLabResearch/codex/repo-followup-polish #6

Merge pull request #19 from SolidLabResearch/codex/repo-followup-polish

Merge pull request #19 from SolidLabResearch/codex/repo-followup-polish #6

Workflow file for this run

name: Release And Extended CI
on:
push:
branches: [main, develop]
tags:
- "v*"
workflow_dispatch:
schedule:
- cron: "0 6 * * 1"
concurrency:
group: release-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
test-matrix:
name: Test Suite (${{ matrix.os }}, ${{ matrix.rust }})
if: github.event_name != 'schedule'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
rust: stable
- os: windows-latest
rust: stable
- os: macos-latest
rust: stable
- os: ubuntu-latest
rust: beta
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.os }}-${{ matrix.rust }}
- name: Run tests
run: cargo test --all-features --verbose
- name: Run doc tests
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'stable'
run: cargo test --doc --all-features --verbose
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-audit
uses: taiki-e/install-action@cargo-audit
- name: Cache advisory database
uses: actions/cache@v4
with:
path: ~/.cargo/advisory-db
key: ${{ runner.os }}-advisory-db
- name: Run security audit
run: cargo audit
coverage:
name: Code Coverage
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
- name: Generate coverage
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: lcov.info
flags: rust
name: rust-coverage
build-release:
name: Build Release (${{ matrix.target }})
if: startsWith(github.ref, 'refs/tags/v')
needs: [test-matrix, security]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
shared-key: release-${{ matrix.os }}-${{ matrix.target }}
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }} --verbose
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: janus-${{ matrix.target }}
path: target/${{ matrix.target }}/release/janus${{ matrix.os == 'windows-latest' && '.exe' || '' }}
publish:
name: Publish to crates.io
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [test-matrix, security, build-release]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}