.github/workflows: trim comments, drop autobump-selftest
Long inline shell and repeated explanations obscure the job sequence. The engine already has its own selftest. Because one failed issue update must not cancel the others, disable matrix fail-fast. An empty eix result must produce an empty package map. Pin the push action because the dependency-table job grants it write access. Signed-off-by: Zakk <zakk@gentoozh.org>
This commit is contained in:
1 parent
5cefccb26c
commit
756d956d1e
14 files changed
+136
-310
No files matched your search
@@ -1,27 +1,21 @@
|
||||
# The bump workers' environment, built once instead of ~9.5 min per worker. The tree goes
|
||||
# out in the layer that fetched it: the workers webrsync their own.
|
||||
FROM gentoo/stage3:amd64-desktop-openrc
|
||||
|
||||
RUN emerge-webrsync --no-pgp-verify \
|
||||
&& { \
|
||||
# MAKEOPTS and CPU_FLAGS_X86 describe the runner, so the worker sets those itself
|
||||
echo 'FEATURES="${FEATURES} getbinpkg buildpkg"'; \
|
||||
echo 'PORTAGE_ELOG_CLASSES="qa warn error"'; \
|
||||
echo 'PORTAGE_ELOG_SYSTEM="save"'; \
|
||||
# several opted-in packages are non-free; masked ones defer as a "build failure"
|
||||
echo 'ACCEPT_LICENSE="*"'; \
|
||||
} >> /etc/portage/make.conf \
|
||||
&& mkdir -p /etc/portage/package.use \
|
||||
# match the binhost's USE or getbinpkg rejects its binpkgs and builds from source; keep
|
||||
# in sync with emerge-on-pr's list
|
||||
# ci-binhost USE must match the binhost or getbinpkg rejects its binpkgs.
|
||||
&& printf '%s\n' 'dev-qt/qtwebengine bindist' 'net-libs/webkit-gtk keyring' \
|
||||
> /etc/portage/package.use/ci-binhost \
|
||||
# Xvfb runs the GUI launch probe; dropping it only skips the probe
|
||||
# Xvfb runs the GUI launch probe.
|
||||
&& echo 'x11-base/xorg-server xvfb minimal -xorg' > /etc/portage/package.use/autobump-xvfb \
|
||||
&& getuto \
|
||||
&& install -dm775 -o root -g portage /var/cache/distfiles \
|
||||
# curl because stage3 ships only wget and the DeadUrl recheck needs it; portage-utils for
|
||||
# the --version smoke, iwdevtools for qa-vdb
|
||||
# curl supplies the DeadUrl recheck (stage3 has only wget); portage-utils supplies --version smoke, iwdevtools qa-vdb.
|
||||
&& emerge --quiet --getbinpkg --autounmask=y --autounmask-write=y --autounmask-continue=y \
|
||||
dev-lang/ruby dev-vcs/git dev-util/pkgdev dev-util/pkgcheck app-portage/portage-utils \
|
||||
app-portage/iwdevtools dev-util/github-cli app-misc/jq net-misc/curl \
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
# Self-test: prove the autobump CI chain actually runs in a real gentoo container
|
||||
# WITHOUT opening any PR — the container setup (make.conf/tooling/repos.conf fixes),
|
||||
# the autobump-rb clone, and the Ruby engine's --check on the real live nvchecker
|
||||
# queue. Manual only. Delete once autobump.yml has run for real, or keep as a
|
||||
# pre-deploy smoke test.
|
||||
name: autobump-selftest
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
selftest:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
container:
|
||||
image: gentoo/stage3:amd64-desktop-openrc
|
||||
options: --privileged
|
||||
|
||||
steps:
|
||||
- name: sync gentoo main tree
|
||||
run: emerge-webrsync --no-pgp-verify
|
||||
|
||||
- name: setup portage
|
||||
run: |
|
||||
{
|
||||
echo 'FEATURES="${FEATURES} getbinpkg"'
|
||||
echo "MAKEOPTS=\"\${MAKEOPTS} -j$(nproc)\""
|
||||
} >> /etc/portage/make.conf
|
||||
getuto
|
||||
install -dm775 -o root -g portage /var/cache/distfiles
|
||||
|
||||
- name: install tooling
|
||||
run: |
|
||||
emerge --quiet --getbinpkg --autounmask=y --autounmask-write=y --autounmask-continue=y \
|
||||
dev-lang/ruby dev-vcs/git dev-util/pkgdev dev-util/pkgcheck \
|
||||
app-portage/portage-utils dev-util/github-cli app-misc/jq net-misc/curl
|
||||
|
||||
- name: checkout overlay
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: fetch autobump-rb (the Ruby engine)
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: gentoo-zh/autobump-rb
|
||||
path: autobump-rb
|
||||
|
||||
- name: register overlay
|
||||
run: |
|
||||
mkdir -p /etc/portage/repos.conf
|
||||
cat > /etc/portage/repos.conf/gentoo.conf << EOF
|
||||
[DEFAULT]
|
||||
main-repo = gentoo
|
||||
|
||||
[gentoo]
|
||||
location = $(portageq get_repo_path / gentoo)
|
||||
EOF
|
||||
cat > /etc/portage/repos.conf/repo.conf << EOF
|
||||
[$(cat profiles/repo_name)]
|
||||
location = $(realpath .)
|
||||
priority = 0
|
||||
EOF
|
||||
git config --global --add safe.directory "$(realpath .)"
|
||||
|
||||
- name: dry-run — engine --check over the live queue (no bump, no PR)
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
# runs the engine --check over every open nvchecker issue and reports the
|
||||
# mechanical/escalate/defer breakdown. Non-destructive: no writes, no build.
|
||||
AUTOBUMP_REPO="$(realpath .)" bash autobump-rb/tools/shadow-check.sh
|
||||
@@ -1,34 +1,11 @@
|
||||
# autobump: try the mechanical version bumps that nvchecker filed as issues.
|
||||
#
|
||||
# Design:
|
||||
# - The plan job resolves the queue against cached state and hands workers disjoint shards;
|
||||
# workers share no state and collect merges their deltas.
|
||||
# - No model anywhere while AUTOBUMP_JUDGE is unset: whatever is not mechanically safe gets
|
||||
# an evidence comment on its issue and stops. The judge hook in autobump-sweep.py is for
|
||||
# later, where semantic judgment is worth a cheap model call.
|
||||
# - Mechanical bumps become normal PRs (draft when multi-arch), so emerge-on-pr and pkgcheck
|
||||
# re-verify everything and a human is still the only merger.
|
||||
#
|
||||
# Requires: repo setting "Allow GitHub Actions to create and approve pull
|
||||
# requests", and maintainer agreement that the bot pushes its topic branches
|
||||
# to this repo (the engine names them <category>-<pn>-<version>).
|
||||
#
|
||||
# Engine: autobump-rb (Ruby, cloned per-run, github.com/gentoo-zh/autobump-rb), driven via
|
||||
# AUTOBUMP_ENGINE. Its stage-6 build test is a real `emerge` (build deps via getbinpkg), so
|
||||
# from-source packages are actually build-tested, not just `ebuild install`; it also
|
||||
# escalates hackport/haskell-cabal bumps (dep bounds come from the upstream .cabal).
|
||||
|
||||
name: autobump
|
||||
|
||||
on:
|
||||
# chained to nvchecker rather than a clock: scheduled runs here start hours after their
|
||||
# cron, so a fixed offset cannot keep autobump behind the issues it reads
|
||||
# Scheduled runs can start hours late, so chain from nvchecker.
|
||||
workflow_run:
|
||||
workflows: [nvchecker]
|
||||
types: [completed]
|
||||
# a manual nvchecker run from a topic branch is not the daily queue
|
||||
branches: [master]
|
||||
# backstop: if nvchecker stops running, the queue would go quiet with nothing saying so
|
||||
schedule:
|
||||
- cron: '0 11 * * *'
|
||||
workflow_dispatch:
|
||||
@@ -68,20 +45,18 @@ permissions:
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
# the queue is the open issues, not nvchecker's output, so a failed issue or dispatch job
|
||||
# there does not hold the bumps back; only a cancelled run skips
|
||||
# A failed nvchecker run can still leave issues to bump.
|
||||
wait:
|
||||
if: >-
|
||||
(github.repository == 'gentoo-zh/overlay' || github.event_name == 'workflow_dispatch')
|
||||
&& github.event.workflow_run.conclusion != 'cancelled'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# the issues exist by now; this waits on the search index the queue is read through
|
||||
# The issue search index lags issue creation.
|
||||
- name: wait for the issues to settle
|
||||
if: github.event_name == 'workflow_run'
|
||||
run: sleep 60
|
||||
|
||||
# after plan, so a run with an empty queue builds nothing
|
||||
env:
|
||||
needs: plan
|
||||
if: ${{ fromJSON(needs.plan.outputs.plan).matrix.include[0] != null }}
|
||||
@@ -93,7 +68,6 @@ jobs:
|
||||
force: ${{ github.event_name == 'workflow_dispatch' && inputs.rebuild_env }}
|
||||
date: ${{ inputs.env_date || '' }}
|
||||
|
||||
# only the workers need portage, and a container start costs a 3.5 GB pull
|
||||
plan:
|
||||
needs: wait
|
||||
runs-on: ubuntu-latest
|
||||
@@ -110,6 +84,7 @@ jobs:
|
||||
repository: gentoo-zh/autobump-rb
|
||||
path: autobump-rb
|
||||
|
||||
# App-created PRs trigger the package checks.
|
||||
- name: mint app token
|
||||
id: app-token
|
||||
uses: actions/create-github-app-token@v3
|
||||
@@ -119,9 +94,7 @@ jobs:
|
||||
owner: gentoo-zh
|
||||
repositories: overlay
|
||||
|
||||
# the bundle controller dispatches bundle producers with these; only this job holds them.
|
||||
# A fork without the DRAFTS_BOT secrets still plans: its bundle reads go out anonymously
|
||||
# and a bundle that needs a dispatch stays unknown, which ends the run failed.
|
||||
# Only the planner dispatches bundle producers.
|
||||
- name: mint gentoo-deps token
|
||||
id: deps-token
|
||||
continue-on-error: true
|
||||
@@ -156,22 +129,18 @@ jobs:
|
||||
GH_TOKEN_GENTOO_ZH_DRAFTS: ${{ steps.drafts-token.outputs.token }}
|
||||
XDG_STATE_HOME: ${{ github.workspace }}/.autobump-state
|
||||
AUTOBUMP_BUNDLE_CONTROLLER: autobump-rb/bin/bundles.py
|
||||
ISSUES: ${{ github.event.inputs.issues }}
|
||||
LIMIT: ${{ github.event.inputs.limit || 0 }}
|
||||
RETRY: ${{ github.event.inputs.retry == 'true' && '--retry' || '' }}
|
||||
BUNDLES_ONLY: ${{ github.event.inputs.bundles_only == 'true' && '--bundles-only' || '' }}
|
||||
ISSUES: ${{ inputs.issues }}
|
||||
LIMIT: ${{ inputs.limit || 0 }}
|
||||
RETRY: ${{ format('{0}', inputs.retry) == 'true' && '--retry' || '' }}
|
||||
BUNDLES_ONLY: ${{ format('{0}', inputs.bundles_only) == 'true' && '--bundles-only' || '' }}
|
||||
SHARDS: '8'
|
||||
run: |
|
||||
# validate before use: ISSUES is space-separated issue numbers, LIMIT and SHARDS are ints.
|
||||
case "$ISSUES" in *[!0-9\ ]*) echo "issues must be numbers: $ISSUES" >&2; exit 1;; esac
|
||||
case "$LIMIT" in ''|*[!0-9]*) echo "limit must be a number: $LIMIT" >&2; exit 1;; esac
|
||||
# $ISSUES intentionally unquoted so it word-splits into positional args (validated above).
|
||||
# --comment: the plan tells an issue when its bundle was dispatched or escalated
|
||||
# shellcheck disable=SC2086
|
||||
plan=$(python3 scripts/autobump-sweep.py $ISSUES $RETRY $BUNDLES_ONLY --limit "$LIMIT" --comment --bundles bundles.json --bundles-delta autobump-delta-plan.json --plan "$SHARDS")
|
||||
echo "plan=$plan" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# the shards judge a bundle 404 from this snapshot, and collect needs the plan's ledger lines
|
||||
# even when no shard runs. A name is taken once per run, so "Re-run all jobs" overwrites.
|
||||
- name: upload bundle snapshot
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
@@ -188,7 +157,6 @@ jobs:
|
||||
|
||||
bump:
|
||||
needs: [env, plan]
|
||||
# a job-level block replaces the workflow defaults, so all four are listed
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
@@ -196,19 +164,14 @@ jobs:
|
||||
packages: read
|
||||
if: ${{ fromJSON(needs.plan.outputs.plan).matrix.include[0] != null }}
|
||||
runs-on: ubuntu-latest
|
||||
# a worker's fixed cost is paid in parallel, so more shards only shorten the tail one
|
||||
# slow package leaves behind
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 8
|
||||
matrix: ${{ fromJSON(needs.plan.outputs.plan).matrix }}
|
||||
# A heavy from-source dep (e.g. net-libs/nodejs for the pnpm/npm family) can take ~1h+; give the
|
||||
# per-op ceiling (AUTOBUMP_OP_TIMEOUT below) room for it and keep this job ceiling above one such
|
||||
# build plus a tail of light packages, so a heavy build finishes instead of being cut off mid-run.
|
||||
# Source dependencies such as nodejs can take over an hour.
|
||||
timeout-minutes: 360
|
||||
container:
|
||||
image: ${{ needs.env.outputs.image }}
|
||||
# the image is private until someone makes it public; do not depend on which it is
|
||||
credentials:
|
||||
username: gentoo-zh-bot
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -218,12 +181,10 @@ jobs:
|
||||
- name: sync gentoo main tree
|
||||
run: emerge-webrsync --no-pgp-verify
|
||||
|
||||
# describes the runner, so the image cannot carry it
|
||||
- name: tune portage for this runner
|
||||
run: echo "MAKEOPTS=\"\${MAKEOPTS} -j$(nproc)\"" >> /etc/portage/make.conf
|
||||
|
||||
# every shard restores, one saves: an entry holds the whole directory, and eight
|
||||
# near-copies a day would evict the rest of the repo's 10 GB
|
||||
# Every shard restores; only one saves because near-copies would evict the rest of the repo's 10 GB cache.
|
||||
- name: restore dependency binpkgs
|
||||
uses: actions/cache/restore@v6
|
||||
with:
|
||||
@@ -242,8 +203,7 @@ jobs:
|
||||
repository: gentoo-zh/autobump-rb
|
||||
path: autobump-rb
|
||||
|
||||
# outside the checkout: the engine switches branches under it. A failed controller leaves
|
||||
# no snapshot and no bundle item in any shard; the other packages still bump.
|
||||
# The engine switches branches, so the snapshot stays outside the checkout.
|
||||
- name: download bundle snapshot
|
||||
continue-on-error: true
|
||||
uses: actions/download-artifact@v8
|
||||
@@ -254,9 +214,7 @@ jobs:
|
||||
- name: register overlay
|
||||
run: |
|
||||
mkdir -p /etc/portage/repos.conf
|
||||
# pkgcore (pkgdev/pkgcheck) reads /etc/portage/repos.conf/ but NOT portage's
|
||||
# built-in default, so the gentoo repo must be declared here explicitly or
|
||||
# `pkgdev manifest` aborts with "default repo 'gentoo' is undefined or invalid".
|
||||
# pkgcore reads /etc/portage/repos.conf, not Portage's built-in default; declare gentoo or pkgdev manifest aborts.
|
||||
cat > /etc/portage/repos.conf/gentoo.conf << EOF
|
||||
[DEFAULT]
|
||||
main-repo = gentoo
|
||||
@@ -270,8 +228,6 @@ jobs:
|
||||
priority = 0
|
||||
EOF
|
||||
|
||||
# as in emerge-on-pr: the runner's CPU flags only for a package whose REQUIRED_USE the
|
||||
# baseline cannot meet, so dependencies keep the binhost's USE
|
||||
- name: set CPU flags for the packages that need them
|
||||
env:
|
||||
PACKAGES: ${{ matrix.packages }}
|
||||
@@ -283,18 +239,12 @@ jobs:
|
||||
done > /etc/portage/package.use/autobump-cpuflags
|
||||
cat /etc/portage/package.use/autobump-cpuflags
|
||||
|
||||
# Mint an installation token for the gentoo-zh-autobump GitHub App. A PR opened with
|
||||
# the default GITHUB_TOKEN (github-actions[bot]) does NOT trigger emerge-on-pr/pkgcheck
|
||||
# -- GitHub blocks recursive workflow triggers -- so the verification safety net would
|
||||
# never run. An App token opens the PR as gentoo-zh-autobump[bot], which DOES trigger it.
|
||||
- name: mint app token
|
||||
id: app-token
|
||||
uses: actions/create-github-app-token@v3
|
||||
with:
|
||||
client-id: ${{ secrets.APP_CLIENT_ID }}
|
||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||
# the App is installed on gentoo-zh/overlay; name it explicitly so the token
|
||||
# resolves whether this workflow runs on the overlay or on a fork (dispatch test).
|
||||
owner: gentoo-zh
|
||||
repositories: overlay
|
||||
|
||||
@@ -307,25 +257,16 @@ jobs:
|
||||
- name: bump shard
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
# sync master from origin: after deploy, origin IS gentoo-zh/overlay, so this pulls
|
||||
# the latest master to bump against. LIVE_OVERLAY is left at its default -- the CI
|
||||
# overlay checkout is itself the registered repo, so separate_overlay is false and
|
||||
# the emerge runs against the workspace directly (no host-path ${{ github.workspace }}).
|
||||
AUTOBUMP_SYNC_REMOTE: origin
|
||||
# relative path on purpose: in a CONTAINER job ${{ github.workspace }} expands to
|
||||
# the HOST path (/home/runner/work/...), but the container mounts the workspace at
|
||||
# /__w/..., so an absolute host path does not exist inside the container. The sweep
|
||||
# cd's into the overlay (= the workspace), so a path relative to it always resolves.
|
||||
# Container mounts differ from github.workspace; use a relative engine path.
|
||||
AUTOBUMP_ENGINE: ruby autobump-rb/bin/autobump
|
||||
# allow a generous per-op ceiling so a heavy from-source build (net-libs/nodejs ~1h)
|
||||
# finishes instead of timing out and deferring; keep in step with timeout-minutes above.
|
||||
AUTOBUMP_OP_TIMEOUT: '7200'
|
||||
# inside the container: ${{ runner.temp }} is a host path the container lacks
|
||||
# runner.temp is a host path absent from the container.
|
||||
AUTOBUMP_EVIDENCE_DIR: /tmp/autobump-evidence
|
||||
AUTOBUMP_BUNDLE_STATUS: /tmp/autobump-bundles/bundles.json
|
||||
SHARD: ${{ toJSON(fromJSON(needs.plan.outputs.plan).shards[matrix.shard]) }}
|
||||
SHARD_ID: ${{ matrix.shard }}
|
||||
LIMIT: ${{ github.event.inputs.limit || 0 }}
|
||||
LIMIT: ${{ inputs.limit || 0 }}
|
||||
run: python3 scripts/autobump-sweep.py --worker "$SHARD" --delta "autobump-delta-$SHARD_ID.json" --limit "$LIMIT" --pr --comment
|
||||
|
||||
- name: save dependency binpkgs
|
||||
@@ -344,7 +285,6 @@ jobs:
|
||||
|
||||
- name: upload escalation evidence
|
||||
if: always()
|
||||
# evidence is for reading afterwards; losing it must not fail a bump that worked
|
||||
continue-on-error: true
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
@@ -368,7 +308,6 @@ jobs:
|
||||
key: autobump-state-${{ github.run_id }}
|
||||
restore-keys: autobump-state-
|
||||
|
||||
# the plan's delta is always there, so this runs even when no shard did
|
||||
- name: download deltas
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
@@ -384,17 +323,14 @@ jobs:
|
||||
shopt -s nullglob
|
||||
python3 scripts/autobump-sweep.py --collect "$PLAN" autobump-deltas/*.json
|
||||
|
||||
# a key is written once, so a rerun saves its dispatches under a key of its own; the
|
||||
# restore steps take the newest state by prefix
|
||||
- name: save state
|
||||
if: success()
|
||||
uses: actions/cache/save@v6
|
||||
with:
|
||||
path: ${{ github.workspace }}/.autobump-state/autobump
|
||||
# Cache keys are written once; run_attempt gives a rerun its own key.
|
||||
key: autobump-state-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
|
||||
# last, so the counts of this run are saved: a failed controller, or a bundle it could not
|
||||
# judge, must not pass as a quiet run
|
||||
- name: fail on a bundle controller error
|
||||
if: always() && fromJSON(needs.plan.outputs.plan).bundle_error
|
||||
env:
|
||||
|
||||
@@ -1,15 +1,3 @@
|
||||
# bundles: check or prepare the vendor bundles a package's ebuild downloads.
|
||||
#
|
||||
# One entry point for every gentoo-deps and gentoo-zh-drafts bundle: type the package, and
|
||||
# autobump-rb's bin/bundles.py resolves its repository, producer workflow and inputs from the
|
||||
# `deps` or `bundle` key in overlay.toml. `status` only reads; `prepare` dispatches the
|
||||
# producer when neither a release nor a producer run exists for the tag. The job summary links
|
||||
# the run and the release.
|
||||
#
|
||||
# autobump.yml plan runs the same script for every open nvchecker issue. A prepare here is
|
||||
# not written to autobump's ledger, so it does not count toward the three dispatches a
|
||||
# version gets there; run autobump with `bundles_only` to prepare through the ledger.
|
||||
|
||||
name: bundles
|
||||
|
||||
on:
|
||||
@@ -43,8 +31,7 @@ jobs:
|
||||
repository: gentoo-zh/autobump-rb
|
||||
path: autobump-rb
|
||||
|
||||
# each owner on its own: a failed mint must not skip the other owner's token or the
|
||||
# controller, which reports the owner it has no token for as unknown
|
||||
# One failed token mint must not prevent the other owner from running.
|
||||
- name: mint gentoo-deps token
|
||||
id: deps-token
|
||||
continue-on-error: true
|
||||
@@ -68,7 +55,6 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN_GENTOO_ZH: ${{ steps.deps-token.outputs.token }}
|
||||
GH_TOKEN_GENTOO_ZH_DRAFTS: ${{ steps.drafts-token.outputs.token }}
|
||||
# passed via env, never inlined into the script
|
||||
PACKAGES: ${{ inputs.packages }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
MODE: ${{ inputs.mode }}
|
||||
@@ -78,7 +64,7 @@ jobs:
|
||||
case "$VERSION" in *[!A-Za-z0-9_.+-]*) echo "not a version: $VERSION" >&2; exit 1;; esac
|
||||
args=()
|
||||
[ -n "$VERSION" ] && args=(--version "$VERSION")
|
||||
# $PACKAGES intentionally unquoted so it word-splits into atoms (validated above)
|
||||
# shellcheck disable=SC2086
|
||||
python3 autobump-rb/bin/bundles.py "$MODE" $PACKAGES "${args[@]}" --out bundles.json
|
||||
|
||||
- name: upload snapshot
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
name: fleet-keeper
|
||||
|
||||
# GitHub disables a repository's scheduled workflows after 60 days without a commit,
|
||||
# and does so silently. The gentoo-zh-drafts forks mirror upstream and build vendor
|
||||
# bundles on such a schedule, so a slow-moving package's fork stops producing bundles
|
||||
# once it crosses that line, with no error anywhere. This runs weekly from the overlay
|
||||
# (which commits daily, so it never freezes itself) and re-enables any fork schedule
|
||||
# GitHub has disabled for inactivity.
|
||||
|
||||
# Vendor forks can lose their schedules after 60 days without commits.
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 5 * * 1'
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
run: ./update-relation.sh
|
||||
- name: Push changes
|
||||
if: ${{ steps.update_relation.outputs.state == 'changed' }}
|
||||
uses: ad-m/github-push-action@master
|
||||
uses: ad-m/github-push-action@881a6320fdb16eb5318c5054f31c218aec2b324c
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: deps-table
|
||||
|
||||
@@ -3,8 +3,6 @@ name: nvchecker
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# * is a special character in YAML so you have to quote this string
|
||||
# UTC 09:00 -> CST (China) 17:00, see https://datetime360.com/cn/utc-cst-china-time/
|
||||
- cron: '0 09 * * *'
|
||||
|
||||
concurrency:
|
||||
@@ -25,10 +23,6 @@ jobs:
|
||||
run: |
|
||||
emerge-webrsync --no-pgp-verify
|
||||
|
||||
- name: cat binrepos
|
||||
run: |
|
||||
cat /etc/portage/binrepos.conf/*
|
||||
|
||||
- name: setup features
|
||||
run: |
|
||||
echo 'FEATURES="getbinpkg"' >> /etc/portage/make.conf
|
||||
@@ -36,7 +30,7 @@ jobs:
|
||||
|
||||
- name: install depends
|
||||
run: |
|
||||
emerge --verbose --quiet --jobs $(nproc) --autounmask y --autounmask-continue y \
|
||||
emerge --verbose --quiet --jobs "$(nproc)" --autounmask y --autounmask-continue y \
|
||||
app-eselect/eselect-repository \
|
||||
app-portage/eix \
|
||||
dev-vcs/git
|
||||
@@ -52,34 +46,7 @@ jobs:
|
||||
|
||||
- name: eix
|
||||
id: eix
|
||||
run: |
|
||||
# eselect
|
||||
echo "::group::eselect repository add and sync"
|
||||
repo_name=$(cat profiles/repo_name)
|
||||
eselect repository add "$repo_name" git "file://${PWD}"
|
||||
emerge --sync "$repo_name"
|
||||
egencache --jobs=$(nproc) --update --repo "$repo_name" &> /dev/null
|
||||
eix-update
|
||||
echo "::endgroup::"
|
||||
# eix
|
||||
echo "::group::eix search packages"
|
||||
# availableversions minus live: bestversion picks 9999, which nothing upstream beats
|
||||
pkgs=$(
|
||||
ACCEPT_LICENSE="*" ACCEPT_KEYWORDS="~amd64 ~arm64 ~loong ~riscv" EIX_LIMIT=0 \
|
||||
NONLIVE='{first}{!*nv}{}{!plainversion=9999}{!ishardmasked}{isstable}{*nv=<version>}{}{}{}{last}{$nv}<category>/<name>-<$nv>\n{}{}' \
|
||||
eix --pure-packages --in-overlay "$repo_name" --format '<availableversions:NONLIVE>'
|
||||
)
|
||||
pkgs=$(qatom -F "\"%{CATEGORY}/%{PN}\": \"%{PV}\"," $pkgs) # remove revision
|
||||
pkgs="{ ${pkgs::-1} }"
|
||||
echo $pkgs
|
||||
# use multiine string:
|
||||
# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#setting-an-output-parameter
|
||||
{
|
||||
echo 'pkgs<<EOF'
|
||||
echo "$pkgs"
|
||||
echo 'EOF'
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
echo "::endgroup::"
|
||||
run: scripts/nvchecker-eix.sh
|
||||
|
||||
nvchecker:
|
||||
needs: eix
|
||||
@@ -95,30 +62,30 @@ jobs:
|
||||
pip install nvchecker jq portage
|
||||
|
||||
- name: echo pkgs
|
||||
run: |
|
||||
echo '${{ needs.eix.outputs.pkgs }}'
|
||||
env:
|
||||
PACKAGES: ${{ needs.eix.outputs.pkgs }}
|
||||
run: echo "$PACKAGES"
|
||||
|
||||
- name: nvchecker
|
||||
id: nvchecker
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GENTOO_ZH_NVCHECKER_PAT }}
|
||||
PACKAGES: ${{ needs.eix.outputs.pkgs }}
|
||||
NVCHECKER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -o pipefail
|
||||
echo "::group::nvchecker"
|
||||
cd .github/workflows/
|
||||
echo '${{ needs.eix.outputs.pkgs }}' > old_ver.json
|
||||
echo -e "[keys]\ngithub = \"${{ secrets.GITHUB_TOKEN }}\"" > keyfile.toml
|
||||
printf '%s\n' "$PACKAGES" > old_ver.json
|
||||
printf '[keys]\ngithub = "%s"\n' "$NVCHECKER_TOKEN" > keyfile.toml
|
||||
nvchecker --file overlay.toml --keyfile keyfile.toml
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::nvcmp"
|
||||
# assign on its own line: inside echo "$(...)" the exit status is echo's,
|
||||
# so a failing pipe would go unnoticed until the matrix expands
|
||||
set -o pipefail
|
||||
# --sort portage: oldver comes from the tree, so PEP440 misreads _p and
|
||||
# _rc and reports a downgrade as an update
|
||||
# Tree oldver needs --sort portage: PEP440 misreads _p/_rc and reports downgrades as updates.
|
||||
nvcmp=$(nvcmp --file overlay.toml --json --newer --sort portage \
|
||||
| jq 'map({name, newver, oldver})' | jq -c .)
|
||||
echo "nvcmp=${nvcmp}" >> $GITHUB_OUTPUT
|
||||
echo "nvcmp=${nvcmp}" >> "$GITHUB_OUTPUT"
|
||||
echo "::endgroup::"
|
||||
|
||||
issues-bumper:
|
||||
@@ -126,6 +93,7 @@ jobs:
|
||||
if: needs.nvchecker.outputs.nvcmp != '[]'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include: ${{ fromJson(needs.nvchecker.outputs.nvcmp) }}
|
||||
steps:
|
||||
|
||||
@@ -9,7 +9,7 @@ on:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
scan:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@@ -20,13 +20,7 @@ jobs:
|
||||
with:
|
||||
args: --checks=-RedundantVersionCheck --keywords=-NonsolvableDepsInDev --exit=NonexistentDeps
|
||||
|
||||
# Scan only the packages the PR touches and leave the report for pkgcheck-comment
|
||||
# to post. The job above fails on NonexistentDeps alone, so a warning-level finding
|
||||
# on a changed ebuild is invisible unless someone opens the run log.
|
||||
#
|
||||
# This job must never hold a write token. pkgcheck sources the ebuilds it scans, so
|
||||
# it runs code from the pull request; on a fork PR GITHUB_TOKEN is read-only and the
|
||||
# comment is posted from a separate workflow that does not check this code out.
|
||||
# Ebuilds execute PR code; the write token belongs to pkgcheck-comment.
|
||||
report:
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
@@ -34,7 +28,7 @@ jobs:
|
||||
image: ghcr.io/pkgcore/pkgcheck:latest
|
||||
defaults:
|
||||
run:
|
||||
# the image has no /bin/bash symlink, so GitHub falls back to sh
|
||||
# The image has no /bin/bash symlink.
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@@ -44,73 +38,15 @@ jobs:
|
||||
|
||||
- name: Collect the packages this PR touches
|
||||
id: pkgs
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git config --global --add safe.directory '*'
|
||||
# checkout leaves the pull request's merge ref here: parent 1 is the base branch
|
||||
# tip, parent 2 is the PR head. Diff between them for the PR's own changes.
|
||||
# pull_request.base.sha is the base tip from when the PR was opened, so once
|
||||
# master moves the packages merged since would be counted as this PR's.
|
||||
git diff --name-only --diff-filter=d 'HEAD^1...HEAD^2' \
|
||||
| awk -F/ 'NF > 2 { print $1"/"$2 }' | sort -u > touched.txt
|
||||
# gentoo-zh carries no profiles/categories, so decide by what is on disk: a
|
||||
# touched path is a package only if the directory still holds ebuilds. That
|
||||
# drops .github/, profiles/ and a package the PR removed outright.
|
||||
: > packages.txt
|
||||
while read -r pkg; do
|
||||
ls "${pkg}"/*.ebuild >/dev/null 2>&1 || continue
|
||||
echo "${pkg}" >> packages.txt
|
||||
done < touched.txt
|
||||
echo "count=$(wc -l < packages.txt)" >> "$GITHUB_OUTPUT"
|
||||
cat packages.txt
|
||||
run: scripts/pkgcheck-report.sh packages
|
||||
|
||||
- name: Scan
|
||||
if: steps.pkgs.outputs.count != '0'
|
||||
run: |
|
||||
set -uo pipefail
|
||||
pmaint sync gentoo
|
||||
head=$(git rev-parse HEAD)
|
||||
|
||||
scan() { # $1 report path, rest packages; no --exit, the gate is the build job
|
||||
local out=$1
|
||||
shift
|
||||
pmaint regen --dir ~/.cache/pkgcheck/repos . > /dev/null
|
||||
pkgcheck scan --checks=-RedundantVersionCheck --keywords=-NonsolvableDepsInDev \
|
||||
"$@" > "${out}" 2>&1 || true
|
||||
}
|
||||
|
||||
# package names come from the pull request, so keep them out of the command line
|
||||
mapfile -t pkgs < packages.txt
|
||||
scan report.txt "${pkgs[@]}"
|
||||
|
||||
# scan the base branch tip too, so a finding the pull request did not introduce
|
||||
# can be told from one it did; a package the PR adds is absent here, which
|
||||
# leaves all of its findings new
|
||||
git checkout --quiet 'HEAD^1'
|
||||
: > base-report.txt
|
||||
mapfile -t base_pkgs < <(
|
||||
for pkg in "${pkgs[@]}"; do
|
||||
ls "${pkg}"/*.ebuild > /dev/null 2>&1 && echo "${pkg}"
|
||||
done
|
||||
)
|
||||
[ "${#base_pkgs[@]}" -eq 0 ] || scan base-report.txt "${base_pkgs[@]}"
|
||||
git checkout --quiet "${head}"
|
||||
|
||||
python3 scripts/pkgcheck-new-findings.py base-report.txt report.txt > new.txt
|
||||
echo '--- new ---'; cat new.txt
|
||||
echo '--- all ---'; cat report.txt
|
||||
run: scripts/pkgcheck-report.sh scan
|
||||
|
||||
- name: Stage the report
|
||||
if: always()
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p pkgcheck-report
|
||||
# the head of the pull request, not the merge commit, so the comment names a
|
||||
# commit the author can see in the branch
|
||||
git rev-parse --short 'HEAD^2' > pkgcheck-report/commit
|
||||
cp packages.txt pkgcheck-report/packages 2>/dev/null || : > pkgcheck-report/packages
|
||||
cp report.txt pkgcheck-report/report.txt 2>/dev/null || : > pkgcheck-report/report.txt
|
||||
cp new.txt pkgcheck-report/new.txt 2>/dev/null || : > pkgcheck-report/new.txt
|
||||
run: scripts/pkgcheck-report.sh stage
|
||||
|
||||
- name: Upload the report
|
||||
if: always()
|
||||
|
||||
@@ -65,7 +65,7 @@ Treat `master` only as an upstream-sync branch.
|
||||
- Push only topic branches to an unambiguous personal fork, never `master` or the canonical remote. Use `--force-with-lease` after a rebase.
|
||||
- A missing or ambiguous personal fork blocks publishing, not local editing.
|
||||
- Preserve unrelated changes; never overwrite, revert, stage, or commit them.
|
||||
- For non-ebuild changes, check `.github/workflows/emerge-on-pr.yml` `ignore_list` so paths are not interpreted as package atoms.
|
||||
- For non-ebuild changes, check `scripts/emerge-targets.sh` `ignore_list` so paths are not interpreted as package atoms.
|
||||
- Stop before editing if any of these holds:
|
||||
|
||||
- The canonical remote is ambiguous.
|
||||
|
||||
+2
-2
@@ -43,8 +43,8 @@ Not suitable:
|
||||
|
||||
When in doubt, build-test first: Actions → autobump-trial → Run workflow, with `targets`
|
||||
set to nvchecker issue numbers separated by spaces. Each target gets a real bump, emerge,
|
||||
install and pkgcheck in the CI container and reports PASS, DEFER (transient, worth retrying) or
|
||||
FAIL, without opening a PR.
|
||||
install and pkgcheck through `scripts/autobump-trial.sh` in the `autobump-env` image. It reports
|
||||
PASS, DEFER (transient, worth retrying) or FAIL without opening a PR.
|
||||
|
||||
## Opting in and out
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* 带 `files/` patch 的包,因为 patch 每次都要重新验证。
|
||||
* 每个版本都要单独生成 vendor bundle、但 overlay.toml 没写明来源的包(见 [vendor bundle](#vendor-bundle))。
|
||||
|
||||
不确定就先做 build-test:Actions → autobump-trial → Run workflow,`targets` 填 nvchecker issue 号,空格分隔。每个目标会在 CI 容器里跑一遍真实的 bump、emerge、install 和 pkgcheck,汇报 PASS、DEFER(暂时性问题,值得重试)或 FAIL,不创建 PR。
|
||||
不确定就先做 build-test:Actions → autobump-trial → Run workflow,`targets` 填 nvchecker issue 号,空格分隔。`scripts/autobump-trial.sh` 在 `autobump-env` 镜像中执行 bump、emerge、install 和 pkgcheck,汇报 PASS、DEFER(暂时性问题,值得重试)或 FAIL,不创建 PR。
|
||||
|
||||
## 开启和关闭
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# needs-cpu-flags.sh - does a package need more CPU flags than the profile's baseline?
|
||||
# usage: needs-cpu-flags.sh <atom>
|
||||
# exit 0 when its REQUIRED_USE is unsatisfied with the baseline flags, 1 otherwise.
|
||||
# A masked package never reports its REQUIRED_USE, so every keyword and license is accepted.
|
||||
# usage: needs-cpu-flags.sh <atom>; exit 0 if baseline flags leave REQUIRED_USE unsatisfied.
|
||||
|
||||
atom=${1:?atom}
|
||||
# A masked package never reports REQUIRED_USE, so accept every keyword and license.
|
||||
output=$(ACCEPT_KEYWORDS="~$(portageq envvar ARCH)" ACCEPT_LICENSE="*" \
|
||||
emerge --pretend --quiet --nodeps "${atom}" 2>&1)
|
||||
grep -q REQUIRED_USE <<<"${output}"
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# usage: nvchecker-eix.sh
|
||||
set -euo pipefail
|
||||
|
||||
echo "::group::eselect repository add and sync"
|
||||
repo_name=$(cat profiles/repo_name)
|
||||
eselect repository add "$repo_name" git "file://${PWD}"
|
||||
emerge --sync "$repo_name"
|
||||
egencache --jobs="$(nproc)" --update --repo "$repo_name" &> /dev/null
|
||||
eix-update
|
||||
echo "::endgroup::"
|
||||
echo "::group::eix search packages"
|
||||
pkgs=$(
|
||||
# Use availableversions minus live versions because bestversion selects 9999.
|
||||
# shellcheck disable=SC2016
|
||||
ACCEPT_LICENSE="*" ACCEPT_KEYWORDS="~amd64 ~arm64 ~loong ~riscv" EIX_LIMIT=0 \
|
||||
NONLIVE='{first}{!*nv}{}{!plainversion=9999}{!ishardmasked}{isstable}{*nv=<version>}{}{}{}{last}{$nv}<category>/<name>-<$nv>\n{}{}' \
|
||||
eix --pure-packages --in-overlay "$repo_name" --format '<availableversions:NONLIVE>' || [ "$?" -eq 1 ]
|
||||
)
|
||||
if [ -n "$pkgs" ]; then
|
||||
mapfile -t atoms <<< "$pkgs"
|
||||
pkgs=$(qatom -F "\"%{CATEGORY}/%{PN}\": \"%{PV}\"," "${atoms[@]}")
|
||||
fi
|
||||
pkgs="{ ${pkgs%,} }"
|
||||
echo "$pkgs"
|
||||
{
|
||||
echo 'pkgs<<EOF'
|
||||
echo "$pkgs"
|
||||
echo 'EOF'
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
echo "::endgroup::"
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# usage: pkgcheck-report.sh packages|scan|stage
|
||||
set -euo pipefail
|
||||
|
||||
case "${1:?packages, scan or stage}" in
|
||||
packages)
|
||||
git config --global --add safe.directory '*'
|
||||
# The merge ref parents are the current base tip and PR head.
|
||||
git diff --name-only --diff-filter=d 'HEAD^1...HEAD^2' \
|
||||
| awk -F/ 'NF > 2 { print $1"/"$2 }' | sort -u > touched.txt
|
||||
: > packages.txt
|
||||
while read -r pkg; do
|
||||
ls "${pkg}"/*.ebuild >/dev/null 2>&1 || continue
|
||||
echo "${pkg}" >> packages.txt
|
||||
done < touched.txt
|
||||
echo "count=$(wc -l < packages.txt)" >> "$GITHUB_OUTPUT"
|
||||
cat packages.txt
|
||||
;;
|
||||
scan)
|
||||
pmaint sync gentoo
|
||||
head=$(git rev-parse HEAD)
|
||||
|
||||
scan() {
|
||||
local out=$1
|
||||
shift
|
||||
pmaint regen --dir ~/.cache/pkgcheck/repos . > /dev/null
|
||||
pkgcheck scan --checks=-RedundantVersionCheck --keywords=-NonsolvableDepsInDev \
|
||||
"$@" > "${out}" 2>&1 || true
|
||||
}
|
||||
|
||||
mapfile -t pkgs < packages.txt
|
||||
scan report.txt "${pkgs[@]}"
|
||||
|
||||
git checkout --quiet 'HEAD^1'
|
||||
: > base-report.txt
|
||||
mapfile -t base_pkgs < <(
|
||||
for pkg in "${pkgs[@]}"; do
|
||||
ls "${pkg}"/*.ebuild > /dev/null 2>&1 && echo "${pkg}"
|
||||
done
|
||||
)
|
||||
[ "${#base_pkgs[@]}" -eq 0 ] || scan base-report.txt "${base_pkgs[@]}"
|
||||
git checkout --quiet "${head}"
|
||||
|
||||
python3 scripts/pkgcheck-new-findings.py base-report.txt report.txt > new.txt
|
||||
echo '--- new ---'; cat new.txt
|
||||
echo '--- all ---'; cat report.txt
|
||||
;;
|
||||
stage)
|
||||
mkdir -p pkgcheck-report
|
||||
git rev-parse --short 'HEAD^2' > pkgcheck-report/commit
|
||||
cp packages.txt pkgcheck-report/packages 2>/dev/null || : > pkgcheck-report/packages
|
||||
cp report.txt pkgcheck-report/report.txt 2>/dev/null || : > pkgcheck-report/report.txt
|
||||
cp new.txt pkgcheck-report/new.txt 2>/dev/null || : > pkgcheck-report/new.txt
|
||||
;;
|
||||
esac
|
||||
Reference in new issue
Block a user