|
| 1 | +# BlockMesh Studio CI/CD Pipeline |
| 2 | +# 確保 UTF-8 編碼支援正體中文 |
| 3 | + |
| 4 | +name: CI |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [main, master] |
| 9 | + pull_request: |
| 10 | + branches: [main, master] |
| 11 | + |
| 12 | +env: |
| 13 | + # 全域 UTF-8 設定(Python 3.14 已內建 UTF-8 模式) |
| 14 | + PYTHONIOENCODING: "utf-8" |
| 15 | + |
| 16 | +jobs: |
| 17 | + test-linux: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + env: |
| 20 | + LANG: en_US.UTF-8 |
| 21 | + LC_ALL: en_US.UTF-8 |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Set up locale |
| 27 | + run: | |
| 28 | + sudo locale-gen en_US.UTF-8 |
| 29 | + sudo update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 |
| 30 | + |
| 31 | + - name: Install uv |
| 32 | + uses: astral-sh/setup-uv@v4 |
| 33 | + with: |
| 34 | + version: "latest" |
| 35 | + |
| 36 | + - name: Set up Python 3.14 |
| 37 | + run: uv python install 3.14 |
| 38 | + |
| 39 | + - name: Create virtual environment |
| 40 | + run: uv venv .venv314 --python 3.14 |
| 41 | + |
| 42 | + - name: Install dependencies |
| 43 | + run: | |
| 44 | + uv pip install -e ".[dev]" |
| 45 | + |
| 46 | + - name: Run tests with UTF-8 |
| 47 | + run: | |
| 48 | + uv run pytest -v --tb=short |
| 49 | + env: |
| 50 | + PYTHONIOENCODING: "utf-8" |
| 51 | + |
| 52 | + test-windows: |
| 53 | + runs-on: windows-latest |
| 54 | + |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Set Windows UTF-8 codepage |
| 59 | + run: | |
| 60 | + chcp 65001 |
| 61 | + shell: cmd |
| 62 | + |
| 63 | + - name: Install uv |
| 64 | + uses: astral-sh/setup-uv@v4 |
| 65 | + with: |
| 66 | + version: "latest" |
| 67 | + |
| 68 | + - name: Set up Python 3.14 |
| 69 | + run: uv python install 3.14 |
| 70 | + |
| 71 | + - name: Create virtual environment |
| 72 | + run: uv venv .venv314 --python 3.14 |
| 73 | + |
| 74 | + - name: Install dependencies |
| 75 | + run: | |
| 76 | + uv pip install -e ".[dev]" |
| 77 | + |
| 78 | + - name: Run tests with UTF-8 |
| 79 | + run: | |
| 80 | + uv run pytest -v --tb=short |
| 81 | + env: |
| 82 | + PYTHONIOENCODING: "utf-8" |
| 83 | + PYTHONLEGACYWINDOWSSTDIO: "0" |
0 commit comments