Skip to content

Commit 74736c0

Browse files
authored
Add linting workflow with yamllint; fix linting issues (#396)
* Add linting workflow with yamllint. Fix linting issues. * Use nox for running yamllint.
1 parent 043485a commit 74736c0

10 files changed

+110
-26
lines changed

Diff for: .github/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
# Copyright (c) Ansible Project
3-
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
3+
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
44
# SPDX-License-Identifier: GPL-3.0-or-later
55

66
version: 2

Diff for: .github/workflows/ansible-release.yml

+24-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
---
2+
# Copyright (c) Ansible Project
3+
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
4+
# SPDX-License-Identifier: GPL-3.0-or-later
5+
16
name: Release Ansible package
2-
on:
7+
'on':
38
workflow_dispatch:
49
inputs:
510
ansible-version:
@@ -142,26 +147,25 @@ jobs:
142147
id-token: write
143148

144149
steps:
150+
- name: Ensure that the PR was merged
151+
env:
152+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153+
PR_URL: ${{ needs.build.outputs.pr_url }}
154+
run: |
155+
STATE="$(gh pr view "${PR_URL}" --json state --template "{{.state}}")"
156+
if [ "${STATE}" != "MERGED" ]; then
157+
echo "::error ::The state of PR ${PR_URL} must be MERGED, not ${STATE}"
158+
exit 1
159+
fi
160+
161+
- name: Download artifact
162+
uses: actions/download-artifact@v4
163+
with:
164+
name: sdist-and-wheel
165+
path: dist/
145166

146-
- name: Ensure that the PR was merged
147-
env:
148-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
149-
PR_URL: ${{ needs.build.outputs.pr_url }}
150-
run: |
151-
STATE="$(gh pr view "${PR_URL}" --json state --template "{{.state}}")"
152-
if [ "${STATE}" != "MERGED" ]; then
153-
echo "::error ::The state of PR ${PR_URL} must be MERGED, not ${STATE}"
154-
exit 1
155-
fi
156-
157-
- name: Download artifact
158-
uses: actions/download-artifact@v4
159-
with:
160-
name: sdist-and-wheel
161-
path: dist/
162-
163-
- name: Upload Ansible sdist and wheel to PyPI
164-
uses: pypa/gh-action-pypi-publish@release/v1
167+
- name: Upload Ansible sdist and wheel to PyPI
168+
uses: pypa/gh-action-pypi-publish@release/v1
165169

166170
# git-tag job creates the git tag
167171

@@ -174,7 +178,6 @@ jobs:
174178
contents: write
175179

176180
steps:
177-
178181
- name: Check out ansible-build-data
179182
uses: actions/checkout@v4
180183
with:

Diff for: .github/workflows/antsibull-build.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
---
2+
# Copyright (c) Ansible Project
3+
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
4+
# SPDX-License-Identifier: GPL-3.0-or-later
5+
16
name: antsibull-build
2-
on:
7+
'on':
38
push:
49
branches: [main]
510
pull_request:

Diff for: .github/workflows/nox.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
# SPDX-FileCopyrightText: 2023 Maxwell G <[email protected]
5+
6+
name: nox
7+
'on':
8+
push:
9+
branches: [main]
10+
pull_request:
11+
branches: [main]
12+
# Run once per week (Thursday at 04:00 UTC)
13+
schedule:
14+
- cron: '0 4 * * 4'
15+
workflow_dispatch:
16+
17+
env:
18+
FORCE_COLOR: "1"
19+
20+
jobs:
21+
nox:
22+
runs-on: ubuntu-latest
23+
defaults:
24+
run:
25+
working-directory: antsibull
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
include:
30+
- session: lint
31+
python-versions: "3.12"
32+
name: "Run nox ${{ matrix.session }} session"
33+
steps:
34+
- name: Check out antsibull
35+
uses: actions/checkout@v4
36+
with:
37+
path: antsibull
38+
- name: Setup nox
39+
uses: wntrblm/[email protected]
40+
with:
41+
python-versions: "${{ matrix.python-versions }}"
42+
- name: Set up nox environments
43+
run: |
44+
OTHER_ANTSIBULL_MODE=git nox -v -e "${{ matrix.session }}" ${{ matrix.codecov && 'coverage' || '' }} --install-only
45+
- name: "Run nox -e ${{ matrix.session }}"
46+
run: |
47+
OTHER_ANTSIBULL_MODE=git nox -v -e "${{ matrix.session }}" --reuse-existing-virtualenvs --no-install

Diff for: .yamllint

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
# Copyright (c) Ansible Project
3+
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
4+
# SPDX-License-Identifier: GPL-3.0-or-later
5+
6+
extends: default
7+
8+
rules:
9+
line-length: disable
10+
11+
ignore:
12+
- /.nox/
13+
- /*/ansible-*.yaml
14+
- /*/changelog.yaml
15+
- /*/galaxy-requirements.yaml

Diff for: 10/collection-meta.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ collections:
113113
- alinabuzachis
114114
- GomathiselviS
115115
- abikouo
116-
- komaldesai13
116+
- komaldesai13
117117
repository: https://github.com/ansible-collections/vmware.vmware_rest
118118
cisco.dnac:
119119
maintainers:

Diff for: 8/collection-meta.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ collections:
133133
- alinabuzachis
134134
- GomathiselviS
135135
- abikouo
136-
- komaldesai13
136+
- komaldesai13
137137
repository: https://github.com/ansible-collections/vmware.vmware_rest
138138
cisco.dnac:
139139
maintainers:

Diff for: 9/collection-meta.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ collections:
137137
- alinabuzachis
138138
- GomathiselviS
139139
- abikouo
140-
- komaldesai13
140+
- komaldesai13
141141
repository: https://github.com/ansible-collections/vmware.vmware_rest
142142
cisco.dnac:
143143
maintainers:

Diff for: README.md

+4
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ In case of a potential release blocker, the following actions need to be done:
7777
release of Ansible. This file will be created by the `antsibull-build single`
7878
command.
7979

80+
## Linting
81+
82+
To lint the files in this repository, run `nox -e lint`. This assumes you have `nox` installed.
83+
8084
## Adding a new collection
8185

8286
### Next Ansible major release

Diff for: noxfile.py

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
# SPDX-FileCopyrightText: 2023 Maxwell G <[email protected]
4+
15
from __future__ import annotations
26

37
import nox
@@ -7,3 +11,9 @@
711
def mkdocs(session: nox.Session):
812
session.install("-r", "docs-requirements.txt")
913
session.run("mkdocs", *(session.posargs or ["build"]))
14+
15+
16+
@nox.session
17+
def lint(session: nox.Session):
18+
session.install("yamllint")
19+
session.run("yamllint", ".")

0 commit comments

Comments
 (0)