From a4401936a09efc223c43185772bb71feaf42b1c2 Mon Sep 17 00:00:00 2001 From: Mateusz Pstrucha Date: Tue, 22 Sep 2026 20:12:29 +0200 Subject: [PATCH] Target the rocky-10 runner and its proven action conventions Match the setup already working on that runner: setup-* actions to provision toolchains rather than host-installed tooling, and the automatic GITHUB_TOKEN. Registry push keeps a dedicated REGISTRY_TOKEN, since the automatic token's scope doesn't reliably cover packages. Co-Authored-By: Claude Opus 5 --- .gitea/workflows/ci.yml | 25 ++++++++++++------------- .gitea/workflows/release.yml | 27 ++++++++++++++++----------- docs/release-process.md | 17 +++++++++-------- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 226f332..c5f227d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -7,15 +7,18 @@ on: jobs: test: - runs-on: ubuntu-latest - container: - image: rust:1-bookworm + runs-on: rocky-10 steps: - - uses: actions/checkout@v4 + - name: Check out source + uses: actions/checkout@v4 - # Cache both the registry and target dir — a cold Rust build here is - # several minutes, almost all of it dependencies that rarely change. - - uses: actions/cache@v4 + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Cache cargo + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -25,14 +28,10 @@ jobs: restore-keys: cargo- - name: Check formatting - run: | - rustup component add rustfmt - cargo fmt --check + run: cargo fmt --check - name: Clippy - run: | - rustup component add clippy - cargo clippy --all-targets -- -D warnings + run: cargo clippy --all-targets -- -D warnings # No DATABASE_URL needed: queries are runtime-checked (sqlx::query_as), # not compile-time macros, so this builds without a live Postgres. diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index decc781..86a759c 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -6,32 +6,37 @@ on: jobs: image: - runs-on: ubuntu-latest + runs-on: rocky-10 steps: - - uses: actions/checkout@v4 + - name: Check out source + uses: actions/checkout@v4 - name: Derive registry and version id: meta run: | - # github.server_url is the Gitea web root, e.g. https://git.app.ygg — - # the container registry lives on that same host, so there's no + # gitea.server_url is the web root, e.g. https://git.app.ygg — the + # container registry lives on that same host, so there's no # hostname to hardcode or keep in sync. - REGISTRY="$(echo '${{ github.server_url }}' | sed -E 's#^https?://##')" + REGISTRY="$(echo '${{ gitea.server_url }}' | sed -E 's#^https?://##')" VERSION="${GITHUB_REF_NAME#v}" - echo "registry=$REGISTRY" >> "$GITHUB_OUTPUT" - echo "image=$REGISTRY/${{ github.repository }}" >> "$GITHUB_OUTPUT" - echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "registry=$REGISTRY" >> "$GITHUB_OUTPUT" + echo "image=$REGISTRY/${{ gitea.repository }}" >> "$GITHUB_OUTPUT" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - name: Log in to Gitea container registry + - name: Log in to container registry run: | echo '${{ secrets.REGISTRY_TOKEN }}' \ | docker login '${{ steps.meta.outputs.registry }}' \ - -u '${{ github.actor }}' --password-stdin + -u '${{ gitea.actor }}' --password-stdin - - name: Build and push + - name: Build and push image run: | IMAGE='${{ steps.meta.outputs.image }}' VERSION='${{ steps.meta.outputs.version }}' docker build -t "$IMAGE:$VERSION" -t "$IMAGE:latest" . docker push "$IMAGE:$VERSION" docker push "$IMAGE:latest" + + - name: Log out + if: always() + run: docker logout '${{ steps.meta.outputs.registry }}' || true diff --git a/docs/release-process.md b/docs/release-process.md index deaf07e..0906994 100644 --- a/docs/release-process.md +++ b/docs/release-process.md @@ -108,14 +108,15 @@ Derived from the tag: `0.3.1` → `301`, `1.12.0` → `11200`. Android requires --- -## 4. Prerequisites before any of this runs +## 4. Prerequisites -These are assumptions the workflows make that haven't been verified against your actual Gitea instance: +All three workflows target `runs-on: rocky-10` and follow the conventions already proven on that runner by the `mtps/homepage` pipeline: `actions/checkout@v4`, `actions/setup-*` to provision toolchains, `akkuman/gitea-release-action@v1` for releases, and the automatic `secrets.GITHUB_TOKEN`. Nothing needs installing on the runner host — the setup actions handle Rust, Node, the JDK and the Android SDK. -1. **Gitea Actions is enabled** and at least one `act_runner` is registered with the `ubuntu-latest` label. -2. **The runner can build Docker images** — `tern-server`'s release job runs `docker build`, which needs either a Docker socket mounted into the runner or a docker-in-docker setup. This is the most likely thing to need adjusting; act_runner's default container mode doesn't give you a usable Docker daemon. -3. **The runner can fetch actions.** Gitea pulls `uses:` actions from GitHub by default. On a network-restricted mesh host this may need `[actions] DEFAULT_ACTIONS_URL` configured, or a local mirror. If fetching third-party actions is a problem, `akkuman/gitea-release-action` can be replaced with a plain `curl` against Gitea's release API — slightly more verbose, one less dependency. -4. **Secrets exist**: `REGISTRY_TOKEN` (packages: write) on server, `RELEASE_TOKEN` (repo write) on web and android, plus the four Android signing secrets. -5. **The container registry is enabled** on the instance, and `github.server_url` resolves to the registry host. The server workflow derives the registry from that rather than hardcoding a hostname — verify it matches your actual registry address on the first run. +What still needs doing, in order of how likely it is to bite: -Item 2 is the one I'd expect to bite first. +1. **`REGISTRY_TOKEN` secret on `tern-server`** — a token with `write:package` scope, for pushing the image. Unlike the release jobs, this one can't use the automatic `GITHUB_TOKEN`, whose scope doesn't reliably cover the package registry. (Worth trying `GITHUB_TOKEN` first on your instance; if it works, drop the extra secret.) +2. **The container registry is enabled**, and `gitea.server_url` matches the registry host. The workflow derives the registry from that rather than hardcoding — verify on the first run that the pushed image lands where you expect. +3. **Android signing secrets** — see §3 above: `ANDROID_KEYSTORE_B64`, `ANDROID_KEYSTORE_PASSWORD`, `ANDROID_KEY_ALIAS`, `ANDROID_KEY_PASSWORD`. +4. **`docker build` available to the job** — already proven on this runner. + +New toolchains for this runner are Rust (`dtolnay/rust-toolchain`) and the Android SDK (`android-actions/setup-android`). Both are widely used and should fetch fine given third-party actions already work there, but they're the two steps that haven't run on this box before, so they're the ones to watch on the first CI run.