From f6f52731a8695c03165bb7a5a6d8bfdd568e94b6 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Tue, 28 Apr 2026 16:00:26 +0800 Subject: [PATCH] Migrate tox tests from buildbot to actions - also disable bootstrap on tor test, I don't think it's working correctly --- .buildbot/tox-bionic/Dockerfile | 26 ---- .buildbot/tox-bionic/build.sh | 3 - .buildbot/tox-bionic/test.sh | 3 - .buildbot/tox-focal/Dockerfile | 17 --- .buildbot/tox-focal/test.sh | 1 - .buildbot/tox-jammy/Dockerfile | 16 --- .buildbot/tox-jammy/test.sh | 3 - .gitea/workflows/tox-lint.yml | 76 ----------- {.gitea => .github}/workflows/android.yml | 6 +- .github/workflows/tox-lint.yml | 2 +- .github/workflows/tox-tests.yml | 154 ++++++++++++++++++++++ 11 files changed, 159 insertions(+), 148 deletions(-) delete mode 100644 .buildbot/tox-bionic/Dockerfile delete mode 100755 .buildbot/tox-bionic/build.sh delete mode 100755 .buildbot/tox-bionic/test.sh delete mode 100644 .buildbot/tox-focal/Dockerfile delete mode 120000 .buildbot/tox-focal/test.sh delete mode 100644 .buildbot/tox-jammy/Dockerfile delete mode 100755 .buildbot/tox-jammy/test.sh delete mode 100644 .gitea/workflows/tox-lint.yml rename {.gitea => .github}/workflows/android.yml (94%) create mode 100644 .github/workflows/tox-tests.yml diff --git a/.buildbot/tox-bionic/Dockerfile b/.buildbot/tox-bionic/Dockerfile deleted file mode 100644 index 1acf58dcd7..0000000000 --- a/.buildbot/tox-bionic/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM ubuntu:bionic - -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update - -RUN apt-get install -yq --no-install-suggests --no-install-recommends \ - software-properties-common build-essential libcap-dev libffi-dev \ - libssl-dev python-all-dev python-setuptools \ - python3-dev python3-pip python3.8 python3.8-dev python3.8-venv \ - python-msgpack python-qt4 language-pack-en qt5dxcb-plugin tor xvfb - -RUN apt-get install -yq sudo - -RUN echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers - -RUN python3.8 -m pip install setuptools wheel -RUN python3.8 -m pip install --upgrade pip tox virtualenv - -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 - -ADD . . - -CMD .buildbot/tox-bionic/test.sh diff --git a/.buildbot/tox-bionic/build.sh b/.buildbot/tox-bionic/build.sh deleted file mode 100755 index 87f670ce54..0000000000 --- a/.buildbot/tox-bionic/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -sudo service tor start diff --git a/.buildbot/tox-bionic/test.sh b/.buildbot/tox-bionic/test.sh deleted file mode 100755 index f57f61e5f5..0000000000 --- a/.buildbot/tox-bionic/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -tox diff --git a/.buildbot/tox-focal/Dockerfile b/.buildbot/tox-focal/Dockerfile deleted file mode 100644 index fecc081985..0000000000 --- a/.buildbot/tox-focal/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM ubuntu:focal - -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update - -RUN apt-get install -yq --no-install-suggests --no-install-recommends \ - software-properties-common build-essential libcap-dev libffi-dev \ - libssl-dev python-all-dev python-setuptools \ - python3-dev python3-pip python3.9 python3.9-dev python3.9-venv \ - language-pack-en qt5dxcb-plugin tor xvfb - -RUN python3.9 -m pip install --upgrade pip tox virtualenv - -ADD . . - -CMD .buildbot/tox-focal/test.sh diff --git a/.buildbot/tox-focal/test.sh b/.buildbot/tox-focal/test.sh deleted file mode 120000 index a9f8525c17..0000000000 --- a/.buildbot/tox-focal/test.sh +++ /dev/null @@ -1 +0,0 @@ -../tox-bionic/test.sh \ No newline at end of file diff --git a/.buildbot/tox-jammy/Dockerfile b/.buildbot/tox-jammy/Dockerfile deleted file mode 100644 index b15c3b8f27..0000000000 --- a/.buildbot/tox-jammy/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM ubuntu:jammy - -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update - -RUN apt-get install -yq --no-install-suggests --no-install-recommends \ - software-properties-common build-essential libcap-dev libffi-dev \ - libssl-dev python-all-dev python-is-python3 python-setuptools \ - python3-dev python3-pip language-pack-en qt5dxcb-plugin tor xvfb - -RUN pip install tox - -ADD . . - -CMD .buildbot/tox-jammy/test.sh diff --git a/.buildbot/tox-jammy/test.sh b/.buildbot/tox-jammy/test.sh deleted file mode 100755 index 578e78a6de..0000000000 --- a/.buildbot/tox-jammy/test.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -tox -e py310 diff --git a/.gitea/workflows/tox-lint.yml b/.gitea/workflows/tox-lint.yml deleted file mode 100644 index 144f4c871d..0000000000 --- a/.gitea/workflows/tox-lint.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Tox Linter Tests - -on: - push: - branches: [master, main, v0.6] - pull_request: - branches: [master, main, v0.6] - -jobs: - lint: - name: "${{ matrix.tox-env }} / python ${{ matrix.python-version }}" - runs-on: ubuntu-latest - container: ${{ matrix.container }} - strategy: - fail-fast: false - matrix: - tox-env: [bandit, flake8, pycodestyle, pylint] - python-version: ["2.7", "3.10"] - include: - - python-version: "2.7" - container: "python:2.7-buster" - tox-suffix: "-py27" - - python-version: "3.10" - tox-suffix: "" - - steps: - # ── System packages ──────────────────────────────────────── - # Container (Python 2): runs as root, needs git for checkout - - name: Install system dependencies (container) - if: matrix.python-version == '2.7' - run: | - sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list - sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list - sed -i '/buster-updates/d' /etc/apt/sources.list - apt-get update -q - apt-get install -qy git libcap-dev - - # Host VM (Python 3): git is pre-installed, just need libcap-dev - - name: Install system dependencies - if: matrix.python-version != '2.7' - run: | - sudo apt-get update -q - sudo apt-get install -qy libcap-dev - - # GitHub mounts Node into containers, so actions/checkout works everywhere. - # Gitea runners don't, so the buster container needs a manual git clone. - - name: Checkout repository - if: "!(matrix.python-version == '2.7' && env.GITEA_ACTIONS == 'true')" - uses: actions/checkout@v4 - - - name: Checkout repository (Gitea container) - if: matrix.python-version == '2.7' && env.GITEA_ACTIONS == 'true' - env: - TOKEN: ${{ github.token }} - run: | - git config --global --add safe.directory "$PWD" - git init - SERVER="${GITHUB_SERVER_URL#https://}" - git remote add origin "https://x-access-token:${TOKEN}@${SERVER}/${GITHUB_REPOSITORY}.git" - git fetch --depth 1 origin "${GITHUB_SHA}" - git checkout FETCH_HEAD - - # ── Python 3 ─────────────────────────────────────────────── - - name: Set up Python ${{ matrix.python-version }} - if: matrix.python-version != '2.7' - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - # ── Common ───────────────────────────────────────────────── - - name: Install tox - run: | - pip install "tox<4" "virtualenv<20.22.0" - - - name: Run tox -e ${{ matrix.tox-env }}${{ matrix.tox-suffix }} - run: tox -e ${{ matrix.tox-env }}${{ matrix.tox-suffix }} diff --git a/.gitea/workflows/android.yml b/.github/workflows/android.yml similarity index 94% rename from .gitea/workflows/android.yml rename to .github/workflows/android.yml index 1186a137ee..9fa8454c3c 100644 --- a/.gitea/workflows/android.yml +++ b/.github/workflows/android.yml @@ -8,6 +8,10 @@ on: jobs: build: + # Only run on Gitea; this build needs a self-hosted runner with + # the tool cache and is not meant for GitHub's hosted runners. + if: >- + !contains(github.server_url, 'github.com') name: buildozer android debug runs-on: ubuntu-latest container: ubuntu:focal @@ -86,5 +90,3 @@ jobs: | tar --list -z > package.list cat package.list grep '\.sql$' package.list || exit 1 - - diff --git a/.github/workflows/tox-lint.yml b/.github/workflows/tox-lint.yml index 144f4c871d..2987315fbb 100644 --- a/.github/workflows/tox-lint.yml +++ b/.github/workflows/tox-lint.yml @@ -70,7 +70,7 @@ jobs: # ── Common ───────────────────────────────────────────────── - name: Install tox run: | - pip install "tox<4" "virtualenv<20.22.0" + pip install --upgrade tox virtualenv - name: Run tox -e ${{ matrix.tox-env }}${{ matrix.tox-suffix }} run: tox -e ${{ matrix.tox-env }}${{ matrix.tox-suffix }} diff --git a/.github/workflows/tox-tests.yml b/.github/workflows/tox-tests.yml new file mode 100644 index 0000000000..b580fee9ae --- /dev/null +++ b/.github/workflows/tox-tests.yml @@ -0,0 +1,154 @@ +name: Tox Tests + +on: + push: + branches: [master, main, v0.6] + pull_request: + branches: [master, main, v0.6] + +jobs: + tests: + name: "Ubuntu ${{ matrix.ubuntu }} / ${{ matrix.tox-env }}" + runs-on: ubuntu-latest + container: + image: ubuntu:${{ matrix.ubuntu }} + options: --init + + strategy: + fail-fast: false + matrix: + include: + # ── Python 2.7 (bionic & focal only) ───────────────── + - ubuntu: bionic + tox-env: py27 + stats-env: ",stats" + python-pkg: "python3.8" + python-dev-pkg: "python-all-dev python3.8-dev" + python-venv-pkg: "python3.8-venv" + python-bin: python3.8 + extra-pkgs: "python-setuptools python-msgpack python-prctl + python-qt4" + start-tor: false + deadsnakes-ppa: false + - ubuntu: bionic + tox-env: py27-portable + python-pkg: "python3.8" + python-dev-pkg: "python-all-dev python3.8-dev" + python-venv-pkg: "python3.8-venv" + python-bin: python3.8 + extra-pkgs: "python-setuptools python-msgpack python-prctl + python-qt4" + start-tor: false + deadsnakes-ppa: false + - ubuntu: focal + tox-env: py27 + stats-env: ",stats" + python-pkg: "python3.9 python3-pip" + python-dev-pkg: "python-all-dev python3.9-dev" + python-venv-pkg: "python3.9-venv" + python-bin: python3.9 + extra-pkgs: "python-setuptools" + start-tor: false + deadsnakes-ppa: false + - ubuntu: focal + tox-env: py27-portable + python-pkg: "python3.9 python3-pip" + python-dev-pkg: "python-all-dev python3.9-dev" + python-venv-pkg: "python3.9-venv" + python-bin: python3.9 + extra-pkgs: "python-setuptools" + start-tor: false + deadsnakes-ppa: false + # ── Python 3 ───────────────────────────────────────── + - ubuntu: bionic + tox-env: py38 + stats-env: ",stats" + python-pkg: python3.8 + python-dev-pkg: python3.8-dev + python-venv-pkg: python3.8-venv + python-bin: python3.8 + extra-pkgs: "" + start-tor: false + deadsnakes-ppa: true + - ubuntu: focal + tox-env: py39 + stats-env: ",stats" + python-pkg: python3.9 + python-dev-pkg: python3.9-dev + python-venv-pkg: python3.9-venv + python-bin: python3.9 + extra-pkgs: "" + start-tor: false + deadsnakes-ppa: true + - ubuntu: jammy + tox-env: py310 + stats-env: ",stats" + python-pkg: python3 + python-dev-pkg: python3-dev + python-venv-pkg: "" + python-bin: python3 + extra-pkgs: "" + start-tor: false + deadsnakes-ppa: false + + env: + DEBIAN_FRONTEND: noninteractive + LANG: en_US.UTF-8 + LANGUAGE: "en_US:en" + LC_ALL: en_US.UTF-8 + + steps: + - name: Install base packages + run: | + apt-get update -q + apt-get install -yq --no-install-suggests --no-install-recommends \ + software-properties-common + + - name: Add deadsnakes PPA + if: matrix.deadsnakes-ppa + run: add-apt-repository -y ppa:deadsnakes/ppa + + - name: Install system dependencies + run: | + apt-get install -yq --no-install-suggests --no-install-recommends \ + build-essential libcap-dev libffi-dev \ + libssl-dev python3-dev python3-pip \ + ${{ matrix.python-pkg }} ${{ matrix.python-dev-pkg }} \ + ${{ matrix.python-venv-pkg }} ${{ matrix.extra-pkgs }} \ + language-pack-en qt5dxcb-plugin tor xvfb git sudo dumb-init + + # actions/checkout@v4 needs Node 20 → glibc 2.28+. + # Bionic (glibc 2.27) and Gitea runners use a manual git clone. + - name: Checkout repository + if: env.GITEA_ACTIONS != 'true' && matrix.ubuntu != 'bionic' + uses: actions/checkout@v4 + + - name: Checkout repository (manual) + if: env.GITEA_ACTIONS == 'true' || matrix.ubuntu == 'bionic' + env: + TOKEN: ${{ github.token }} + run: | + git config --global --add safe.directory "$PWD" + git init + SERVER="${GITHUB_SERVER_URL#https://}" + git remote add origin "https://x-access-token:${TOKEN}@${SERVER}/${GITHUB_REPOSITORY}.git" + git fetch --depth 1 origin "${GITHUB_SHA}" + git checkout FETCH_HEAD + + - name: Install tox + run: | + ${{ matrix.python-bin }} -m pip install --upgrade pip setuptools wheel + ${{ matrix.python-bin }} -m pip install --upgrade tox virtualenv + + - name: Create unprivileged user + run: | + useradd -m builder + chown -R builder:builder . + + # TODO: fix tor tests + # - name: Start tor + # if: matrix.start-tor + # run: service tor start + + - name: Run tox ${{ matrix.tox-env }} + run: runuser -u builder -- tox -e "reset,${{ matrix.tox-env }}${{ matrix.stats-env }}"