From 7d8ea45c685ec24c502d1ba4a21791a9dd2416ff Mon Sep 17 00:00:00 2001 From: Beatriz Rizental <beatriz.rizental@gmail.com> Date: Tue, 16 Jul 2024 19:03:58 +0200 Subject: [PATCH] fixup! Add CI for Base Browser Bug 42722: Cache mozbuild path instead of specifically the pip path --- .gitlab/ci/lint.yml | 8 ++++++-- .gitlab/ci/scripts/run_linters.py | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.gitlab/ci/lint.yml b/.gitlab/ci/lint.yml index 3d562ef108aa7..2c84524c79809 100644 --- a/.gitlab/ci/lint.yml +++ b/.gitlab/ci/lint.yml @@ -2,11 +2,15 @@ stage: lint interruptible: true variables: - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + MOZBUILD_STATE_PATH: "$CI_PROJECT_DIR/.cache/mozbuild" cache: paths: - node_modules - - .cache/pip + - .cache/mozbuild + # Store the cache regardless on job outcome + when: 'always' + # Share the cache throughout all pipelines running for a given branch + key: $CI_COMMIT_REF_SLUG eslint: extends: .base diff --git a/.gitlab/ci/scripts/run_linters.py b/.gitlab/ci/scripts/run_linters.py index 4790eabf1869a..9049c565b7e4b 100755 --- a/.gitlab/ci/scripts/run_linters.py +++ b/.gitlab/ci/scripts/run_linters.py @@ -98,13 +98,13 @@ if __name__ == "__main__": ) args = parser.parse_args() - command = [ - "./mach", - "lint", - "-v", - *(s for l in args.linters for s in ("-l", l)), - *get_list_of_changed_files(), - ] - result = subprocess.run(command, text=True) - - sys.exit(result.returncode) + changed_files = get_list_of_changed_files() + if changed_files: + command = ["./mach", "lint", "-v"] + for linter in args.linters: + command.extend(["-l", linter]) + command.extend(changed_files) + result = subprocess.run(command, text=True) + sys.exit(result.returncode) + else: + print("No files changed, skipping linting.") -- GitLab