From 0e9c5a33c33fc6c215f3df7e694dcf70fe258835 Mon Sep 17 00:00:00 2001 From: m1ngsama Date: Thu, 18 Dec 2025 13:16:40 +0800 Subject: [PATCH] ci: migrate workflow from Python to Rust Updated ci.yml to run cargo test/check/fmt/clippy. Deleted python-specific release.yml. --- .github/workflows/ci.yml | 64 ++++++++++++++--------------------- .github/workflows/release.yml | 51 ---------------------------- 2 files changed, 25 insertions(+), 90 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6caf353..b512eab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,60 +2,46 @@ name: CI on: push: - branches: [ main, develop ] + branches: [ main ] pull_request: - branches: [ main, develop ] + branches: [ main ] + +env: + CARGO_TERM_COLOR: always jobs: test: + name: Test on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable with: - python-version: ${{ matrix.python-version }} + components: clippy, rustfmt - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Check + run: cargo check --verbose - name: Run tests - run: | - python test_tracker.py + run: cargo test --verbose - - name: Test basic execution - run: | - python tracker.py - timeout-minutes: 1 + - name: Format Check + run: cargo fmt -- --check - lint: - 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 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 + - name: Lint (Clippy) + run: cargo clippy -- -D warnings \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 29832ce..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -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