Skip to content

Commit 889d8b6

Browse files
authored
feat: move last SuperLinter check yamllint to pre-commit (#124)
This also removes SuperLinter from DGP since all utilized checks have been migrated to pre-commit.
1 parent f377eb4 commit 889d8b6

File tree

7 files changed

+94
-105
lines changed

7 files changed

+94
-105
lines changed

.commitlintrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
extends:
44
- '@commitlint/config-conventional'
55
rules:
6-
type-enum: [2, 'always', ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'refactor', 'revert', 'perf', 'schema', 'style', 'test']]
6+
type-enum: [2, 'always', ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'refactor', 'revert', 'perf', 'schema', 'style', 'test']]

.github/workflows/build-docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ jobs:
4141
context: .
4242
push: true
4343
tags: ${{ steps.meta.outputs.tags }}-${{ github.sha }},${{ steps.meta.outputs.tags }}
44-
labels: ${{ steps.meta.outputs.labels }}
44+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/coverage.yml

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -15,61 +15,61 @@ jobs:
1515
PYTHON: '3.9'
1616
COVERAGE_TOTAL: 49 # Coverage threshold percentage
1717
steps:
18-
- name: Checkout (admin token)
19-
if: ${{github.event_name != 'pull_request'}} # We don't want to use the admin token for PR flows
20-
uses: actions/checkout@master
21-
with:
22-
token: '${{ secrets.GIT_ADMIN_WORKFLOW_TOKEN }}'
23-
fetch-depth: "2" # Original commit + code cov badge commit
24-
- name: Checkout (normal flow)
25-
if: ${{github.event_name == 'pull_request'}}
26-
uses: actions/checkout@master
27-
with:
28-
fetch-depth: "2" # Original commit + code cov badge commit
29-
- name: Setup Python
30-
uses: actions/setup-python@master
31-
with:
32-
python-version: 3.9
33-
- name: Install dependencies
34-
id: coverage-installer
35-
run: |
36-
python -m pip install --upgrade pip
37-
pip install cython==0.29.21 numpy==1.23.2
38-
sudo apt-get install jq
39-
pip install -r requirements.txt
40-
pip install -r requirements-dev.txt
41-
pip install coverage-badge
42-
- name: Run tests and calculate coverage
43-
id: test-runner
44-
run: |
45-
coverage run -m pytest
46-
coverage-badge -f -o docs/coverage.svg
47-
COVERAGE_SCORE=$(coverage json -o /dev/stdout | jq .totals.percent_covered)
48-
echo "::set-output name=coverageScore::$COVERAGE_SCORE"
49-
- name: Verify Changed files
50-
uses: tj-actions/verify-changed-files@v6
51-
id: changed_files
52-
with:
53-
files: docs/coverage.svg
54-
- name: Commit code coverage badge
55-
if: ${{ steps.changed_files.outputs.files_changed == 'true' && github.event_name != 'pull_request'}}
56-
run: |
57-
git config --local user.name "$(git log -1 --pretty=format:'%an' | xargs)"
58-
git config --local user.email "$(git log -1 --pretty=format:'%ae' | xargs)"
59-
git add docs/coverage.svg
60-
git commit -m "test: update coverage.svg"
61-
git reset --soft HEAD~2
62-
# shellcheck disable=SC1083 # code is irrelevant because git needs this literal
63-
git commit -m "$(git log --format=%B --reverse HEAD..HEAD@{1})"
64-
- name: Push code coverage badge
65-
if: ${{ steps.changed_files.outputs.files_changed == 'true' && github.event_name != 'pull_request'}}
66-
uses: ad-m/github-push-action@master
67-
with:
68-
force: true
69-
github_token: ${{ secrets.GIT_ADMIN_WORKFLOW_TOKEN }}
70-
branch: ${{ github.event.pull_request.head.repo.full_name }}
71-
- name: Coverage total fail - exit
72-
if: ${{github.event_name == 'pull_request' && steps.test-runner.outputs.coverageScore < env.COVERAGE_TOTAL}}
73-
run: |
74-
echo "cov total fail ${{ steps.test-runner.outputs.coverageScore }}"
75-
exit 1
18+
- name: Checkout (admin token)
19+
if: ${{github.event_name != 'pull_request'}} # We don't want to use the admin token for PR flows
20+
uses: actions/checkout@master
21+
with:
22+
token: '${{ secrets.GIT_ADMIN_WORKFLOW_TOKEN }}'
23+
fetch-depth: "2" # Original commit + code cov badge commit
24+
- name: Checkout (normal flow)
25+
if: ${{github.event_name == 'pull_request'}}
26+
uses: actions/checkout@master
27+
with:
28+
fetch-depth: "2" # Original commit + code cov badge commit
29+
- name: Setup Python
30+
uses: actions/setup-python@master
31+
with:
32+
python-version: 3.9
33+
- name: Install dependencies
34+
id: coverage-installer
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install cython==0.29.21 numpy==1.23.2
38+
sudo apt-get install jq
39+
pip install -r requirements.txt
40+
pip install -r requirements-dev.txt
41+
pip install coverage-badge
42+
- name: Run tests and calculate coverage
43+
id: test-runner
44+
run: |
45+
coverage run -m pytest
46+
coverage-badge -f -o docs/coverage.svg
47+
COVERAGE_SCORE=$(coverage json -o /dev/stdout | jq .totals.percent_covered)
48+
echo "::set-output name=coverageScore::$COVERAGE_SCORE"
49+
- name: Verify Changed files
50+
uses: tj-actions/verify-changed-files@v6
51+
id: changed_files
52+
with:
53+
files: docs/coverage.svg
54+
- name: Commit code coverage badge
55+
if: ${{ steps.changed_files.outputs.files_changed == 'true' && github.event_name != 'pull_request'}}
56+
run: |
57+
git config --local user.name "$(git log -1 --pretty=format:'%an' | xargs)"
58+
git config --local user.email "$(git log -1 --pretty=format:'%ae' | xargs)"
59+
git add docs/coverage.svg
60+
git commit -m "test: update coverage.svg"
61+
git reset --soft HEAD~2
62+
# shellcheck disable=SC1083 # code is irrelevant because git needs this literal
63+
git commit -m "$(git log --format=%B --reverse HEAD..HEAD@{1})"
64+
- name: Push code coverage badge
65+
if: ${{ steps.changed_files.outputs.files_changed == 'true' && github.event_name != 'pull_request'}}
66+
uses: ad-m/github-push-action@master
67+
with:
68+
force: true
69+
github_token: ${{ secrets.GIT_ADMIN_WORKFLOW_TOKEN }}
70+
branch: ${{ github.event.pull_request.head.repo.full_name }}
71+
- name: Coverage total fail - exit
72+
if: ${{github.event_name == 'pull_request' && steps.test-runner.outputs.coverageScore < env.COVERAGE_TOTAL}}
73+
run: |
74+
echo "cov total fail ${{ steps.test-runner.outputs.coverageScore }}"
75+
exit 1

.github/workflows/doc-gen.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ jobs:
1010
OS: ubuntu-20.04
1111
PYTHON: '3.9'
1212
steps:
13-
- uses: actions/checkout@master
14-
with:
15-
fetch-depth: "1"
16-
- name: Setup Python
17-
uses: actions/setup-python@master
18-
with:
19-
python-version: 3.9
20-
- name: Setup requirements and run sphinx
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install cython==0.29.21 numpy==1.23.2
24-
pip install -r requirements.txt
25-
pip install -r requirements-dev.txt
26-
pip install -r docs/requirements-doc.txt
27-
cd docs
28-
make html
29-
- name: Push Sphinx Pages to Webserver
30-
uses: JamesIves/github-pages-deploy-action@4.1.5
31-
with:
32-
branch: gh-pages
33-
folder: ./docs/build/html
34-
commit-message: 'docs: update build documentation'
13+
- uses: actions/checkout@master
14+
with:
15+
fetch-depth: "1"
16+
- name: Setup Python
17+
uses: actions/setup-python@master
18+
with:
19+
python-version: 3.9
20+
- name: Setup requirements and run sphinx
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install cython==0.29.21 numpy==1.23.2
24+
pip install -r requirements.txt
25+
pip install -r requirements-dev.txt
26+
pip install -r docs/requirements-doc.txt
27+
cd docs
28+
make html
29+
- name: Push Sphinx Pages to Webserver
30+
uses: JamesIves/github-pages-deploy-action@4.1.5
31+
with:
32+
branch: gh-pages
33+
folder: ./docs/build/html
34+
commit-message: 'docs: update build documentation'

.github/workflows/pre-merge.yml

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,3 @@ jobs:
3535
run: |
3636
pre-commit install
3737
pre-commit run --all-files
38-
- name: Lint code base with SuperLinter
39-
# Documentation: https://github.com/github/super-linter#how-to-use
40-
uses: github/super-linter@v4
41-
env:
42-
DEFAULT_BRANCH: master
43-
FILTER_REGEX_EXCLUDE: .*pb2*py
44-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45-
LINTER_RULES_PATH: .
46-
VALIDATE_ALL_CODEBASE: false # Only new or edited files will be parsed for validation.
47-
VALIDATE_DOCKERFILE_HADOLINT: false
48-
VALIDATE_GITLEAKS: false # Handled by pre-commit.
49-
VALIDATE_HTML: false # Handled by pre-commit.
50-
VALIDATE_JSCPD: false
51-
VALIDATE_JSON: false # Handled by pre-commit.
52-
VALIDATE_MARKDOWN: false # Handled by pre-commit.
53-
VALIDATE_NATURAL_LANGUAGE: false # No corresponding pre-commit hook but not critical.
54-
VALIDATE_PROTOBUF: false
55-
VALIDATE_PYTHON_BLACK: false
56-
VALIDATE_PYTHON_FLAKE8: false # Formatted by YAPF.
57-
VALIDATE_PYTHON_ISORT: false # Formatted by YAPF.
58-
VALIDATE_PYTHON_MYPY: false
59-
VALIDATE_PYTHON_PYLINT: false # Handled by pre-commit.
60-
VALIDATE_SHELL_SHFMT: false # Handled by pre-commit.

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ repos:
4949
hooks:
5050
- id: shellcheck
5151
- id: shfmt
52+
- repo: https://github.com/adrienverge/yamllint
53+
rev: v1.27.1
54+
hooks:
55+
- id: yamllint
5256
- repo: https://github.com/pre-commit/mirrors-yapf
5357
rev: v0.32.0
5458
hooks:

.yamllint.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends: default
2+
3+
rules:
4+
line-length: disable
5+
document-start: disable # Allow missing "---" file prelude.
6+
truthy:
7+
check-keys: false # Allow keys that look like truthy literals, such as `on`.
8+
comments: disable # Allow single space between non-comment and comment.

0 commit comments

Comments
 (0)