From d61e7b59aa9fb5daf4539d7226bd2d723a0acf5c Mon Sep 17 00:00:00 2001 From: Tri Vo Khac Date: Sat, 14 Nov 2026 02:28:52 +0700 Subject: [PATCH 1/4] ci: build in a prebuilt Arch image with ccache and no QML cachegen --- .gitea/ci-image/Dockerfile | 7 +++++++ .gitea/workflows/ci-image.yml | 31 +++++++++++++++++++++++++++++++ .gitea/workflows/ci.yml | 31 +++++++++++++++++++++++-------- 3 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 .gitea/ci-image/Dockerfile create mode 100644 .gitea/workflows/ci-image.yml diff --git a/.gitea/ci-image/Dockerfile b/.gitea/ci-image/Dockerfile new file mode 100644 index 0000000..59b0a33 --- /dev/null +++ b/.gitea/ci-image/Dockerfile @@ -0,0 +1,7 @@ +# Arch Linux with QtPotato's build dependencies, so CI skips the pacman step. +# Built and pushed by .gitea/workflows/ci-image.yml. +FROM archlinux:latest +RUN pacman -Syu --noconfirm --needed git nodejs base-devel cmake ninja ccache extra-cmake-modules \ + qt6-base qt6-declarative kirigami ki18n kcoreaddons kcrash kconfig \ + mpvqt qcoro qtkeychain-qt6 ffmpeg \ + && rm -rf /var/cache/pacman/pkg/* diff --git a/.gitea/workflows/ci-image.yml b/.gitea/workflows/ci-image.yml new file mode 100644 index 0000000..05a82cb --- /dev/null +++ b/.gitea/workflows/ci-image.yml @@ -0,0 +1,31 @@ +name: CI image + +# Builds the Arch image that ci.yml runs in, with the build dependencies preinstalled. +# Rebuilt weekly to pick up Arch updates. +on: + push: + branches: [main] + paths: ['.gitea/ci-image/**', '.gitea/workflows/ci-image.yml'] + schedule: + - cron: '0 3 * * 1' + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + image: + # The build runs on the runner's own Docker daemon, so the amd64 runner has the new + # image locally right away. It does not re-pull tags it already has. + runs-on: amd64 + env: + IMAGE: git.trivk.dev/tri/qtpotato-ci:latest + steps: + - uses: actions/checkout@v4 + - name: Build + run: docker build --pull -t "$IMAGE" .gitea/ci-image + - name: Push + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login git.trivk.dev -u "${{ github.actor }}" --password-stdin + docker push "$IMAGE" diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index c62940f..1b4e315 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -3,24 +3,39 @@ name: CI on: push: branches: [main] + paths-ignore: ['README.md', 'LICENSES/**'] pull_request: + paths-ignore: ['README.md', 'LICENSES/**'] jobs: build: # Arch Linux only ships x86_64 images, so pick an amd64 runner. runs-on: amd64 - container: archlinux:latest + # Arch with the build dependencies preinstalled; see ci-image.yml. + container: git.trivk.dev/tri/qtpotato-ci:latest + env: + CCACHE_DIR: ${{ github.workspace }}/.ccache + # Keep hits across weekly image rebuilds when the compiler did not change. + CCACHE_COMPILERCHECK: content + CCACHE_MAXSIZE: 500M steps: - - name: Install dependencies - run: | - pacman -Syu --noconfirm --needed git nodejs base-devel cmake ninja extra-cmake-modules \ - qt6-base qt6-declarative kirigami ki18n kcoreaddons kcrash kconfig \ - mpvqt qcoro qtkeychain-qt6 ffmpeg - uses: actions/checkout@v4 + - uses: actions/cache@v4 + with: + path: .ccache + key: ccache-${{ github.sha }} + restore-keys: ccache- - name: Configure - run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON + # The tests do not load QML, so skip QML cachegen and debug info: they take over + # half of the build. Release and AUR builds keep both. + run: | + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_DEBUG=-O0 \ + -DQT_QML_NO_CACHEGEN=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_TESTING=ON - name: Build - run: cmake --build build + run: | + ccache -z + cmake --build build + ccache -s - name: Test env: QT_QPA_PLATFORM: offscreen -- 2.54.0 From db0b44835d5c06ef2bbe241c5f64a343ea249dcf Mon Sep 17 00:00:00 2001 From: Tri Vo Khac Date: Sat, 14 Nov 2026 02:38:05 +0700 Subject: [PATCH 2/4] ci: push the CI image with a package token --- .gitea/workflows/ci-image.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/ci-image.yml b/.gitea/workflows/ci-image.yml index 05a82cb..8d2aa42 100644 --- a/.gitea/workflows/ci-image.yml +++ b/.gitea/workflows/ci-image.yml @@ -10,10 +10,6 @@ on: - cron: '0 3 * * 1' workflow_dispatch: -permissions: - contents: read - packages: write - jobs: image: # The build runs on the runner's own Docker daemon, so the amd64 runner has the new @@ -26,6 +22,10 @@ jobs: - name: Build run: docker build --pull -t "$IMAGE" .gitea/ci-image - name: Push + # Gitea's Actions token cannot push to the container registry, so this uses an + # access token with the write:package scope. + env: + TOKEN: ${{ secrets.PACKAGES_TOKEN }} run: | - echo "${{ secrets.GITHUB_TOKEN }}" | docker login git.trivk.dev -u "${{ github.actor }}" --password-stdin + echo "$TOKEN" | docker login git.trivk.dev -u "${{ github.repository_owner }}" --password-stdin docker push "$IMAGE" -- 2.54.0 From 471a6037a56cff0ecefb25a2b9a871406b287836 Mon Sep 17 00:00:00 2001 From: Tri Vo Khac Date: Sat, 14 Nov 2026 02:39:45 +0700 Subject: [PATCH 3/4] ci: reuse the PACKAGE_TOKEN secret for the CI image --- .gitea/workflows/ci-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/ci-image.yml b/.gitea/workflows/ci-image.yml index 8d2aa42..13a9af5 100644 --- a/.gitea/workflows/ci-image.yml +++ b/.gitea/workflows/ci-image.yml @@ -25,7 +25,7 @@ jobs: # Gitea's Actions token cannot push to the container registry, so this uses an # access token with the write:package scope. env: - TOKEN: ${{ secrets.PACKAGES_TOKEN }} + TOKEN: ${{ secrets.PACKAGE_TOKEN }} run: | echo "$TOKEN" | docker login git.trivk.dev -u "${{ github.repository_owner }}" --password-stdin docker push "$IMAGE" -- 2.54.0 From 378052183af0013b2c122a79f572d91d413d13c2 Mon Sep 17 00:00:00 2001 From: Tri Vo Khac Date: Sat, 14 Nov 2026 02:46:17 +0700 Subject: [PATCH 4/4] ci: push the CI image in chunks under Cloudflare's upload limit --- .gitea/workflows/ci-image.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/ci-image.yml b/.gitea/workflows/ci-image.yml index 13a9af5..594a85f 100644 --- a/.gitea/workflows/ci-image.yml +++ b/.gitea/workflows/ci-image.yml @@ -20,12 +20,21 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build - run: docker build --pull -t "$IMAGE" .gitea/ci-image + # No layer cache, so each rebuild picks up the week's Arch updates. + run: docker build --pull --no-cache -t "$IMAGE" .gitea/ci-image - name: Push # Gitea's Actions token cannot push to the container registry, so this uses an - # access token with the write:package scope. + # access token with the write:package scope. Cloudflare rejects request bodies over + # 100 MB and docker push sends each layer in one request, so regctl pushes the + # layers in 50 MB chunks instead. env: TOKEN: ${{ secrets.PACKAGE_TOKEN }} run: | - echo "$TOKEN" | docker login git.trivk.dev -u "${{ github.repository_owner }}" --password-stdin - docker push "$IMAGE" + curl -fsSL -o /usr/local/bin/regctl \ + https://github.com/regclient/regclient/releases/download/v0.11.7/regctl-linux-amd64 + echo "3737fbbdd791e04e7a831640b681f3397a376498e80e2ad9b1b2d27296f239bc /usr/local/bin/regctl" | sha256sum -c + chmod +x /usr/local/bin/regctl + echo "$TOKEN" | regctl registry login git.trivk.dev -u "${{ github.repository_owner }}" --pass-stdin + regctl registry set git.trivk.dev --blob-chunk 52428800 --blob-max 52428800 + docker save "$IMAGE" -o "$RUNNER_TEMP/image.tar" + regctl image import "$IMAGE" "$RUNNER_TEMP/image.tar" -- 2.54.0