Skip to content

Commit 2d32062

Browse files
busunkim96parthea
andauthored
chore: set up CI on v1 branch (#511)
* chore: add basic CI for v1 branch * chore: remove 3.8 from noxfile Co-authored-by: Anthonios Partheniou <[email protected]> * ci: remove docfx session * ci: fix cover * chore: fix noxfile * chore: add 3.8 unit tests Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 7809d80 commit 2d32062

File tree

6 files changed

+126
-41
lines changed

6 files changed

+126
-41
lines changed

.github/workflows/docs.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- v1
5+
name: docs
6+
jobs:
7+
docs:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
- name: Setup Python
13+
uses: actions/setup-python@v3
14+
with:
15+
python-version: "3.8"
16+
- name: Install nox
17+
run: |
18+
python -m pip install --upgrade setuptools pip wheel
19+
python -m pip install nox
20+
- name: Run docs
21+
run: |
22+
nox -s docs

.github/workflows/lint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- v1
5+
name: lint
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
- name: Setup Python
13+
uses: actions/setup-python@v3
14+
with:
15+
python-version: "3.8"
16+
- name: Install nox
17+
run: |
18+
python -m pip install --upgrade setuptools pip wheel
19+
python -m pip install nox
20+
- name: Run lint
21+
run: |
22+
nox -s lint
23+
- name: Run lint_setup_py
24+
run: |
25+
nox -s lint_setup_py

.github/workflows/unittest.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- v1
5+
name: unittest
6+
jobs:
7+
unit:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python: ['3.6', '3.7', '3.8']
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
- name: Setup Python
16+
uses: actions/setup-python@v3
17+
with:
18+
python-version: ${{ matrix.python }}
19+
- name: Install nox
20+
run: |
21+
python -m pip install --upgrade setuptools pip wheel
22+
python -m pip install nox
23+
- name: Run unit tests
24+
env:
25+
COVERAGE_FILE: .coverage-${{ matrix.python }}
26+
run: |
27+
nox -s unit-${{ matrix.python }}
28+
- name: Upload coverage results
29+
uses: actions/upload-artifact@v3
30+
with:
31+
name: coverage-artifacts
32+
path: .coverage-${{ matrix.python }}
33+
34+
cover:
35+
runs-on: ubuntu-latest
36+
needs:
37+
- unit
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v3
41+
- name: Setup Python
42+
uses: actions/setup-python@v3
43+
with:
44+
python-version: "3.8"
45+
- name: Install coverage
46+
run: |
47+
python -m pip install --upgrade setuptools pip wheel
48+
python -m pip install coverage
49+
- name: Download coverage results
50+
uses: actions/download-artifact@v3
51+
with:
52+
name: coverage-artifacts
53+
path: .coverage-results/
54+
- name: Report coverage results
55+
run: |
56+
coverage combine .coverage-results/.coverage*
57+
coverage report --show-missing --fail-under=98

.kokoro/release.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
#!/bin/bash
17-
1816
set -eo pipefail
1917

2018
# Start the releasetool reporter
@@ -28,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools
2826
export PYTHONUNBUFFERED=1
2927

3028
# Move into the package, build the distribution and upload.
31-
TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google_cloud_pypi_password")
29+
TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-1")
3230
cd github/python-logging
3331
python3 setup.py sdist bdist_wheel
34-
twine upload --username gcloudpypi --password "${TWINE_PASSWORD}" dist/*
32+
twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/*

.kokoro/release/common.cfg

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,18 @@ env_vars: {
2323
value: "github/python-logging/.kokoro/release.sh"
2424
}
2525

26-
# Fetch the token needed for reporting release status to GitHub
27-
before_action {
28-
fetch_keystore {
29-
keystore_resource {
30-
keystore_config_id: 73713
31-
keyname: "yoshi-automation-github-key"
32-
}
33-
}
34-
}
35-
3626
# Fetch PyPI password
3727
before_action {
3828
fetch_keystore {
3929
keystore_resource {
4030
keystore_config_id: 73713
41-
keyname: "google_cloud_pypi_password"
31+
keyname: "google-cloud-pypi-token-keystore-1"
4232
}
4333
}
4434
}
4535

46-
# Fetch magictoken to use with Magic Github Proxy
47-
before_action {
48-
fetch_keystore {
49-
keystore_resource {
50-
keystore_config_id: 73713
51-
keyname: "releasetool-magictoken"
52-
}
53-
}
54-
}
55-
56-
# Fetch api key to use with Magic Github Proxy
57-
before_action {
58-
fetch_keystore {
59-
keystore_resource {
60-
keystore_config_id: 73713
61-
keyname: "magic-github-proxy-api-key"
62-
}
63-
}
36+
# Tokens needed to report release status back to GitHub
37+
env_vars: {
38+
key: "SECRET_MANAGER_KEYS"
39+
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem"
6440
}

noxfile.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
import nox
2222

2323

24+
# This is the last version to support Python 2.7
25+
BLACK_VERSION = "black==21.12b0"
26+
DEFAULT_PYTHON_VERSION = "3.8"
27+
28+
# Error if a python version is missing
29+
nox.options.error_on_missing_interpreters = True
30+
2431
UNIT_TEST_DEPS = (
2532
'mock',
2633
'pytest',
@@ -31,7 +38,7 @@
3138
)
3239

3340

34-
@nox.session(python="3.7")
41+
@nox.session(python=DEFAULT_PYTHON_VERSION)
3542
def lint(session):
3643
"""Run linters.
3744
@@ -49,7 +56,7 @@ def lint(session):
4956
session.run("flake8", "google", "tests")
5057

5158

52-
@nox.session(python="3.6")
59+
@nox.session(python=DEFAULT_PYTHON_VERSION)
5360
def blacken(session):
5461
"""Run black.
5562
@@ -64,7 +71,7 @@ def blacken(session):
6471
)
6572

6673

67-
@nox.session(python="3.7")
74+
@nox.session(python=DEFAULT_PYTHON_VERSION)
6875
def lint_setup_py(session):
6976
"""Verify that setup.py is valid (including RST check)."""
7077
session.install("docutils", "pygments")
@@ -97,7 +104,7 @@ def default(session, django_dep=('django',)):
97104
)
98105

99106

100-
@nox.session(python=['2.7', '3.5', '3.6', '3.7'])
107+
@nox.session(python=['2.7', '3.6', '3.7', '3.8'])
101108
def unit(session):
102109
"""Run the unit test suite."""
103110

@@ -114,7 +121,7 @@ def unit(session):
114121
default(session)
115122

116123

117-
@nox.session(python=['2.7', '3.6'])
124+
@nox.session(python=['2.7', '3.8'])
118125
def system(session):
119126
"""Run the system test suite."""
120127

@@ -148,7 +155,7 @@ def system(session):
148155
*session.posargs)
149156

150157

151-
@nox.session(python="3.7")
158+
@nox.session(python=DEFAULT_PYTHON_VERSION)
152159
def cover(session):
153160
"""Run the final coverage report.
154161
@@ -160,12 +167,12 @@ def cover(session):
160167

161168
session.run("coverage", "erase")
162169

163-
@nox.session(python="3.7")
170+
@nox.session(python=DEFAULT_PYTHON_VERSION)
164171
def docs(session):
165172
"""Build the docs for this library."""
166173

167174
session.install("-e", ".")
168-
session.install("sphinx<3.0.0", "alabaster", "recommonmark")
175+
session.install("sphinx<3.0.0", "jinja2<3.1", "alabaster", "recommonmark")
169176

170177
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
171178
session.run(

0 commit comments

Comments
 (0)