11---
22name : " CI"
3- concurrency : # Cancel any existing runs of this workflow for this same PR
4- group : " ${{ '{{ github.workflow }}' }} -${{ '{{ github.ref }}' }}"
3+ concurrency : # Cancel any existing runs of this workflow for this same PR
4+ group : " ${{ github.workflow }}-${{ github.ref }}"
55 cancel-in-progress : true
6- on : # yamllint disable-line rule:truthy rule:comments
6+ on : # yamllint disable-line rule:truthy rule:comments
77 push :
88 branches :
99 - " main"
1010 - " develop"
11- tags :
12- - " v*"
1311 pull_request : ~
1412
1513env :
1816
1917jobs :
2018 ruff-format :
21- runs-on : " ubuntu-24.04 "
19+ runs-on : " ubuntu-latest "
2220 env :
2321 INVOKE_PARSER_LOCAL : " True"
2422 steps :
@@ -27,11 +25,11 @@ jobs:
2725 - name : " Setup environment"
2826 uses : " networktocode/gh-action-setup-poetry-environment@v6"
2927 with :
30- poetry-version : " 1.8.5 "
28+ poetry-version : " 2.1.3 "
3129 - name : " Linting: ruff format"
3230 run : " poetry run invoke ruff --action format"
3331 ruff-lint :
34- runs-on : " ubuntu-24.04 "
32+ runs-on : " ubuntu-latest "
3533 env :
3634 INVOKE_PARSER_LOCAL : " True"
3735 steps :
@@ -40,25 +38,25 @@ jobs:
4038 - name : " Setup environment"
4139 uses : " networktocode/gh-action-setup-poetry-environment@v6"
4240 with :
43- poetry-version : " 1.8.5 "
41+ poetry-version : " 2.1.3 "
4442 - name : " Linting: ruff"
4543 run : " poetry run invoke ruff --action lint"
46- # Temporarily disabled due to issues with the docs build and needing best practices for NTC python builds.
47- # check-docs-build:
48- # runs-on: "ubuntu-24.04"
49- # env:
50- # INVOKE_PARSER_LOCAL: "True"
51- # steps:
52- # - name : "Check out repository code "
53- # uses : "actions/checkout@v4 "
54- # - name : "Setup environment"
55- # uses: "networktocode/gh-action-setup-poetry-environment@v6"
56- # with:
57- # poetry-version : "1.8.5 "
58- # - name: "Check Docs Build"
59- # run: "poetry run invoke build-and-check-docs"
44+ check- docs- build:
45+ runs-on : " ubuntu-latest "
46+ env :
47+ INVOKE_PARSER_LOCAL : " True "
48+ steps :
49+ - name : " Check out repository code "
50+ uses : " actions/checkout@v4 "
51+ - name : " Setup environment "
52+ uses : " networktocode/gh-action-setup-poetry- environment@v6 "
53+ with :
54+ poetry-version : " 2.1.3 "
55+ poetry-install-options : " --only dev,docs "
56+ - name : " Check Docs Build"
57+ run : " poetry run invoke build-and-check-docs"
6058 poetry :
61- runs-on : " ubuntu-24.04 "
59+ runs-on : " ubuntu-latest "
6260 env :
6361 INVOKE_PARSER_LOCAL : " True"
6462 steps :
@@ -67,15 +65,11 @@ jobs:
6765 - name : " Setup environment"
6866 uses : " networktocode/gh-action-setup-poetry-environment@v6"
6967 with :
70- poetry-version : " 1.8.5 "
68+ poetry-version : " 2.1.3 "
7169 - name : " Checking: poetry lock file"
72- run : " poetry lock --check"
73- needs :
74- - " ruff-format"
75- - " ruff-lint"
76- - " yamllint"
70+ run : " poetry run invoke lock --check"
7771 yamllint :
78- runs-on : " ubuntu-24.04 "
72+ runs-on : " ubuntu-latest "
7973 env :
8074 INVOKE_PARSER_LOCAL : " True"
8175 steps :
@@ -84,32 +78,36 @@ jobs:
8478 - name : " Setup environment"
8579 uses : " networktocode/gh-action-setup-poetry-environment@v6"
8680 with :
87- poetry-version : " 1.8.5 "
81+ poetry-version : " 2.1.3 "
8882 - name : " Linting: yamllint"
8983 run : " poetry run invoke yamllint"
84+ check-in-docker :
9085 needs :
9186 - " ruff-format"
9287 - " ruff-lint"
93- pylint :
94- runs-on : " ubuntu-24.04"
88+ - " poetry"
89+ - " yamllint"
90+ runs-on : " ubuntu-latest"
9591 strategy :
9692 fail-fast : true
9793 matrix :
98- python-version : ["3.10", "3.11", "3.12", "3.13"]
94+ python-version : ["3.10", "3.11", "3.12", "3.13", "3.14" ]
9995 env :
100- PYTHON_VER : " ${{ matrix.python-version }}"
96+ INVOKE_PARSER_PYTHON_VER : " ${{ matrix.python-version }}"
10197 steps :
10298 - name : " Check out repository code"
10399 uses : " actions/checkout@v4"
104100 - name : " Setup environment"
105101 uses : " networktocode/gh-action-setup-poetry-environment@v6"
102+ with :
103+ poetry-version : " 2.1.3"
106104 - name : " Get image version"
107- run : " echo INVOKE_PARSER_IMAGE_VER=`poetry version -s`-py$$ {{ matrix.python-version }} >> $GITHUB_ENV"
105+ run : " echo INVOKE_PARSER_IMAGE_VER=`poetry version -s`-py${{ matrix.python-version }} >> $GITHUB_ENV"
108106 - name : " Set up Docker Buildx"
109107 id : " buildx"
110- uses : " docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2" # v3.10.0
108+ uses : " docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2" # v3.10.0
111109 - name : " Build"
112- uses : " docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25" # v5.4.0
110+ uses : " docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25" # v5.4.0
113111 with :
114112 builder : " ${{ steps.buildx.outputs.name }}"
115113 context : " ./"
@@ -120,33 +118,33 @@ jobs:
120118 cache-from : " type=gha,scope=${{ env.INVOKE_PARSER_IMAGE_NAME }}-${{ env.INVOKE_PARSER_IMAGE_VER }}-py${{ matrix.python-version }}"
121119 cache-to : " type=gha,scope=${{ env.INVOKE_PARSER_IMAGE_NAME }}-${{ env.INVOKE_PARSER_IMAGE_VER }}-py${{ matrix.python-version }}"
122120 build-args : |
123- PYTHON_VER=${{ env.PYTHON_VER }}
124- - name : " Debug: Show docker images"
125- run : " docker image ls"
121+ PYTHON_VER=${{ matrix.python-version }}
126122 - name : " Linting: Pylint"
127123 run : " poetry run invoke pylint"
128- needs :
129- - " poetry"
130124 pytest :
125+ needs :
126+ - " check-in-docker"
131127 strategy :
132128 fail-fast : true
133129 matrix :
134- python-version : ["3.10", "3.11", "3.12", "3.13"]
135- runs-on : " ubuntu-24.04 "
130+ python-version : ["3.10", "3.11", "3.12", "3.13", "3.14" ]
131+ runs-on : " ubuntu-latest "
136132 env :
137- PYTHON_VER : " ${{ matrix.python-version }}"
133+ INVOKE_PARSER_PYTHON_VER : " ${{ matrix.python-version }}"
138134 steps :
139135 - name : " Check out repository code"
140136 uses : " actions/checkout@v4"
141137 - name : " Setup environment"
142138 uses : " networktocode/gh-action-setup-poetry-environment@v6"
139+ with :
140+ poetry-version : " 2.1.3"
143141 - name : " Get image version"
144142 run : " echo INVOKE_PARSER_IMAGE_VER=`poetry version -s`-py${{ matrix.python-version }} >> $GITHUB_ENV"
145143 - name : " Set up Docker Buildx"
146144 id : " buildx"
147- uses : " docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2" # v3.10.0
145+ uses : " docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2" # v3.10.0
148146 - name : " Build"
149- uses : " docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25" # v5.4.0
147+ uses : " docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25" # v5.4.0
150148 with :
151149 builder : " ${{ steps.buildx.outputs.name }}"
152150 context : " ./"
@@ -157,46 +155,14 @@ jobs:
157155 cache-from : " type=gha,scope=${{ env.INVOKE_PARSER_IMAGE_NAME }}-${{ env.INVOKE_PARSER_IMAGE_VER }}-py${{ matrix.python-version }}"
158156 cache-to : " type=gha,scope=${{ env.INVOKE_PARSER_IMAGE_NAME }}-${{ env.INVOKE_PARSER_IMAGE_VER }}-py${{ matrix.python-version }}"
159157 build-args : |
160- PYTHON_VER=${{ env.PYTHON_VER }}
161- - name : " Debug: Show docker images"
162- run : " docker image ls"
158+ PYTHON_VER=${{ matrix.python-version }}
163159 - name : " Run Tests"
164160 run : " poetry run invoke pytest"
165- needs :
166- - " poetry"
167- publish_gh :
168- name : " Publish to GitHub"
169- runs-on : " ubuntu-24.04"
170- # yamllint disable-line rule:quoted-strings
171- if : startsWith(github.ref, 'refs/tags/v')
172- steps :
173- - name : " Check out repository code"
174- uses : " actions/checkout@v4"
175- - name : " Set up Python"
176- uses : " actions/setup-python@v5"
177- with :
178- python-version : " 3.10"
179- - name : " Install Python Packages"
180- run : " pip install poetry"
181- - name : " Set env"
182- run : " echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
183- - name : " Run Poetry Version"
184- run : " poetry version $RELEASE_VERSION"
185- - name : " Build Documentation"
186- run : " poetry run invoke build-and-check-docs"
187- - name : " Run Poetry Build"
188- run : " poetry build"
189- - name : " Upload binaries to release"
190- run : " gh release upload ${{ github.ref_name }} dist/*.{tar.gz,whl}"
191- env :
192- GH_TOKEN : " ${{ secrets.NTC_GITHUB_TOKEN }}"
193- needs :
194- - " pytest"
195161 changelog :
196162 if : >
197163 contains(fromJson('["develop"]'), github.base_ref) &&
198164 (github.head_ref != 'main') && (!startsWith(github.head_ref, 'release'))
199- runs-on : " ubuntu-22.04 "
165+ runs-on : " ubuntu-latest "
200166 steps :
201167 - name : " Check out repository code"
202168 uses : " actions/checkout@v4"
@@ -205,70 +171,8 @@ jobs:
205171 - name : " Setup environment"
206172 uses : " networktocode/gh-action-setup-poetry-environment@v6"
207173 with :
208- poetry-version : " 1.8.5 "
174+ poetry-version : " 2.1.3 "
209175 - name : " Check for changelog entry"
210176 run : |
211177 git fetch --no-tags origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
212178 poetry run towncrier check --compare-with origin/${{ github.base_ref }}
213- publish_pypi :
214- name : " Push Package to PyPI"
215- runs-on : " ubuntu-24.04"
216- # yamllint disable-line rule:quoted-strings
217- if : startsWith(github.ref, 'refs/tags/v')
218- steps :
219- - name : " Check out repository code"
220- uses : " actions/checkout@v4"
221- - name : " Set up Python"
222- uses : " actions/setup-python@v5"
223- with :
224- python-version : " 3.10"
225- - name : " Install Python Packages"
226- run : " pip install poetry"
227- - name : " Set env"
228- run : " echo RELEASE_VERSION=${GITHUB_REF:10} >> $GITHUB_ENV"
229- - name : " Run Poetry Version"
230- run : " poetry version $RELEASE_VERSION"
231- - name : " Run Poetry Build"
232- run : " poetry build"
233- - name : " Push to PyPI"
234- uses : " pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc" # v1.12.4
235- with :
236- user : " __token__"
237- password : " ${{ secrets.PYPI_API_TOKEN }}"
238- needs :
239- - " pytest"
240- slack-notify :
241- needs :
242- - " publish_gh"
243- - " publish_pypi"
244- runs-on : " ubuntu-24.04"
245- env :
246- SLACK_WEBHOOK_URL : " ${{ secrets.SLACK_WEBHOOK_URL }}"
247- SLACK_MESSAGE : >-
248- *NOTIFICATION: NEW-RELEASE-PUBLISHED*\n
249- Repository: <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>\n
250- Release: <${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}|${{ github.ref_name }}>\n
251- Published by: <${{ github.server_url }}/${{ github.actor }}|${{ github.actor }}>
252- steps :
253- - name : " Send a notification to Slack"
254- # ENVs cannot be used directly in job.if. This is a workaround to check
255- # if SLACK_WEBHOOK_URL is present.
256- if : " env.SLACK_WEBHOOK_URL != ''"
257- uses : " slackapi/slack-github-action@fcfb566f8b0aab22203f066d80ca1d7e4b5d05b3" # v1.27.1
258- with :
259- payload : |
260- {
261- "text": "${{ env.SLACK_MESSAGE }}",
262- "blocks": [
263- {
264- "type": "section",
265- "text": {
266- "type": "mrkdwn",
267- "text": "${{ env.SLACK_MESSAGE }}"
268- }
269- }
270- ]
271- }
272- env :
273- SLACK_WEBHOOK_URL : " ${{ secrets.SLACK_WEBHOOK_URL }}"
274- SLACK_WEBHOOK_TYPE : " INCOMING_WEBHOOK"
0 commit comments