From b0cdb523900ce29376e1aa55bc2006f2f154d5f8 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 12 Oct 2021 14:32:40 -0400 Subject: [PATCH 01/14] ci: prototype running lint / unit tests / coverage as GH actions --- .github/workflows/unittest_lint.yml | 102 ++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .github/workflows/unittest_lint.yml diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml new file mode 100644 index 00000000..49d45d7d --- /dev/null +++ b/.github/workflows/unittest_lint.yml @@ -0,0 +1,102 @@ +name: "Run lint, unit tests, and cover" + +on: + pull_request: + branches: + - main + + +jobs: + + run-lint: + runs-on: ubuntu-latest + + steps: + + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.10 + + - name: Install nox + run: | + python -m pip install nox + + - name: Run lint + run: | + nox -s lint + + - name: Run lint_setup + run: | + nox -s lint_setup + + run-unittests: + runs-on: ubuntu-latest + strategy: + matrix: + w_grcp_gcp: ["", "_grpc_gcp"] + python: + - 3.6 + - 3.7 + - 3.8 + - 3.9 + - 3.10 + + steps: + + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: {{ matrix.python }} + + - name: Install nox + run: | + python -m pip install nox + + - name: Run unit tests + env: + COVERAGE_FILE: .coverage{{ matrix.w_grcp_gcp }}-{{matrix.python }} + run: | + nox -s unit{{ matrix.w_grcp_gcp }}-{{ matrix.python }} + + - name: Upload coverage results + uses: actions/upload-artifact@v2 + with: + name: coverage-artifacts + path: .coverage{{ matrix.w_grcp_gcp }}-{{ matrix-python }} + + report-coverage: + runs-on: ubuntu-latest + needs: + - run-unittests + + steps: + + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: {{ matrix.python }} + + - name: Download coverage results + uses: actions/download-artifact@v2 + with: + name: coverage-artifacts + path: .coverage-results/ + + - name: Install coverage + run: | + python -m pip install nox + + - name: Report coverage results + run: | + coverage combine .coverage-results/ + coverage report --show-missing --fail-under=100 From 1b090b25e540781d466c0f90418eb5bb4313d33b Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 12 Oct 2021 14:37:16 -0400 Subject: [PATCH 02/14] ci: tweak matrix var --- .github/workflows/unittest_lint.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml index 49d45d7d..3157b9bf 100644 --- a/.github/workflows/unittest_lint.yml +++ b/.github/workflows/unittest_lint.yml @@ -53,7 +53,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: {{ matrix.python }} + python-version: ${{ matrix.python }} - name: Install nox run: | @@ -61,15 +61,15 @@ jobs: - name: Run unit tests env: - COVERAGE_FILE: .coverage{{ matrix.w_grcp_gcp }}-{{matrix.python }} + COVERAGE_FILE: .coverage${{ matrix.w_grcp_gcp }}-${{matrix.python }} run: | - nox -s unit{{ matrix.w_grcp_gcp }}-{{ matrix.python }} + nox -s unit${{ matrix.w_grcp_gcp }}-${{ matrix.python }} - name: Upload coverage results uses: actions/upload-artifact@v2 with: name: coverage-artifacts - path: .coverage{{ matrix.w_grcp_gcp }}-{{ matrix-python }} + path: .coverage${{ matrix.w_grcp_gcp }}-${{ matrix-python }} report-coverage: runs-on: ubuntu-latest @@ -84,7 +84,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: {{ matrix.python }} + python-version: ${{ matrix.python }} - name: Download coverage results uses: actions/download-artifact@v2 From fa52e408decf1202105dc9bd860b51aef7c45742 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 12 Oct 2021 14:38:16 -0400 Subject: [PATCH 03/14] ci: typo --- .github/workflows/unittest_lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml index 3157b9bf..6cbda0cb 100644 --- a/.github/workflows/unittest_lint.yml +++ b/.github/workflows/unittest_lint.yml @@ -69,7 +69,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: coverage-artifacts - path: .coverage${{ matrix.w_grcp_gcp }}-${{ matrix-python }} + path: .coverage${{ matrix.w_grcp_gcp }}-${{ matrix.python }} report-coverage: runs-on: ubuntu-latest From 169e24465fdc7716cdc6f00eb9b907c05d8e05d4 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 12 Oct 2021 14:39:46 -0400 Subject: [PATCH 04/14] ci: force python version as string --- .github/workflows/unittest_lint.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml index 6cbda0cb..b5d62db8 100644 --- a/.github/workflows/unittest_lint.yml +++ b/.github/workflows/unittest_lint.yml @@ -39,11 +39,11 @@ jobs: matrix: w_grcp_gcp: ["", "_grpc_gcp"] python: - - 3.6 - - 3.7 - - 3.8 - - 3.9 - - 3.10 + - "3.6" + - "3.7" + - "3.8" + - "3.9" + - "3.10" steps: From 766098dad39d15350796390bd861aac149ce5b88 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 12 Oct 2021 14:40:53 -0400 Subject: [PATCH 05/14] ci: force python version as string moar --- .github/workflows/unittest_lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml index b5d62db8..b828351c 100644 --- a/.github/workflows/unittest_lint.yml +++ b/.github/workflows/unittest_lint.yml @@ -19,7 +19,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: 3.10 + python-version: "3.10" - name: Install nox run: | @@ -84,7 +84,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python }} + python-version: "3.10" - name: Download coverage results uses: actions/download-artifact@v2 From f226e9152e971b064c3695aabdd111a0483b8eb7 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 12 Oct 2021 14:42:46 -0400 Subject: [PATCH 06/14] ci: test '_grpc_gcp' on Python 3.10 --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 617dc580..f7ae10b8 100644 --- a/noxfile.py +++ b/noxfile.py @@ -127,7 +127,7 @@ def unit(session): default(session) -@nox.session(python=["3.6", "3.7", "3.8", "3.9"]) +@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10"]) def unit_grpc_gcp(session): """Run the unit test suite with grpcio-gcp installed.""" constraints_path = str( From 388fa0de30f9c65198f4d488d5bd8a81a7b65d6d Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 12 Oct 2021 14:43:22 -0400 Subject: [PATCH 07/14] ci: typo --- .github/workflows/unittest_lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml index b828351c..bbd9d2f6 100644 --- a/.github/workflows/unittest_lint.yml +++ b/.github/workflows/unittest_lint.yml @@ -29,9 +29,9 @@ jobs: run: | nox -s lint - - name: Run lint_setup + - name: Run lint_setup_py run: | - nox -s lint_setup + nox -s lint_setup_py run-unittests: runs-on: ubuntu-latest From 426d80d98919e725967350bd2289519dcfac66a8 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 12 Oct 2021 14:45:44 -0400 Subject: [PATCH 08/14] ci: typo --- .github/workflows/unittest_lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml index bbd9d2f6..60fd7127 100644 --- a/.github/workflows/unittest_lint.yml +++ b/.github/workflows/unittest_lint.yml @@ -94,7 +94,7 @@ jobs: - name: Install coverage run: | - python -m pip install nox + python -m pip install coverage - name: Report coverage results run: | From eface2a7bc6a3ccd8197dc1724a17f13eb68808f Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 12 Oct 2021 14:50:40 -0400 Subject: [PATCH 09/14] ci: use FQ path for '.coverage-results/'. --- .github/workflows/unittest_lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml index 60fd7127..d54a48fd 100644 --- a/.github/workflows/unittest_lint.yml +++ b/.github/workflows/unittest_lint.yml @@ -90,7 +90,7 @@ jobs: uses: actions/download-artifact@v2 with: name: coverage-artifacts - path: .coverage-results/ + path: ${{ github.workspace }}/.coverage-results/ - name: Install coverage run: | @@ -98,5 +98,5 @@ jobs: - name: Report coverage results run: | - coverage combine .coverage-results/ + coverage combine ${{ github.workspace }}/.coverage-results/ coverage report --show-missing --fail-under=100 From 0d3d008e71a91fbb365e24a672642d12c648059e Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 12 Oct 2021 14:56:25 -0400 Subject: [PATCH 10/14] ci: name files being combined --- .github/workflows/unittest_lint.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml index d54a48fd..696dd5c4 100644 --- a/.github/workflows/unittest_lint.yml +++ b/.github/workflows/unittest_lint.yml @@ -86,17 +86,17 @@ jobs: with: python-version: "3.10" + - name: Install coverage + run: | + python -m pip install coverage + - name: Download coverage results uses: actions/download-artifact@v2 with: name: coverage-artifacts - path: ${{ github.workspace }}/.coverage-results/ - - - name: Install coverage - run: | - python -m pip install coverage + path: .coverage-results/ - name: Report coverage results run: | - coverage combine ${{ github.workspace }}/.coverage-results/ + coverage combine .coverage-results/.coverage* coverage report --show-missing --fail-under=100 From 10f88382026e82c4bd588710a68b3f15e690803e Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 12 Oct 2021 14:59:56 -0400 Subject: [PATCH 11/14] ci: suppress pip warnings --- .github/workflows/unittest_lint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml index 696dd5c4..57a853cf 100644 --- a/.github/workflows/unittest_lint.yml +++ b/.github/workflows/unittest_lint.yml @@ -23,6 +23,7 @@ jobs: - name: Install nox run: | + python -m pip install --upgrade setuptools pip wheel python -m pip install nox - name: Run lint @@ -57,6 +58,7 @@ jobs: - name: Install nox run: | + python -m pip install --upgrade setuptools pip wheel python -m pip install nox - name: Run unit tests @@ -88,6 +90,7 @@ jobs: - name: Install coverage run: | + python -m pip install --upgrade setuptools pip wheel python -m pip install coverage - name: Download coverage results From 6b2e81f353ce85b13cd74ef7feb3b08ff2211aa5 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Thu, 18 Nov 2021 08:55:55 -0500 Subject: [PATCH 12/14] ci: run mypy, update workflow title --- .github/workflows/unittest_lint.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml index 57a853cf..0153f126 100644 --- a/.github/workflows/unittest_lint.yml +++ b/.github/workflows/unittest_lint.yml @@ -1,4 +1,4 @@ -name: "Run lint, unit tests, and cover" +name: "Lint / Unit tests / Cover / Mypy" on: pull_request: @@ -8,7 +8,7 @@ on: jobs: - run-lint: + run-lint-mypy: runs-on: ubuntu-latest steps: @@ -34,6 +34,10 @@ jobs: run: | nox -s lint_setup_py + - name: Run mypy + run: | + nox -s mypy + run-unittests: runs-on: ubuntu-latest strategy: From dfa5ca8684569eca3bfddef522e0d886658adee7 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Thu, 18 Nov 2021 09:09:19 -0500 Subject: [PATCH 13/14] ci: run the 'unit_wo_grpc' unit tests for coverage --- .github/workflows/unittest_lint.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml index 0153f126..de90e2ab 100644 --- a/.github/workflows/unittest_lint.yml +++ b/.github/workflows/unittest_lint.yml @@ -42,13 +42,20 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - w_grcp_gcp: ["", "_grpc_gcp"] + option: ["", "_grpc_gcp", "_wo_grpc"] python: - "3.6" - "3.7" - "3.8" - "3.9" - "3.10" + exclude: + - option: "_wo_grpc" + python: 3.7 + - option: "_wo_grpc" + python: 3.8 + - option: "_wo_grpc" + python: 3.9 steps: @@ -67,15 +74,15 @@ jobs: - name: Run unit tests env: - COVERAGE_FILE: .coverage${{ matrix.w_grcp_gcp }}-${{matrix.python }} + COVERAGE_FILE: .coverage${{ matrix.option }}-${{matrix.python }} run: | - nox -s unit${{ matrix.w_grcp_gcp }}-${{ matrix.python }} + nox -s unit${{ matrix.option }}-${{ matrix.python }} - name: Upload coverage results uses: actions/upload-artifact@v2 with: name: coverage-artifacts - path: .coverage${{ matrix.w_grcp_gcp }}-${{ matrix.python }} + path: .coverage${{ matrix.option }}-${{ matrix.python }} report-coverage: runs-on: ubuntu-latest From a17ced050a80390fcb066000e91aab3c6c58084a Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Tue, 7 Dec 2021 14:17:13 -0500 Subject: [PATCH 14/14] ci: make GH Action checks required --- .github/sync-repo-settings.yaml | 25 +++++++++++++++++++++++++ .github/workflows/unittest_lint.yml | 3 +++ 2 files changed, 28 insertions(+) diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index e621885d..67fcd59f 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -1,3 +1,28 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/sync-repo-settings +# Rules for main branch protection +branchProtectionRules: +# Identifies the protection rule pattern. Name of the branch to be protected. +# Defaults to `main` +- pattern: main + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: true + requiredStatusCheckContexts: + - 'cla/google' + # No Kokoro: the following are Github actions + - 'lint-mypy' + - 'unit-3.6' + - 'unit-3.7' + - 'unit-3.8' + - 'unit-3.9' + - 'unit-3.10' + - 'unit_grpc_gcp-3.6' + - 'unit_grpc_gcp-3.7' + - 'unit_grpc_gcp-3.8' + - 'unit_grpc_gcp-3.9' + - 'unit_grpc_gcp-3.10' + - 'unit_wo_grpc-3.6' + - 'unit_wo_grpc-3.10' + - 'cover' permissionRules: - team: actools-python permission: admin diff --git a/.github/workflows/unittest_lint.yml b/.github/workflows/unittest_lint.yml index de90e2ab..302be970 100644 --- a/.github/workflows/unittest_lint.yml +++ b/.github/workflows/unittest_lint.yml @@ -9,6 +9,7 @@ on: jobs: run-lint-mypy: + name: lint-mypy runs-on: ubuntu-latest steps: @@ -39,6 +40,7 @@ jobs: nox -s mypy run-unittests: + name: unit${{ matrix.option }}-${{ matrix.python }} runs-on: ubuntu-latest strategy: matrix: @@ -85,6 +87,7 @@ jobs: path: .coverage${{ matrix.option }}-${{ matrix.python }} report-coverage: + name: cover runs-on: ubuntu-latest needs: - run-unittests