Skip to content
This repository was archived by the owner on Oct 13, 2024. It is now read-only.

Commit 38e3238

Browse files
chore: update global workflows (#590)
Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
1 parent 9ef4ad6 commit 38e3238

File tree

10 files changed

+272
-150
lines changed

10 files changed

+272
-150
lines changed

.flake8

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[flake8]
22
filename =
3-
*.py,
4-
*.pys
3+
*.py
54
max-line-length = 120
65
extend-exclude =
76
venv/

.github/ISSUE_TEMPLATE/config.yml

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

.github/dependabot.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,31 @@ updates:
1818
interval: "daily"
1919
time: "08:30"
2020
open-pull-requests-limit: 10
21+
groups:
22+
docker-actions:
23+
applies-to: version-updates
24+
patterns:
25+
- "docker/*"
26+
github-actions:
27+
applies-to: version-updates
28+
patterns:
29+
- "actions/*"
30+
- "github/*"
31+
lizardbyte-actions:
32+
applies-to: version-updates
33+
patterns:
34+
- "LizardByte/*"
2135

2236
- package-ecosystem: "npm"
2337
directory: "/"
2438
schedule:
2539
interval: "daily"
2640
time: "09:00"
2741
open-pull-requests-limit: 10
42+
groups:
43+
dev-dependencies:
44+
applies-to: version-updates
45+
dependency-type: "development"
2846

2947
- package-ecosystem: "nuget"
3048
directory: "/"
@@ -39,6 +57,11 @@ updates:
3957
interval: "daily"
4058
time: "10:00"
4159
open-pull-requests-limit: 10
60+
groups:
61+
pytest-dependencies:
62+
applies-to: version-updates
63+
patterns:
64+
- "pytest*"
4265

4366
- package-ecosystem: "gitsubmodule"
4467
directory: "/"

.github/workflows/ci-docker.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -120,34 +120,6 @@ jobs:
120120
dotnet: ${{ needs.check_dockerfiles.outputs.dotnet }}
121121
github_token: ${{ secrets.GITHUB_TOKEN }}
122122

123-
lint_dockerfile:
124-
needs: [check_dockerfiles]
125-
if: ${{ needs.check_dockerfiles.outputs.dockerfiles }}
126-
runs-on: ubuntu-latest
127-
strategy:
128-
fail-fast: false
129-
matrix: ${{ fromJson(needs.check_dockerfiles.outputs.matrix) }}
130-
name: Lint Dockerfile${{ matrix.tag }}
131-
132-
steps:
133-
- name: Checkout
134-
uses: actions/checkout@v4
135-
136-
- name: Hadolint
137-
id: hadolint
138-
uses: hadolint/hadolint-action@v3.1.0
139-
with:
140-
dockerfile: ${{ matrix.dockerfile }}
141-
ignore: DL3008,DL3013,DL3016,DL3018,DL3028,DL3059
142-
output-file: ./hadolint.log
143-
verbose: true
144-
145-
- name: Log
146-
if: failure()
147-
run: |
148-
echo "Hadolint outcome: ${{ steps.hadolint.outcome }}" >> $GITHUB_STEP_SUMMARY
149-
cat "./hadolint.log" >> $GITHUB_STEP_SUMMARY
150-
151123
docker:
152124
needs: [check_dockerfiles, setup_release]
153125
if: ${{ needs.check_dockerfiles.outputs.dockerfiles }}

.github/workflows/common-lint.yml

Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
---
2+
# This action is centrally managed in https://github.com/<organization>/.github/
3+
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
4+
# the above-mentioned repo.
5+
6+
# Common linting.
7+
8+
name: common lint
9+
10+
on:
11+
pull_request:
12+
branches: [master]
13+
types: [opened, synchronize, reopened]
14+
15+
concurrency:
16+
group: "${{ github.workflow }}-${{ github.ref }}"
17+
cancel-in-progress: true
18+
19+
jobs:
20+
lint:
21+
name: Common Lint
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: '3.12'
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade \
35+
pip \
36+
setuptools \
37+
wheel \
38+
cmakelang \
39+
flake8 \
40+
nb-clean \
41+
nbqa[toolchain]
42+
43+
- name: C++ - find files
44+
id: cpp_files
45+
run: |
46+
# find files
47+
found_files=$(find . -type f \
48+
-iname "*.c" -o \
49+
-iname "*.cpp" -o \
50+
-iname "*.h" -o \
51+
-iname "*.hpp" -o \
52+
-iname "*.m" -o \
53+
-iname "*.mm" \
54+
)
55+
ignore_files=$(find . -type f -iname ".clang-format-ignore")
56+
57+
# Loop through each C++ file
58+
for file in $found_files; do
59+
for ignore_file in $ignore_files; do
60+
ignore_directory=$(dirname "$ignore_file")
61+
# if directory of ignore_file is beginning of file
62+
if [[ "$file" == "$ignore_directory"* ]]; then
63+
echo "ignoring file: ${file}"
64+
found_files="${found_files//${file}/}"
65+
break 1
66+
fi
67+
done
68+
done
69+
70+
# remove empty lines
71+
found_files=$(echo "$found_files" | sed '/^\s*$/d')
72+
73+
echo "found cpp files: ${found_files}"
74+
75+
# do not quote to keep this as a single line
76+
echo found_files=${found_files} >> $GITHUB_OUTPUT
77+
78+
- name: C++ - Clang format lint
79+
if: always() && steps.cpp_files.outputs.found_files
80+
uses: DoozyX/clang-format-lint-action@v0.18
81+
with:
82+
source: ${{ steps.cpp_files.outputs.found_files }}
83+
extensions: 'c,cpp,h,hpp,m,mm'
84+
style: file
85+
inplace: false
86+
87+
- name: CMake - find files
88+
id: cmake_files
89+
if: always()
90+
run: |
91+
# find files
92+
found_files=$(find . -type f -iname "CMakeLists.txt" -o -iname "*.cmake")
93+
ignore_files=$(find . -type f -iname ".cmake-lint-ignore")
94+
95+
# Loop through each C++ file
96+
for file in $found_files; do
97+
for ignore_file in $ignore_files; do
98+
ignore_directory=$(dirname "$ignore_file")
99+
# if directory of ignore_file is beginning of file
100+
if [[ "$file" == "$ignore_directory"* ]]; then
101+
echo "ignoring file: ${file}"
102+
found_files="${found_files//${file}/}"
103+
break 1
104+
fi
105+
done
106+
done
107+
108+
# remove empty lines
109+
found_files=$(echo "$found_files" | sed '/^\s*$/d')
110+
111+
echo "found cmake files: ${found_files}"
112+
113+
# do not quote to keep this as a single line
114+
echo found_files=${found_files} >> $GITHUB_OUTPUT
115+
116+
- name: CMake - cmake-lint
117+
if: always() && steps.cmake_files.outputs.found_files
118+
run: |
119+
cmake-lint --line-width 120 --tab-size 4 ${{ steps.cmake_files.outputs.found_files }}
120+
121+
- name: Docker - find files
122+
id: dokcer_files
123+
if: always()
124+
run: |
125+
found_files=$(find . -type f -iname "Dockerfile" -o -iname "*.dockerfile")
126+
127+
echo "found_files: ${found_files}"
128+
129+
# do not quote to keep this as a single line
130+
echo found_files=${found_files} >> $GITHUB_OUTPUT
131+
132+
- name: Docker - hadolint
133+
if: always() && steps.dokcer_files.outputs.found_files
134+
run: |
135+
docker pull hadolint/hadolint
136+
137+
# create hadolint config file
138+
cat <<EOF > .hadolint.yaml
139+
---
140+
ignored:
141+
- DL3008
142+
- DL3013
143+
- DL3016
144+
- DL3018
145+
- DL3028
146+
- DL3059
147+
EOF
148+
149+
failed=0
150+
failed_files=""
151+
152+
for file in ${{ steps.dokcer_files.outputs.found_files }}; do
153+
echo "::group::${file}"
154+
docker run --rm -i \
155+
-e "NO_COLOR=0" \
156+
-e "HADOLINT_VERBOSE=1" \
157+
-v $(pwd)/.hadolint.yaml:/.config/hadolint.yaml \
158+
hadolint/hadolint < $file || {
159+
failed=1
160+
failed_files="$failed_files $file"
161+
}
162+
echo "::endgroup::"
163+
done
164+
165+
if [ $failed -ne 0 ]; then
166+
echo "::error:: hadolint failed for the following files: $failed_files"
167+
exit 1
168+
fi
169+
170+
- name: Python - flake8
171+
if: always()
172+
run: |
173+
python -m flake8 \
174+
--color=always \
175+
--verbose
176+
177+
- name: Python - nbqa flake8
178+
if: always()
179+
run: |
180+
python -m nbqa flake8 \
181+
--color=always \
182+
--verbose \
183+
.
184+
185+
- name: Python - nb-clean
186+
if: always()
187+
run: |
188+
output=$(find . -name '*.ipynb' -exec nb-clean check {} \;)
189+
190+
# fail if there are any issues
191+
if [ -n "$output" ]; then
192+
echo "$output"
193+
exit 1
194+
fi
195+
196+
- name: YAML - find files
197+
id: yaml_files
198+
if: always()
199+
run: |
200+
# space separated list of files
201+
FILES=.clang-format
202+
203+
# empty placeholder
204+
found_files=""
205+
206+
for FILE in ${FILES}; do
207+
if [ -f "$FILE" ]
208+
then
209+
found_files="$found_files $FILE"
210+
fi
211+
done
212+
213+
echo "found_files=${found_files}" >> $GITHUB_OUTPUT
214+
215+
- name: YAML - yamllint
216+
id: yamllint
217+
if: always()
218+
uses: ibiqlik/action-yamllint@v3
219+
with:
220+
# https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration
221+
config_data: |
222+
extends: default
223+
rules:
224+
comments:
225+
level: error
226+
document-start:
227+
level: error
228+
line-length:
229+
max: 120
230+
new-line-at-end-of-file:
231+
level: error
232+
new-lines:
233+
type: unix
234+
truthy:
235+
# GitHub uses "on" for workflow event triggers
236+
# .clang-format file has options of "Yes" "No" that will be caught by this, so changed to "warning"
237+
allowed-values: ['true', 'false', 'on']
238+
check-keys: true
239+
level: warning
240+
file_or_dir: . ${{ steps.yaml_files.outputs.found_files }}
241+
242+
- name: YAML - log
243+
if: always() && steps.yamllint.outcome == 'failure'
244+
run: |
245+
cat "${{ steps.yamllint.outputs.logfile }}" >> $GITHUB_STEP_SUMMARY

.github/workflows/python-flake8.yml

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

.github/workflows/release-notifier.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
id: output
2929
run: |
3030
echo "${RELEASE_BODY}" > ./release_body.md
31-
modified_body=$(sed '/^---$/d; /^## Contributors$/,/<\/a>/d' ./release_body.md)
31+
modified_body=$(sed '/^---/,$d' ./release_body.md)
3232
echo "modified_body: ${modified_body}"
3333
3434
# use a heredoc to ensure the output is multiline

0 commit comments

Comments
 (0)