Skip to content

Commit 20ea1aa

Browse files
authored
chore: remove config for older py versions (#198)
* remove 3.7 and 3.8 from noxfile * enable unit tests via github action * update template with python versions * fix github action * update default version in noxfile * update noxfile * add versions back * remove 3.14 * update system test version
1 parent 22f9dfc commit 20ea1aa

File tree

2 files changed

+68
-3
lines changed

2 files changed

+68
-3
lines changed

.github/workflows/unittest.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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.7', '3.8', '3.9', '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
20+
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.8"
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=99

noxfile.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
ISORT_VERSION = "isort==5.11.0"
3333
LINT_PATHS = ["docs", "google_auth_httplib2.py", "tests", "noxfile.py", "setup.py"]
3434

35-
DEFAULT_PYTHON_VERSION = "3.8"
35+
DEFAULT_PYTHON_VERSION = "3.9"
3636

3737
UNIT_TEST_PYTHON_VERSIONS: List[str] = [
3838
"3.7",
@@ -59,7 +59,7 @@
5959
UNIT_TEST_EXTRAS: List[str] = []
6060
UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {}
6161

62-
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8"]
62+
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.9"]
6363
SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [
6464
"mock",
6565
"pytest",
@@ -74,7 +74,11 @@
7474
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
7575

7676
nox.options.sessions = [
77-
"unit",
77+
"unit-3.9",
78+
"unit-3.10",
79+
"unit-3.11",
80+
"unit-3.12",
81+
"unit-3.13",
7882
"system",
7983
"cover",
8084
"lint",

0 commit comments

Comments
 (0)