feat(i18n): enhance internationalization support with additional tran… #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ────────────────────────────────────────────────────────────── | |
| # f2a CI — Lint, build, test on every push / PR | |
| # Based on CocoRoF/googer proven workflow pattern. | |
| # | |
| # Optimised for speed: | |
| # - Rust target + registry cached (Swatinem/rust-cache) | |
| # - pip cached | |
| # - lint & test run in parallel | |
| # - matrix trimmed: full OS × Python only on main; PR = Linux-only | |
| # ────────────────────────────────────────────────────────────── | |
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| CARGO_INCREMENTAL: "1" | |
| CARGO_NET_RETRY: "10" | |
| RUSTUP_MAX_RETRIES: "10" | |
| jobs: | |
| # ── Version consistency check (fast, no build) ──────────── | |
| check-versions: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Verify pyproject.toml == Cargo.toml versions | |
| run: | | |
| PY_VER=$(grep -oP '^version\s*=\s*"\K[^"]+' pyproject.toml) | |
| RS_VER=$(grep -oP '^version\s*=\s*"\K[^"]+' Cargo.toml) | |
| echo "pyproject.toml = $PY_VER" | |
| echo "Cargo.toml = $RS_VER" | |
| if [ "$PY_VER" != "$RS_VER" ]; then | |
| echo "::error::Version mismatch! pyproject.toml=$PY_VER vs Cargo.toml=$RS_VER — update both files." | |
| exit 1 | |
| fi | |
| # ── Lint (Rust + Python) ────────────────────────────────── | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-on-failure: true | |
| - name: cargo fmt --check | |
| run: cargo fmt --all -- --check | |
| - name: cargo clippy | |
| run: cargo clippy --all-targets -- -D warnings | |
| # ── Test (cross-platform × multi-Python) ────────────────── | |
| test: | |
| # Run in parallel with lint (no 'needs') | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| python-version: ["3.10", "3.12"] | |
| include: | |
| # Spot-check other platforms with one Python version | |
| - os: macos-14 | |
| python-version: "3.12" | |
| - os: windows-latest | |
| python-version: "3.12" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.os }}-py${{ matrix.python-version }} | |
| cache-on-failure: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Pip cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: pip-${{ matrix.os }}-py${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| pip-${{ matrix.os }}-py${{ matrix.python-version }}- | |
| - name: Install package and test deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install .[dev] | |
| - name: Run tests | |
| run: python -m pytest -v --tb=short |