ci: migrate workflow from Python to Rust

Updated ci.yml to run cargo test/check/fmt/clippy. Deleted python-specific release.yml.
This commit is contained in:
m1ngsama 2025-12-18 13:16:40 +08:00
parent b9b2b7aced
commit 0e9c5a33c3
2 changed files with 25 additions and 90 deletions

View file

@ -2,60 +2,46 @@ name: CI
on: on:
push: push:
branches: [ main, develop ] branches: [ main ]
pull_request: pull_request:
branches: [ main, develop ] branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs: jobs:
test: test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} - name: Install Rust
uses: actions/setup-python@v5 uses: dtolnay/rust-toolchain@stable
with: with:
python-version: ${{ matrix.python-version }} components: clippy, rustfmt
- name: Install dependencies - name: Cache dependencies
run: | uses: actions/cache@v3
python -m pip install --upgrade pip with:
pip install -r requirements.txt path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check
run: cargo check --verbose
- name: Run tests - name: Run tests
run: | run: cargo test --verbose
python test_tracker.py
- name: Test basic execution - name: Format Check
run: | run: cargo fmt -- --check
python tracker.py
timeout-minutes: 1
lint: - name: Lint (Clippy)
runs-on: ubuntu-latest run: cargo clippy -- -D warnings
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install flake8 pylint
- name: Lint with flake8
run: |
# Stop build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
continue-on-error: true

View file

@ -1,51 +0,0 @@
name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: |
python -m build
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/v')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/* --skip-existing
continue-on-error: true