Verified Commit ac54df57 authored by Beatriz Rizental's avatar Beatriz Rizental Committed by Pier Angelo Vendrame
Browse files

fixup! Add CI for Base Browser

Bug 42722: Use custom Dockerfile for lint CI jobs to address
missing dependencies issues with clang-format and l10n linters.
parent 1f329b97
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
stages:
  - lint

variables:
  IMAGE_PATH: containers.torproject.org/tpo/applications/tor-browser/base:latest

include:
  - local: '.gitlab/ci/lint.yml'
+69 −0
Original line number Diff line number Diff line
FROM debian:latest

# Base image which includes all* dependencies checked by ./mach configure.
#
# * Actually not all dependencies. WASM sandboxed depencies were left out for now.
# This installs all dependencies checked by `./mach configure --without-wasm-sandboxed-libraries`.
#
# # Building and publishing
#
# Whenever this file changes, the updated Docker image must be built and published _manually_ to
# the tor-browser container registry (https://gitlab.torproject.org/tpo/applications/tor-browser/container_registry/185).
#
# This image copies a script from the taskcluster/ folder, which requires it
# to be built from a folder which is a parent of the taskcluster/ folder.
#
# To build, run:
#
# ```bash
# docker build \
#   -f <PATH_TO_DOCKERFILE> \
#   -t <REGISTRY_URL>/<IMAGE_NAME>:<IMAGE_TAG>
#   .
# ```
#
# For example, when building from the root of this repository to the main tor-browser repository
# and assuming image name to be "base" and tag "latest" -- which is the current terminology:
#
# ```bash
# docker build \
#   -f .gitlab/ci/docker/Dockerfile \
#   -t containers.torproject.org/tpo/applications/tor-browser/base:latest
#   .
# ```

RUN apt-get update && apt-get install -y \
    clang \
    curl \
    git \
    libasound2-dev \
    libdbus-glib-1-dev \
    libgtk-3-dev \
    libpango1.0-dev \
    libpulse-dev \
    libx11-xcb-dev \
    libxcomposite-dev \
    libxcursor-dev \
    libxdamage-dev \
    libxi-dev \
    libxrandr-dev \
    libxtst-dev \
    m4 \
    mercurial \
    nasm \
    pkg-config \
    python3 \
    python3-pip \
    unzip \
    wget

COPY taskcluster/docker/recipes/install-node.sh /scripts/install-node.sh
RUN chmod +x /scripts/install-node.sh
RUN /scripts/install-node.sh

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
RUN $HOME/.cargo/bin/cargo install cbindgen

WORKDIR /app

CMD ["/bin/bash"]
+16 −19
Original line number Diff line number Diff line
variables:
  # This needs to be kept in sync with the max Python version accepted by ./mach
  PYTHON_VERSION: "3.11.7"

.base:
  stage: lint
  interruptible: true
@@ -14,7 +10,7 @@ variables:

eslint:
  extends: .base
  image: cimg/python:$PYTHON_VERSION-node
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py eslint
  rules:
@@ -45,7 +41,7 @@ eslint:

stylelint:
  extends: .base
  image: cimg/python:$PYTHON_VERSION-node
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py stylelint
  rules:
@@ -65,7 +61,7 @@ stylelint:

py-black:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py black
  rules:
@@ -86,7 +82,7 @@ py-black:

py-ruff:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py ruff
  rules:
@@ -107,7 +103,7 @@ py-ruff:

yaml:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py yaml
  rules:
@@ -124,7 +120,7 @@ yaml:

shellcheck:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py shellcheck
  rules:
@@ -140,8 +136,9 @@ shellcheck:

clang-format:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - ./mach configure --without-wasm-sandboxed-libraries --with-base-browser-version=0.0.0
    - .gitlab/ci/scripts/run_linters.py clang-format
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
@@ -161,7 +158,7 @@ clang-format:

rustfmt:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py rustfmt
  rules:
@@ -177,7 +174,7 @@ rustfmt:

fluent-lint:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py fluent-lint
  rules:
@@ -194,7 +191,7 @@ fluent-lint:

localization:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py l10n
  rules:
@@ -213,7 +210,7 @@ localization:

mingw-capitalization:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py mingw-capitalization
  rules:
@@ -232,7 +229,7 @@ mingw-capitalization:

mscom-init:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py mscom-init
  rules:
@@ -251,7 +248,7 @@ mscom-init:

file-whitespace:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py file-whitespace
  rules:
@@ -282,7 +279,7 @@ file-whitespace:

test-manifest:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py test-manifest-alpha test-manifest-disable test-manifest-skip-if
  rules:
@@ -299,7 +296,7 @@ test-manifest:

trojan-source:
  extends: .base
  image: cimg/python:$PYTHON_VERSION
  image: $IMAGE_PATH
  script:
    - .gitlab/ci/scripts/run_linters.py trojan-source
  rules:
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ def get_firefox_tag_from_branch_name(branch_name):
        return match.group(0).split()[0]
    else:
        raise ValueError(
            f"Failed to find reference specifier for Firefox tag in branch '{branch_name}'."
            f"Failed to find reference specifier for Firefox tag '{tag}' in branch '{branch_name}'."
        )