ci: cut PR CI time with a prebuilt image, ccache, and no QML cachegen (#22)
CI took about 5 min 10 s per PR on vm-201: 1.5 min of `pacman -Syu` and 3.5 min of build, half of it qmlcachegen compiling QML the tests never load. Now it takes **1 min 49 s with a cold ccache and 26 s with a warm one**. - CI runs in a prebuilt Arch image with the build deps (`git.trivk.dev/tri/qtpotato-ci:latest`). `ci-image.yml` rebuilds it weekly, when its Dockerfile changes, or on demand. It builds on the runner's own Docker daemon, so vm-201 has the new image right away, since the runner does not re-pull tags it already has. - CI configures with `QT_QML_NO_CACHEGEN=ON` and no debug info. Release and AUR builds keep both. - ccache, kept between runs with `actions/cache`. - Docs-only changes (`README.md`, `LICENSES/`) skip CI. Pushing the image to the registry needed two workarounds. Gitea's Actions token cannot push container images, so it uses the `PACKAGE_TOKEN` secret from #21. Cloudflare rejects request bodies over 100 MB and `docker push` sends each layer in one request, so `regctl` (pinned by sha256) pushes the layers in 50 MB chunks. Giving vm-201 more vCPUs is left out; it is an infra change. Refs #20 Proof: on this PR, CI run 328 (cold ccache) took 1 min 49 s and run 332 (warm, 41/44 hits) took 26 s, both 8/8 tests. Image run 333 pushed the image, and the registry digest matches the runner's local image. A local build with the CI flags takes 74 steps instead of 154. Reviewed with sol-loop: 3 rounds with gpt-6.1-sol. Sol verdict: approved Created with Claude Opus 5.5 in Claude Code (T3 Code). Reviewed-on: #22 Co-authored-by: Tri Vo Khac <git@trivk.dev>
This commit was merged in pull request #22.
This commit is contained in:
1 parent
8a99cf0f7c
commit
f2ba1d0100
3 files changed
+70
-8
No files matched your search
@@ -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/*
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
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:
|
||||||
|
|
||||||
|
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
|
||||||
|
# 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. 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: |
|
||||||
|
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"
|
||||||
+23
-8
@@ -3,24 +3,39 @@ name: CI
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
paths-ignore: ['README.md', 'LICENSES/**']
|
||||||
pull_request:
|
pull_request:
|
||||||
|
paths-ignore: ['README.md', 'LICENSES/**']
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
# Arch Linux only ships x86_64 images, so pick an amd64 runner.
|
# Arch Linux only ships x86_64 images, so pick an amd64 runner.
|
||||||
runs-on: amd64
|
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:
|
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/checkout@v4
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: .ccache
|
||||||
|
key: ccache-${{ github.sha }}
|
||||||
|
restore-keys: ccache-
|
||||||
- name: Configure
|
- 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
|
- name: Build
|
||||||
run: cmake --build build
|
run: |
|
||||||
|
ccache -z
|
||||||
|
cmake --build build
|
||||||
|
ccache -s
|
||||||
- name: Test
|
- name: Test
|
||||||
env:
|
env:
|
||||||
QT_QPA_PLATFORM: offscreen
|
QT_QPA_PLATFORM: offscreen
|
||||||
|
|||||||
Reference in new issue
Block a user