diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 4475735..cfdda27 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -9,14 +9,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - # SHA-256 Gitea repo: actions/checkout's internal `git init` must also - # create a SHA-256 repo or the fetch-by-OID fails ("mismatched - # algorithms"). GIT_DEFAULT_HASH makes init match. (The build job below - # avoids checkout for the same SHA-256 reason but predates this - # workaround; its curl+tar still works, so it is left as-is.) - uses: actions/checkout@v4 - env: - GIT_DEFAULT_HASH: sha256 # setup-just fetches its binary from GitHub; on a Gitea runner the default # github-token is the *Gitea* token (GitHub rejects it 401), so pass none @@ -59,7 +52,8 @@ jobs: # pkgcore (pkgcheck) only reads /etc/portage/repos.conf, and the binhost # needs the Gentoo release keys we don't ship — disable binpkg signature # verification (ephemeral CI container) so prebuilt deps like dev-lang/go - # can be pulled instead of compiled. + # can be pulled instead of compiled. dev-vcs/git is pulled here too because + # actions/checkout (next step) shells out to git, and stage3 has none. - name: Configure portage run: | mkdir -p /etc/portage/repos.conf @@ -67,26 +61,22 @@ jobs: > /etc/portage/repos.conf/gentoo.conf sed -i '/^verify-signature/d' /etc/portage/binrepos.conf/gentoo.conf printf '\nverify-signature = false\n' >> /etc/portage/binrepos.conf/gentoo.conf - emerge -q --getbinpkg net-misc/curl dev-util/pkgcheck + emerge -q --getbinpkg dev-vcs/git dev-util/pkgcheck - # Place this overlay at /var/db/repos/azy5030. actions/checkout is avoided - # (SHA-256 Gitea repos break it); curl + tar fetches the source archive. + # Check out the overlay into the workspace (plain SHA-1 repo, so no + # GIT_DEFAULT_HASH override), then register that path with portage. - name: Check out overlay - env: - TOKEN: ${{ github.token }} + uses: actions/checkout@v4 + + - name: Register overlay with portage run: | - host=${GITHUB_SERVER_URL#http://}; host=${host#https://} - url="http://x-access-token:${TOKEN}@${host}/${GITHUB_REPOSITORY}/archive/${GITHUB_REF_NAME}.tar.gz" - curl -fsSL "$url" -o repo.tar.gz - mkdir -p /var/db/repos/azy5030 - tar xzf repo.tar.gz -C /var/db/repos/azy5030 --strip-components=1 - printf '[azy5030]\nlocation = /var/db/repos/azy5030\nmasters = gentoo\nauto-sync = false\n' \ + printf '[azy5030]\nlocation = %s\nmasters = gentoo\nauto-sync = false\n' "$GITHUB_WORKSPACE" \ > /etc/portage/repos.conf/azy5030.conf mkdir -p /etc/portage/package.accept_keywords echo 'dev-util/gitea-runner ~amd64' > /etc/portage/package.accept_keywords/gitea-runner - name: QA scan - run: pkgcheck scan --repo /var/db/repos/azy5030 dev-util/gitea-runner + run: pkgcheck scan --repo "$GITHUB_WORKSPACE" dev-util/gitea-runner # Full source build: portage fetches the upstream source tarball and the # vendor tarball (release asset), verifies them against the committed @@ -96,7 +86,7 @@ jobs: - name: Verify binary run: | - ver=$(find /var/db/repos/azy5030/dev-util/gitea-runner -name 'gitea-runner-*.ebuild' \ + ver=$(find "$GITHUB_WORKSPACE/dev-util/gitea-runner" -name 'gitea-runner-*.ebuild' \ | sed -E 's#.*/gitea-runner-(.*)\.ebuild#\1#' | sort -V | tail -1) gitea-runner --version gitea-runner --version | grep -q "v${ver}" diff --git a/CLAUDE.md b/CLAUDE.md index 99b312c..bd5fe38 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,8 +7,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co A personal **Gentoo ebuild repository (overlay)**, repo name `azy5030`, EAPI 8, `masters = gentoo`, thin + unsigned Manifests (`metadata/layout.conf`). It packages software not in the main `::gentoo` tree. Currently one package: -`dev-util/gitea-runner`. Hosted on a self-hosted Gitea at `git.azy.dev` whose repos -use SHA-256 object format. +`dev-util/gitea-runner`. Hosted on a self-hosted Gitea at `git.azy.dev`. (This repo +is a standard SHA-1 repo; the sibling `homeserver` repo is SHA-256, so workflow +snippets copied from it may carry a `GIT_DEFAULT_HASH: sha256` checkout override +that this repo must *not* use.) ## The vendored-build model (the core design) @@ -58,11 +60,14 @@ a Gentoo env with `go pkgdev git curl xz jq`. ## CI (`.gitea/workflows/ci.yaml`) -Runs on every push inside a `gentoo/stage3:amd64-openrc` container (the `runs-on` label -only schedules onto the Docker-backend runner). Steps: `emerge-webrsync` to sync -`::gentoo` → configure portage (disables binpkg signature verification so prebuilt deps -like `dev-lang/go` are pulled, not compiled) → **check out via `curl + tar`, not -`actions/checkout`** (it breaks on SHA-256 Gitea repos) into `/var/db/repos/azy5030` → +Runs on every push, two jobs. A **`lint`** job runs on the plain Docker-backend runner +(no container), checks out with `actions/checkout`, installs the linters, and runs +`just lint` (markdownlint/shellcheck/yamllint/actionlint). The **`build`** job has +`needs: lint` (lint is a gate) and runs inside a `gentoo/stage3:amd64-openrc` container: +`emerge-webrsync` to sync `::gentoo` → configure portage (disables binpkg signature +verification so prebuilt deps like `dev-lang/go` are pulled, not compiled; also pulls +`dev-vcs/git`, which `actions/checkout` needs and stage3 lacks) → `actions/checkout` +into `$GITHUB_WORKSPACE`, registered as the overlay via `repos.conf` → `pkgcheck scan` → `emerge` → assert `gitea-runner --version` matches the ebuild version. ## Conventions / gotchas