name: CI
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Configure git (Windows)
if: runner.os == 'Windows'
run: |
git config --global user.email "ci@example.com"
git config --global user.name "ci"
git config --global init.defaultBranch main
- name: Build
run: cargo build --all-targets
- name: Test
run: cargo test
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Format
if: runner.os == 'Linux'
run: cargo fmt --check
release:
name: release (${{ matrix.target }})
if: startsWith(github.ref, 'refs/tags/v')
needs: test
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Build release
run: cargo build --release --target ${{ matrix.target }}
- name: Package (unix)
if: runner.os != 'Windows'
run: |
cd target/${{ matrix.target }}/release
tar czf claude-oops-${{ matrix.target }}.tar.gz claude-oops
mv claude-oops-${{ matrix.target }}.tar.gz $GITHUB_WORKSPACE/
- name: Package (windows)
if: runner.os == 'Windows'
run: |
cd target/${{ matrix.target }}/release
7z a claude-oops-${{ matrix.target }}.zip claude-oops.exe
mv claude-oops-${{ matrix.target }}.zip $env:GITHUB_WORKSPACE/
- uses: softprops/action-gh-release@v2
with:
files: |
claude-oops-${{ matrix.target }}.tar.gz
claude-oops-${{ matrix.target }}.zip
fail_on_unmatched_files: false