Skip to content

Commit a69d2f3

Browse files
authored
Merge pull request #236 from networktocode/gha-fix
Fix the CI/CD pipeline
2 parents 13a3227 + aea013e commit a69d2f3

File tree

1 file changed

+38
-78
lines changed

1 file changed

+38
-78
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,21 @@ jobs:
1111
steps:
1212
- name: "Check out repository code"
1313
uses: "actions/checkout@v2"
14-
- name: "Set up Python"
15-
uses: "actions/setup-python@v2"
16-
with:
17-
python-version: "3.9"
18-
- name: "Install Python Packages for Linting"
19-
run: "pip install --upgrade pip wheel invoke toml"
20-
- name: "Install Poetry Packages"
21-
run: |
22-
pip install poetry
23-
poetry config virtualenvs.create false
24-
poetry config installer.parallel false
25-
poetry install --no-interaction --no-ansi --no-root
14+
- name: "Setup environment"
15+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
2616
- name: "Linting: Black"
27-
run: "invoke black"
17+
run: "poetry run invoke black"
2818
bandit:
2919
runs-on: "ubuntu-20.04"
3020
env:
3121
INVOKE_LOCAL: "True"
3222
steps:
3323
- name: "Check out repository code"
3424
uses: "actions/checkout@v2"
35-
- name: "Set up Python"
36-
uses: "actions/setup-python@v2"
37-
with:
38-
python-version: "3.9"
39-
- name: "Install Python Packages for Linting"
40-
run: "pip install --upgrade pip wheel invoke toml"
41-
- name: "Install Poetry Packages"
42-
run: |
43-
pip install poetry
44-
poetry config virtualenvs.create false
45-
poetry config installer.parallel false
46-
poetry install --no-interaction --no-ansi --no-root
25+
- name: "Setup environment"
26+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
4727
- name: "Linting: Bandit"
48-
run: "invoke bandit"
28+
run: "poetry run invoke bandit"
4929
needs:
5030
- "black"
5131
pydocstyle:
@@ -55,20 +35,10 @@ jobs:
5535
steps:
5636
- name: "Check out repository code"
5737
uses: "actions/checkout@v2"
58-
- name: "Set up Python"
59-
uses: "actions/setup-python@v2"
60-
with:
61-
python-version: "3.9"
62-
- name: "Install Python Packages for Linting"
63-
run: "pip install --upgrade pip wheel invoke toml"
64-
- name: "Install Poetry Packages"
65-
run: |
66-
pip install poetry
67-
poetry config virtualenvs.create false
68-
poetry config installer.parallel false
69-
poetry install --no-interaction --no-ansi --no-root
38+
- name: "Setup environment"
39+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
7040
- name: "Linting: pydocstyle"
71-
run: "invoke pydocstyle"
41+
run: "poetry run invoke pydocstyle"
7242
needs:
7343
- "black"
7444
flake8:
@@ -91,7 +61,7 @@ jobs:
9161
poetry config installer.parallel false
9262
poetry install --no-interaction --no-ansi --no-root
9363
- name: "Linting: flake8"
94-
run: "invoke flake8"
64+
run: "poetry run invoke flake8"
9565
needs:
9666
- "black"
9767
yamllint:
@@ -101,35 +71,21 @@ jobs:
10171
steps:
10272
- name: "Check out repository code"
10373
uses: "actions/checkout@v2"
104-
- name: "Set up Python"
105-
uses: "actions/setup-python@v2"
106-
with:
107-
python-version: "3.9"
108-
- name: "Install Python Packages for Linting"
109-
run: "pip install --upgrade pip wheel invoke toml"
110-
- name: "Install Poetry Packages"
111-
run: |
112-
pip install poetry
113-
poetry config virtualenvs.create false
114-
poetry config installer.parallel false
115-
poetry install --no-interaction --no-ansi --no-root
74+
- name: "Setup environment"
75+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
11676
- name: "Linting: yamllint"
117-
run: "invoke yamllint"
77+
run: "poetry run invoke yamllint"
11878
needs:
11979
- "black"
12080
build:
12181
runs-on: "ubuntu-20.04"
12282
steps:
12383
- name: "Check out repository code"
12484
uses: "actions/checkout@v2"
125-
- name: "Set up Python"
126-
uses: "actions/setup-python@v2"
127-
with:
128-
python-version: "3.9"
129-
- name: "Install Python Packages for Setup"
130-
run: "pip install invoke poetry toml"
85+
- name: "Setup environment"
86+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
13187
- name: "Build Container"
132-
run: "invoke build-image"
88+
run: "poetry run invoke build-image"
13389
needs:
13490
- "bandit"
13591
- "pydocstyle"
@@ -140,16 +96,12 @@ jobs:
14096
steps:
14197
- name: "Check out repository code"
14298
uses: "actions/checkout@v2"
143-
- name: "Set up Python"
144-
uses: "actions/setup-python@v2"
145-
with:
146-
python-version: "3.9"
147-
- name: "Install Python Packages for Linting"
148-
run: "pip install invoke poetry toml"
99+
- name: "Setup environment"
100+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
149101
- name: "Build Container"
150-
run: "invoke build-image"
102+
run: "poetry run invoke build-image"
151103
- name: "Linting: Pylint"
152-
run: "invoke pylint"
104+
run: "poetry run invoke pylint"
153105
needs:
154106
- "build"
155107
pytest:
@@ -163,16 +115,12 @@ jobs:
163115
steps:
164116
- name: "Check out repository code"
165117
uses: "actions/checkout@v2"
166-
- name: "Set up Python"
167-
uses: "actions/setup-python@v2"
168-
with:
169-
python-version: "3.9"
170-
- name: "Install Python Packages for Linting"
171-
run: "pip install invoke poetry toml"
118+
- name: "Setup environment"
119+
uses: "networktocode/gh-action-setup-poetry-environment@v2"
172120
- name: "Build Container"
173-
run: "invoke build-image"
121+
run: "poetry run invoke build-image"
174122
- name: "Run Tests"
175-
run: "invoke pytest"
123+
run: "poetry run invoke pytest"
176124
needs:
177125
- "pylint"
178126
integration_nautobot:
@@ -284,9 +232,9 @@ jobs:
284232
with:
285233
python-version: "3.9"
286234
- name: "Install Python Packages for Publishing"
287-
run: "pip install invoke poetry toml"
235+
run: "pip install poetry"
288236
- name: "Set env"
289-
run: "echo ::set-env name=RELEASE_VERSION::$(echo ${GITHUB_REF:10})"
237+
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
290238
- name: "Run Poetry Version"
291239
run: "poetry version $RELEASE_VERSION"
292240
- name: "Run Poetry Build"
@@ -311,6 +259,18 @@ jobs:
311259
steps:
312260
- name: "Check out repository code"
313261
uses: "actions/checkout@v2"
262+
- name: "Set up Python"
263+
uses: "actions/setup-python@v2"
264+
with:
265+
python-version: "3.9"
266+
- name: "Install Python Packages"
267+
run: "pip install poetry"
268+
- name: "Set env"
269+
run: "echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
270+
- name: "Run Poetry Version"
271+
run: "poetry version $RELEASE_VERSION"
272+
- name: "Run Poetry Build"
273+
run: "poetry build"
314274
- name: "Push to PyPI"
315275
uses: "pypa/gh-action-pypi-publish@release/v1"
316276
with:

0 commit comments

Comments
 (0)