Skip to content

Commit 51f6fcc

Browse files
committed
Check/lint all files, not changed files
Per review comments by @pavoljuhas, for simplicity and because this code base is fairly small, using an action to find changed files is not worth the added complexity.
1 parent 484d498 commit 51f6fcc

File tree

1 file changed

+24
-75
lines changed

1 file changed

+24
-75
lines changed

.github/workflows/ci.yaml

Lines changed: 24 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,7 @@ jobs:
6666
with:
6767
fetch-depth: 0
6868

69-
- name: Get a list of changed Python files
70-
id: changes
71-
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
72-
with:
73-
base_sha: ${{inputs.base_sha}}
74-
files: '**/*.py'
75-
7669
- name: Set up Python
77-
if: steps.changes.outputs.any_changed == 'true'
7870
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v5
7971
with:
8072
python-version: ${{env.python-version}}
@@ -84,21 +76,18 @@ jobs:
8476
dev-requirements.txt
8577
8678
- name: Install dependencies
87-
if: steps.changes.outputs.any_changed == 'true'
8879
run: pip install -r requirements.txt -r dev-requirements.txt
8980

90-
- name: Check the format of changed Python files
91-
if: steps.changes.outputs.any_changed == 'true'
81+
- name: Check format
9282
run: |
9383
echo '::add-matcher::.github/problem-matchers/flynt.json'
9484
echo '::add-matcher::.github/problem-matchers/black.json'
95-
check/format-incremental ${{inputs.base_sha}}
85+
check/format-incremental --all
9686
97-
- name: Lint the changed Python files
98-
if: steps.changes.outputs.any_changed == 'true'
87+
- name: Check lint
9988
run: |
10089
echo '::add-matcher::.github/problem-matchers/pylint.json'
101-
pylint -j 0 -v ${{steps.changes.outputs.all_changed_files}}
90+
pylint -j 0 -v .
10291
10392
docker-lint:
10493
name: Dockerfile lint checks
@@ -110,19 +99,12 @@ jobs:
11099
with:
111100
fetch-depth: 0
112101

113-
- name: Determine if Docker files were changed
114-
id: changes
115-
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
116-
with:
117-
files: '**/Dockerfile'
118-
119-
- name: Run hadolint on Dockerfiles that have been changed
120-
if: steps.changes.outputs.any_changed == 'true'
102+
- name: Run hadolint on Dockerfiles
121103
env:
122104
hadolint_version: 'sha256:e9dbf5113239ef2bf696d20c8f28d3019a47c26a38c98b89344d3e2846c4d5f8'
123105
run: |
124106
echo '::add-matcher::.github/problem-matchers/hadolint.json'
125-
for file in ${{steps.changes.outputs.all_changed_files}}; do
107+
find . -name Dockerfile | while IFS= read -r file; do
126108
echo "Checking ${file} ..."
127109
docker run --rm -i -v "${PWD}"/.hadolint.yaml:/.config/hadolint.yaml \
128110
ghcr.io/hadolint/hadolint@${{env.hadolint_version}} < "${file}"
@@ -139,21 +121,18 @@ jobs:
139121
with:
140122
fetch-depth: 0
141123

142-
- name: Determine if shell scripts were changed
143-
id: changes
144-
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
124+
- name: Install problem matcher
125+
run: echo '::add-matcher::.github/problem-matchers/shellcheck.json'
126+
127+
- name: Run ShellCheck
128+
uses: ludeeus/action-shellcheck@master
145129
with:
146-
base_sha: ${{inputs.base_sha}}
147-
files: |
148-
**/*.sh
130+
severity: error
131+
check_together: 'yes'
132+
additional_files: >-
149133
check/format-incremental
150-
151-
- name: Run shellcheck on shell scripts that have been changed
152-
if: steps.changes.outputs.any_changed == 'true'
153-
run: |
154-
echo "::add-matcher::.github/problem-matchers/shellcheck.json"
155-
shellcheck --version
156-
shellcheck ${{steps.changes.outputs.all_changed_files}}
134+
check/pylint
135+
check/pylint-changed-files
157136
158137
yaml-lint:
159138
name: YAML lint checks
@@ -165,27 +144,17 @@ jobs:
165144
with:
166145
fetch-depth: 0
167146

168-
- name: Get a list of changed YAML files
169-
id: changes
170-
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
171-
with:
172-
base_sha: ${{inputs.base_sha}}
173-
files: '**/*.{yaml,yml}'
174-
# Ignore GHA workflows here. A separate job handles workflow files.
175-
files_ignore: .github/workflows/**
176-
177147
- name: Install yamllint
178-
if: steps.changes.outputs.any_changed == 'true'
179148
run: |
180149
sudo apt-get update
181150
sudo apt-get install --no-install-recommends -y yamllint
182151
183152
- name: Lint the YAML files
184-
if: steps.changes.outputs.any_changed == 'true'
185153
run: |
186154
echo "::add-matcher::.github/problem-matchers/yamllint.json"
187-
yamllint --version
188-
yamllint -f github ${{steps.changes.outputs.all_changed_files}}
155+
find . -name '*.yaml' -o -name '*.yml' | \
156+
grep -vE '\\.github/workflows' | \
157+
xargs yamllint -f github
189158
190159
bazel-lint:
191160
name: Bazel build lint checks
@@ -197,28 +166,17 @@ jobs:
197166
with:
198167
fetch-depth: 0
199168

200-
- name: Determine if Bazel files were changed
201-
id: changes
202-
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
203-
with:
204-
base_sha: ${{inputs.base_sha}}
205-
files: |
206-
**/BUILD
207-
**/*.bzl
208-
WORKSPACE
209-
210169
- name: Install buildifier
211-
if: steps.changes.outputs.any_changed == 'true'
212170
uses: jbajic/setup-buildifier@c558ee05c6f74ab5753ff794516750b4aadac296 # v1
213171
with:
214172
buildifier-version: '8.2.1'
215173

216-
- name: Run Buildifier in lint mode on changed files
217-
if: steps.changes.outputs.any_changed == 'true'
174+
- name: Run Buildifier in lint mode
218175
run: |
219176
echo '::add-matcher::.github/problem-matchers/buildifier.json'
220-
buildifier --version
221-
buildifier -mode=diff -lint=warn ${{steps.changes.outputs.all_changed_files}}
177+
# shellcheck disable=SC2038
178+
find . -name 'BUILD' -o -name '*.bzl' -o -name 'WORKSPACE' | \
179+
xargs buildifier -mode=diff -lint=warn
222180
223181
action-lint:
224182
name: GitHub Actions lint checks
@@ -230,19 +188,10 @@ jobs:
230188
with:
231189
fetch-depth: 0
232190

233-
- name: Determine if workflow files were changed
234-
id: changes
235-
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
236-
with:
237-
base_sha: ${{inputs.base_sha}}
238-
files: .github/workflows/*.{yaml,yml}
239-
240191
- name: Run actionlint
241-
if: steps.changes.outputs.any_changed == 'true'
242192
uses: raven-actions/actionlint@3a24062651993d40fed1019b58ac6fbdfbf276cc # v2
243193
with:
244-
# Note: pass the list of files here, not via the "files:" parameter.
245-
flags: ${{inputs.debug && '-verbose'}} ${{steps.changes.outputs.all_changed_files}}
194+
flags: ${{inputs.debug && '-verbose'}} .github/workflows/*.{yaml,yml}
246195
pyflakes: false
247196

248197
library-tests:

0 commit comments

Comments
 (0)