|
| 1 | +name: citest |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - "release/**" |
| 8 | + paths-ignore: |
| 9 | + - "docs/**" |
| 10 | + - "temp/**" |
| 11 | + - "README.md" |
| 12 | + - "LICENSE" |
| 13 | + - ".github/workflows/publish.yaml" |
| 14 | + |
| 15 | + pull_request: |
| 16 | + paths-ignore: |
| 17 | + - "docs/**" |
| 18 | + - "temp/**" |
| 19 | + - "README.md" |
| 20 | + - "LICENSE" |
| 21 | + - ".github/workflows/publish.yaml" |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + unittest: |
| 29 | + # Mock mode: no credentials, no network calls to the Hub. This mirrors |
| 30 | + # distro build sandboxes (NixOS/FreeBSD) so a green run here means the |
| 31 | + # test suite also passes when downstream packagers run it. |
| 32 | + runs-on: ubuntu-latest |
| 33 | + timeout-minutes: 30 |
| 34 | + strategy: |
| 35 | + fail-fast: false |
| 36 | + matrix: |
| 37 | + # 3.10 = oldest supported, 3.14 = used by NixOS packaging. |
| 38 | + python-version: ["3.10", "3.12", "3.14"] |
| 39 | + env: |
| 40 | + MODELSCOPE_RUN_REMOTE_TESTS: "false" |
| 41 | + steps: |
| 42 | + - name: Checkout |
| 43 | + uses: actions/checkout@v4 |
| 44 | + |
| 45 | + - name: Set up Python ${{ matrix.python-version }} |
| 46 | + uses: actions/setup-python@v5 |
| 47 | + with: |
| 48 | + python-version: ${{ matrix.python-version }} |
| 49 | + |
| 50 | + - name: Install package with dev dependencies |
| 51 | + run: pip install -e ".[dev]" |
| 52 | + |
| 53 | + - name: Run unit tests (mock mode) |
| 54 | + run: pytest tests/ --ignore=tests/integration -q |
| 55 | + |
| 56 | + lint: |
| 57 | + # Hard gate: the ruff/mypy backlog was cleared, keep it at zero. |
| 58 | + runs-on: ubuntu-latest |
| 59 | + timeout-minutes: 10 |
| 60 | + steps: |
| 61 | + - name: Checkout |
| 62 | + uses: actions/checkout@v4 |
| 63 | + |
| 64 | + - name: Set up Python |
| 65 | + uses: actions/setup-python@v5 |
| 66 | + with: |
| 67 | + python-version: "3.13" |
| 68 | + |
| 69 | + - name: Install package with dev dependencies |
| 70 | + run: pip install -e ".[dev]" |
| 71 | + |
| 72 | + - name: Ruff check |
| 73 | + run: ruff check src/ tests/ |
| 74 | + |
| 75 | + - name: Ruff format check |
| 76 | + run: ruff format --check src/ tests/ |
| 77 | + |
| 78 | + - name: Mypy |
| 79 | + run: mypy src/modelscope_hub/ |
0 commit comments