Skip to content

Commit c2707f3

Browse files
committed
Migrate from Travis to GHA
1 parent 5718737 commit c2707f3

File tree

3 files changed

+176
-73
lines changed

3 files changed

+176
-73
lines changed

.github/workflows/ci.yml

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
---
2+
name: "CI"
3+
on:
4+
- "push"
5+
- "pull_request"
6+
jobs:
7+
black:
8+
runs-on: "ubuntu-20.04"
9+
env:
10+
INVOKE_LOCAL: "True"
11+
steps:
12+
- name: "Check out repository code"
13+
uses: "actions/checkout@v2"
14+
- name: "Setup environment"
15+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
16+
- name: "Linting: black"
17+
run: "poetry run invoke black"
18+
bandit:
19+
runs-on: "ubuntu-20.04"
20+
env:
21+
INVOKE_LOCAL: "True"
22+
steps:
23+
- name: "Check out repository code"
24+
uses: "actions/checkout@v2"
25+
- name: "Setup environment"
26+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
27+
- name: "Linting: bandit"
28+
run: "poetry run invoke bandit"
29+
needs:
30+
- "black"
31+
pydocstyle:
32+
runs-on: "ubuntu-20.04"
33+
env:
34+
INVOKE_LOCAL: "True"
35+
steps:
36+
- name: "Check out repository code"
37+
uses: "actions/checkout@v2"
38+
- name: "Setup environment"
39+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
40+
- name: "Linting: pydocstyle"
41+
run: "poetry run invoke pydocstyle"
42+
needs:
43+
- "black"
44+
flake8:
45+
runs-on: "ubuntu-20.04"
46+
env:
47+
INVOKE_LOCAL: "True"
48+
steps:
49+
- name: "Check out repository code"
50+
uses: "actions/checkout@v2"
51+
- name: "Setup environment"
52+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
53+
- name: "Linting: flake8"
54+
run: "poetry run invoke flake8"
55+
needs:
56+
- "black"
57+
mypy:
58+
runs-on: "ubuntu-20.04"
59+
env:
60+
INVOKE_LOCAL: "True"
61+
steps:
62+
- name: "Check out repository code"
63+
uses: "actions/checkout@v2"
64+
- name: "Setup environment"
65+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
66+
- name: "Linting: flake8"
67+
run: "poetry run invoke mypy"
68+
needs:
69+
- "black"
70+
yamllint:
71+
runs-on: "ubuntu-20.04"
72+
env:
73+
INVOKE_LOCAL: "True"
74+
steps:
75+
- name: "Check out repository code"
76+
uses: "actions/checkout@v2"
77+
- name: "Setup environment"
78+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
79+
- name: "Linting: yamllint"
80+
run: "poetry run invoke yamllint"
81+
needs:
82+
- "black"
83+
pylint:
84+
runs-on: "ubuntu-20.04"
85+
env:
86+
INVOKE_LOCAL: "True"
87+
steps:
88+
- name: "Check out repository code"
89+
uses: "actions/checkout@v2"
90+
- name: "Setup environment"
91+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
92+
- name: "Linting: Pylint"
93+
run: "poetry run invoke pylint"
94+
needs:
95+
- "bandit"
96+
- "pydocstyle"
97+
- "flake8"
98+
- "yamllint"
99+
- "mypy"
100+
unittest:
101+
strategy:
102+
fail-fast: true
103+
matrix:
104+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
105+
runs-on: "ubuntu-20.04"
106+
env:
107+
INVOKE_LOCAL: "True"
108+
PYTHON_VER: "${{ matrix.python-version }}"
109+
steps:
110+
- name: "Check out repository code"
111+
uses: "actions/checkout@v2"
112+
- name: "Setup environment"
113+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
114+
with:
115+
python-version: "${{ matrix.python-version }}"
116+
- name: "Run poetry Install"
117+
run: "poetry install"
118+
- name: "Run Tests"
119+
run: "poetry run invoke pytest --local"
120+
needs:
121+
- "pylint"
122+
publish_gh:
123+
name: "Publish to GitHub"
124+
runs-on: "ubuntu-20.04"
125+
if: "startsWith(github.ref, 'refs/tags/v')"
126+
steps:
127+
- name: "Check out repository code"
128+
uses: "actions/checkout@v2"
129+
- name: "Set up Python"
130+
uses: "actions/setup-python@v2"
131+
with:
132+
python-version: "3.9"
133+
- name: "Install Python Packages"
134+
run: "pip install poetry"
135+
- name: "Set env"
136+
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
137+
- name: "Run Poetry Version"
138+
run: "poetry version $RELEASE_VERSION"
139+
- name: "Upload binaries to release"
140+
uses: "svenstaro/upload-release-action@v2"
141+
with:
142+
repo_token: "${{ secrets.NTC_GITHUB_TOKEN }}"
143+
file: "dist/*"
144+
tag: "${{ github.ref }}"
145+
overwrite: true
146+
file_glob: true
147+
needs:
148+
- "unittest"
149+
publish_pypi:
150+
name: "Push Package to PyPI"
151+
runs-on: "ubuntu-20.04"
152+
if: "startsWith(github.ref, 'refs/tags/v')"
153+
steps:
154+
- name: "Check out repository code"
155+
uses: "actions/checkout@v2"
156+
- name: "Set up Python"
157+
uses: "actions/setup-python@v2"
158+
with:
159+
python-version: "3.9"
160+
- name: "Install Python Packages"
161+
run: "pip install poetry"
162+
- name: "Set env"
163+
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
164+
- name: "Run Poetry Version"
165+
run: "poetry version $RELEASE_VERSION"
166+
- name: "Push to PyPI"
167+
uses: "pypa/gh-action-pypi-publish@release/v1"
168+
with:
169+
user: "__token__"
170+
password: "${{ secrets.PYPI_API_TOKEN }}"
171+
needs:
172+
- "unittest"

.travis.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

tests/unit/test_e2e.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,12 @@
491491
Zayo,
492492
[("email", Path(dir_path, "data", "zayo", "zayo8.eml")),],
493493
[Path(dir_path, "data", "zayo", "zayo8_result.json"),],
494-
), # pylint: disable=too-many-locals
494+
),
495495
],
496496
)
497-
def test_provider_get_maintenances(provider_class, test_data_files, result_parse_files):
497+
def test_provider_get_maintenances(
498+
provider_class, test_data_files, result_parse_files
499+
): # pylint: disable=too-many-locals
498500
"""End to End tests for various Providers."""
499501
extended_data = provider_class.get_extended_data()
500502
default_maintenance_data = {"uid": "0", "sequence": 1, "summary": ""}

0 commit comments

Comments
 (0)