Pier Angelo Vendrame pushed to branch mullvad-browser-128.3.0esr-14.0-1 at The Tor Project / Applications / Mullvad Browser
Commits: 1b763c7e by Beatriz Rizental at 2024-10-22T09:41:23+02:00 fixup! Add CI for Base Browser
Use tb-build dedicated runners for lint CI.
- - - - - eefd74b3 by Beatriz Rizental at 2024-10-22T09:41:24+02:00 fixup! Add CI for Base Browser
Re-enable lint jobs for default branches
- - - - -
3 changed files:
- .gitlab-ci.yml - .gitlab/ci/lint.yml - − .gitlab/ci/setup.yml
Changes:
===================================== .gitlab-ci.yml ===================================== @@ -1,10 +1,9 @@ stages: - - setup - lint
variables: IMAGE_PATH: containers.torproject.org/tpo/applications/tor-browser/base:latest + LOCAL_REPO_PATH: /srv/apps-repos/${CI_PROJECT_NAME}.git
include: - - local: '.gitlab/ci/setup.yml' - local: '.gitlab/ci/lint.yml'
===================================== .gitlab/ci/lint.yml ===================================== @@ -2,13 +2,9 @@ stage: lint image: $IMAGE_PATH interruptible: true - needs: - - job: setup-env - artifacts: true - - job: create-bundle - artifacts: true variables: MOZBUILD_STATE_PATH: "$CI_PROJECT_DIR/.cache/mozbuild" + # A copy of the repository already is available in the runner. GIT_STRATEGY: "none" cache: paths: @@ -18,26 +14,21 @@ when: 'always' # Share the cache throughout all pipelines running for a given branch key: $CI_COMMIT_REF_SLUG + tags: + # Run these jobs in the browser dedicated runners. + - firefox before_script: - # DEBUG: Are all artifacts here? - - ls -a - - mkdir app && cd app - # Initialize a fresh git repo - git init - # Add app.bundle as the remote. All operations that communicate with the remote will be local. - - git remote add origin ../app.bundle - # shallow.txt contains the SHA of the base commit of the bundle. - # The bundle is shallow, therefore it's base commit will not have a parent. - # Adding the SHA of the base commit to .git/shallow tells git that it doesn't need - # to crash when it realizes said base commit doesn't have a parent. - - cp ../shallow.txt .git/shallow - # Finally, unpack the bundle. Time it for debugging purposes. - - time git pull origin $BRANCH_NAME + - git remote add local "$LOCAL_REPO_PATH" + - git fetch --depth 500 local + - git remote add origin "$CI_REPOSITORY_URL" + - git fetch origin ${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} + - git checkout ${CI_COMMIT_BRANCH:-$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}
eslint: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l eslint + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l eslint rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -61,12 +52,12 @@ eslint: - 'tools/lint/eslint/eslint-plugin-mozilla/**' - 'tools/lint/eslint/eslint-plugin-spidermonkey-js/**' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
stylelint: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l stylelint + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l stylelint rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -79,12 +70,12 @@ stylelint: - '**/.stylelintignore' - '**/*stylelintrc*' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
py-black: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l black + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l black rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -98,12 +89,12 @@ py-black: - 'pyproject.toml' - 'tools/lint/black.yml' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
py-ruff: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l ruff + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l ruff rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -117,12 +108,12 @@ py-ruff: - 'tools/lint/python/ruff.py' - 'tools/lint/python/ruff_requirements.txt' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
yaml: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l yaml + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l yaml rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -132,12 +123,12 @@ yaml: - '**/*.yaml' - '**/.ymllint' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
shellcheck: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l shellcheck + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l shellcheck rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -146,13 +137,13 @@ shellcheck: - '**/*.sh' - 'tools/lint/shellcheck.yml' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
clang-format: extends: .base script: - ./mach configure --without-wasm-sandboxed-libraries --with-base-browser-version=0.0.0 - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l clang-format + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l clang-format rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -166,12 +157,12 @@ clang-format: - '**/*.mm' - 'tools/lint/clang-format.yml' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
rustfmt: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l rustfmt + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l rustfmt rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -180,12 +171,12 @@ rustfmt: - '**/*.rs' - 'tools/lint/rustfmt.yml' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
fluent-lint: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l fluent-lint + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l fluent-lint rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -195,12 +186,12 @@ fluent-lint: - 'tools/lint/fluent-lint.yml' - 'tools/lint/fluent-lint/exclusions.yml' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
localization: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l l10n + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l l10n rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -212,12 +203,12 @@ localization: - 'third_party/python/fluent/**' - 'tools/lint/l10n.yml' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
mingw-capitalization: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l mingw-capitalization + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l mingw-capitalization rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -229,12 +220,12 @@ mingw-capitalization: - '**/*.h' - 'tools/lint/mingw-capitalization.yml' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
mscom-init: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l mscom-init + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l mscom-init rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -246,12 +237,12 @@ mscom-init: - '**/*.h' - 'tools/lint/mscom-init.yml' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
file-whitespace: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l file-whitespace + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l file-whitespace rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -275,12 +266,12 @@ file-whitespace: - '**/*.xhtml' - 'tools/lint/file-whitespace.yml' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
test-manifest: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l test-manifest-alpha -l test-manifest-disable -l test-manifest-skip-if + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l test-manifest-alpha -l test-manifest-disable -l test-manifest-skip-if rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -290,12 +281,12 @@ test-manifest: - 'python/mozlint/**' - 'tools/lint/**' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
trojan-source: extends: .base script: - - cat ../changedfiles.txt | xargs -d '\n' ./mach lint -l trojan-source + - .gitlab/ci/scripts/helpers.py --get-changed-files | xargs -d '\n' ./mach lint -l trojan-source rules: - if: $CI_PIPELINE_SOURCE == 'merge_request_event' changes: @@ -309,4 +300,4 @@ trojan-source: - '**/*.rs' - 'tools/lint/trojan-source.yml' # Run job whenever a commit is merged to a protected branch - # - if: $CI_COMMIT_REF_PROTECTED == 'true' + - if: $CI_COMMIT_REF_PROTECTED == 'true'
===================================== .gitlab/ci/setup.yml deleted ===================================== @@ -1,56 +0,0 @@ -setup-env: - stage: setup - interruptible: true - variables: - GIT_STRATEGY: "none" - rules: - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_REF_PROTECTED == 'true' - script: - - | - if [ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ]; then - echo "BRANCH_NAME=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" > build.env - else - echo "BRANCH_NAME=$CI_COMMIT_REF_NAME" > build.env - fi - artifacts: - reports: - dotenv: - - build.env - -create-bundle: - stage: setup - # TODO: Find a better suited image, this one just has git. - image: python - needs: - - job: setup-env - artifacts: true - rules: - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_REF_PROTECTED == 'true' - variables: - GIT_DEPTH: "1" - interruptible: true - script: - # DEBUG: Check repository status. - - git status - # DEBUG: Check branches in repository - - git branch - # Force switch to a named branch. We force it in case there is already - # a branch with the same name from previous runs. - - git switch -C $BRANCH_NAME - # Create a git bundle -- this will generate the app.bundle file, - # which can be used as a git remote for offline fetching. - - git bundle create app.bundle $BRANCH_NAME - # Retain the SHA of the base of this shallow repository. - - cat .git/shallow > shallow.txt - # DEBUG: Check sizes. - - du -sh .git - - du -sh app.bundle - # Since this is the only job we have access to the Gitlab remote, - # let's get a list of changed files to use in the next jobs. - - .gitlab/ci/scripts/helpers.py --get-changed-files > changedfiles.txt - artifacts: - paths: - - app.bundle - - shallow.txt - - changedfiles.txt - expire_in: 1 hour
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/e8e...