CI: skip linting check for temp/ folder (!864)
Since we copy these aports directly from Alpine and try to keep them in sync, we don't want to differ from upstream because our CI doesn't pass on linting. If the APKBUILD should be improved, it should be done upstream which is then synced back to us.
This commit is contained in:
parent
b97c340c36
commit
7c31d47745
3 changed files with 38 additions and 4 deletions
|
@ -83,9 +83,10 @@ aports-static:
|
|||
# APKBUILD linting
|
||||
aport-lint:
|
||||
stage: first
|
||||
image: alpinelinux/apkbuild-lint-tools:latest
|
||||
before_script:
|
||||
- apk -q add git atools python3
|
||||
script:
|
||||
- changed-aports $CI_MERGE_REQUEST_TARGET_BRANCH_NAME | lint
|
||||
- .gitlab-ci/apkbuild-linting.py
|
||||
only:
|
||||
- merge_requests
|
||||
|
||||
|
|
30
.gitlab-ci/apkbuild-linting.py
Executable file
30
.gitlab-ci/apkbuild-linting.py
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import common
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
common.add_upstream_git_remote()
|
||||
packages = common.get_changed_packages(with_directory=True)
|
||||
|
||||
if len(packages) < 1:
|
||||
print("No APKBUILDs to lint")
|
||||
sys.exit(0)
|
||||
|
||||
issues = []
|
||||
for package in packages:
|
||||
if "temp/" in package:
|
||||
continue
|
||||
|
||||
result = subprocess.run(["apkbuild-lint", package], capture_output=True)
|
||||
if len(result.stdout) > 0:
|
||||
issues.append([package, result.stdout.decode("utf-8")])
|
||||
|
||||
if len(issues) > 0:
|
||||
print("Linting issues found:")
|
||||
for issue in issues:
|
||||
print(issue[0] + ": " + issue[1])
|
||||
|
||||
sys.exit(1)
|
|
@ -108,7 +108,7 @@ def get_changed_packages_sanity_check(count):
|
|||
sys.exit(1)
|
||||
|
||||
|
||||
def get_changed_packages():
|
||||
def get_changed_packages(with_directory=False):
|
||||
files = get_changed_files()
|
||||
ret = set()
|
||||
for file in files:
|
||||
|
@ -120,7 +120,10 @@ def get_changed_packages():
|
|||
continue
|
||||
|
||||
# Add to the ret set (removes duplicated automatically)
|
||||
ret.add(file.split("/")[1])
|
||||
if with_directory:
|
||||
ret.add(file)
|
||||
else:
|
||||
ret.add(file.split("/")[1])
|
||||
return ret
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue