Skip to content

Commit 9fb8348

Browse files
committed
Added python3.8 setup and change CI jobs
1 parent 1475465 commit 9fb8348

File tree

3 files changed

+120
-22
lines changed

3 files changed

+120
-22
lines changed

.github/workflows/main.yml

Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,59 @@
1-
name: Link Status
1+
name: Tests
22

33
on: [push, pull_request]
44

55
jobs:
66
pre-commit:
77
name: Pre-Commit Checks
88
runs-on: ubuntu-latest
9+
910
steps:
1011
- name: Checkout to master
1112
uses: actions/checkout@master
1213

1314
- name: Setup python
1415
uses: actions/setup-python@v1
1516
with:
16-
python-version: '3.7'
17+
python-version: '3.8'
1718
architecture: 'x64'
1819

1920
- name: Pre-Commit Checks
2021
run: |
21-
python -m pip install pre-commit
22-
pre-commit run -a
22+
python -m pip install pip --upgrade
23+
pip install nox
24+
nox -s pre_commit
2325
2426
- name: Analysis (git diff)
2527
if: failure()
2628
run: git diff
2729

28-
tests:
29-
name: Test-${{ matrix.os }}-Py${{ matrix.python-version }}
30+
package:
31+
name: Build & Verify Package
3032
needs: pre-commit
31-
runs-on: ${{ matrix.os }}
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- name: Checkout to master
37+
uses: actions/checkout@master
38+
39+
- name: Setup python
40+
uses: actions/setup-python@v1
41+
with:
42+
python-version: '3.8'
43+
architecture: 'x64'
44+
- name: Build and check with twine
45+
run: |
46+
python -m pip install pip --upgrade
47+
pip install nox
48+
nox -s package
49+
50+
unit-tests:
51+
name: UnitTests-Python-${{ matrix.python-version }}
52+
needs: [ pre-commit, package ]
53+
runs-on: ubuntu-latest
3254
strategy:
3355
matrix:
34-
os: [ubuntu-latest, windows-latest, macos-latest]
35-
python-version: [ '3.6', '3.7' ]
56+
python-version: [ 'pypy3', '3.6', '3.7', '3.8' ]
3657
steps:
3758
- name: Checkout to master
3859
uses: actions/checkout@master
@@ -43,10 +64,39 @@ jobs:
4364
python-version: ${{ matrix.python-version }}
4465
architecture: x64
4566

46-
- name: Setup Package and Install Devel Dependencies
67+
- name: Unit Tests
4768
run: |
48-
python -m pip install -Ur dev-requirements.txt
49-
python -m pip install .
69+
python -m pip install pip --upgrade
70+
pip install nox
71+
nox -s ci_tests
5072
51-
- name: Unit Tests
52-
run: py.test -v tests
73+
- name: Upload coverage to Codecov
74+
uses: codecov/[email protected]
75+
with:
76+
file: coverage.xml
77+
flags: unittests
78+
name: codecov-linkstatus-{{ matrix.python-version }}
79+
fail_ci_if_error: true
80+
81+
platform:
82+
name: Platform-${{ matrix.os }}
83+
needs: [ unit-tests]
84+
runs-on: ${{ matrix.os }}
85+
strategy:
86+
matrix:
87+
os: [ubuntu-latest, windows-latest, macos-latest]
88+
steps:
89+
- name: Checkout to master
90+
uses: actions/checkout@master
91+
92+
- name: Setup python
93+
uses: actions/setup-python@v1
94+
with:
95+
python-version: '3.8'
96+
architecture: 'x64'
97+
98+
- name: Development setup and smoke test on platform ${{ matrix.os }}
99+
run: |
100+
python -m pip install pip --upgrade
101+
pip install nox
102+
nox -s dev_setup

.github/workflows/release.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,25 @@ on:
1010
jobs:
1111
build-and-publish:
1212
name: Build and publish Python 🐍 distributions to PyPI
13-
runs-on: ubuntu-18.04
13+
if: startsWith(github.event.ref, 'refs/tags')
14+
runs-on: ubuntu-latest
1415
steps:
1516
- name: Checkout to master
1617
uses: actions/checkout@master
1718

1819
- name: Setup python
1920
uses: actions/setup-python@v1
2021
with:
21-
python-version: '3.7'
22+
python-version: '3.8'
2223
architecture: 'x64'
2324

24-
- name: Build Package
25+
- name: Build Package and Check
2526
run: |
26-
python -m pip install --upgrade setuptools wheel
27+
python -m pip install --upgrade setuptools wheel twine
2728
python setup.py sdist bdist_wheel
29+
python -m twine check dist/*
2830
2931
- name: Deploy to PyPi
30-
if: startsWith(github.event.ref, 'refs/tags')
3132
uses: pypa/gh-action-pypi-publish@master
3233
with:
3334
user: __token__

noxfile.py

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,60 @@
11
import nox
22

3+
nox.options.sessions = ["pre_commit", "tests"]
4+
35

46
@nox.session
57
def pre_commit(session):
8+
"""pre-commit checks"""
69
session.install("pre-commit")
710
session.run("pre-commit", "run", "-a")
811

912

10-
@nox.session(python=["3.6", "3.7"])
13+
@nox.session(python=["3.6", "3.7", "3.8"])
1114
def tests(session):
12-
session.install("pytest", "ruamel.yaml", ".")
13-
session.run("pytest", "-sqvv", "tests")
15+
"""Run unit test over different python env with code coverage"""
16+
session.install("pytest", "pytest-cov", "ruamel.yaml", "-e", ".")
17+
session.run(
18+
"py.test",
19+
"--cov=linkstatus",
20+
"--cov-report",
21+
"term-missing",
22+
"--cov-branch",
23+
"--color=yes",
24+
"-s",
25+
"-v",
26+
)
27+
28+
29+
@nox.session()
30+
def ci_tests(session):
31+
"""This is only to run test on ci"""
32+
session.install("pytest", "pytest-cov", "coverage", "ruamel.yaml", "-e", ".")
33+
session.run(
34+
"py.test",
35+
"--cov=linkstatus",
36+
"--cov-report=xml",
37+
"--cov-branch",
38+
"--color=yes",
39+
"-s",
40+
"-v",
41+
)
42+
session.run("coverage", "report")
43+
44+
45+
@nox.session()
46+
def package(session):
47+
"""Build and verify package"""
48+
session.install("twine", "setuptools", "wheel")
49+
session.run("python", "setup.py", "sdist", "bdist_wheel")
50+
session.run("ls", "-l", "dist")
51+
session.run("python", "-m", "twine", "check", "dist/*")
52+
53+
54+
@nox.session()
55+
def dev_setup(session):
56+
"""Ensure development environment works everywhere. mainly with ci on different platform"""
57+
session.run("python", "-m", "pip", "install", "-e", ".[dev]")
58+
session.run("python", "-c", "import linkstatus; print(linkstatus.__spec__)")
59+
session.install("pytest", "ruamel.yaml")
60+
session.run("py.test", "-v", "tests/test_linkstatus.py")

0 commit comments

Comments
 (0)