name: Rust CI
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
rust:
name: Rust CI
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
steps:
- uses: actions/checkout@v6
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Check
run: cargo check --all-features
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-features -- -W clippy::all -A clippy::missing_docs_in_private_items -A clippy::pedantic
- name: Build
run: cargo build --all-features
- name: Test
run: cargo test --all-features
build-tag:
name: Build Tag Release
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
include:
- os: ubuntu-latest
artifact_name: winx
asset_name: winx-linux-amd64
- os: macos-latest
artifact_name: winx
asset_name: winx-macos-amd64
- os: windows-latest
artifact_name: winx.exe
asset_name: winx-windows-amd64.exe
steps:
- uses: actions/checkout@v6
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Build release binary
run: cargo build --release
- name: Rename binary
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp target/release/winx-code-agent.exe ${{ matrix.artifact_name }}
else
cp target/release/winx-code-agent ${{ matrix.artifact_name }}
fi
- name: Upload build artifact
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.artifact_name }}
retention-days: 5