|
1 | 1 | on: |
2 | | - pull_request: |
3 | | - branches: |
4 | | - - main |
5 | | - name: unittest |
6 | | - jobs: |
7 | | - unit: |
8 | | - # TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed. |
9 | | - # Use ubuntu-22.04 until Python 3.7 is removed from the test matrix |
10 | | - # https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories |
11 | | - runs-on: ubuntu-22.04 |
12 | | - strategy: |
13 | | - matrix: |
14 | | - python: ['3.10', '3.11', '3.12', '3.13'] |
15 | | - steps: |
16 | | - - name: Checkout |
17 | | - uses: actions/checkout@v4 |
18 | | - - name: Setup Python |
19 | | - uses: actions/setup-python@v5 |
| 2 | + pull_request: |
| 3 | + branches: |
| 4 | + - main |
| 5 | + |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + name: unittest |
| 9 | + runs-on: ubuntu-latest |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + python-version: |
| 13 | + - "3.10" |
| 14 | + - "3.11" |
| 15 | + - "3.12" |
| 16 | + - "3.13" |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Install uv and set the python version |
| 22 | + uses: astral-sh/setup-uv@v6 |
20 | 23 | with: |
21 | | - python-version: ${{ matrix.python }} |
22 | | - - name: Install nox |
23 | | - run: | |
24 | | - python -m pip install --upgrade setuptools pip wheel |
25 | | - python -m pip install nox |
26 | | - - name: Run unit tests |
27 | | - env: |
28 | | - COVERAGE_FILE: .coverage-${{ matrix.python }} |
29 | | - run: | |
30 | | - nox -s unit-${{ matrix.python }} |
31 | | - - name: Upload coverage results |
32 | | - uses: actions/upload-artifact@v4 |
33 | | - with: |
34 | | - name: coverage-artifact-${{ matrix.python }} |
35 | | - path: .coverage-${{ matrix.python }} |
36 | | - include-hidden-files: true |
37 | | - |
38 | | - cover: |
39 | | - runs-on: ubuntu-latest |
40 | | - needs: |
41 | | - - unit |
42 | | - steps: |
43 | | - - name: Checkout |
44 | | - uses: actions/checkout@v4 |
45 | | - - name: Setup Python |
46 | | - uses: actions/setup-python@v5 |
47 | | - with: |
48 | | - python-version: "3.10" |
49 | | - - name: Install coverage |
50 | | - run: | |
51 | | - python -m pip install --upgrade setuptools pip wheel |
52 | | - python -m pip install coverage |
53 | | - - name: Download coverage results |
54 | | - uses: actions/download-artifact@v4 |
55 | | - with: |
56 | | - path: .coverage-results/ |
57 | | - - name: Report coverage results |
58 | | - run: | |
59 | | - find .coverage-results -type f -name '*.zip' -exec unzip {} \; |
60 | | - coverage combine .coverage-results/**/.coverage* |
61 | | - coverage report --show-missing --fail-under=35 |
| 24 | + python-version: ${{ matrix.python-version }} |
| 25 | + enable-cache: true |
| 26 | + |
| 27 | + - name: Install the project |
| 28 | + run: uv sync --locked --all-extras --dev |
| 29 | + |
| 30 | + - name: Run tests |
| 31 | + run: uv run pytest tests/unit |
0 commit comments