Files
Dustin Smith 7b6155cb78 Add CI/CD for Forgejo, for use on Codeberg
This commit replicates the CI/CD behavior we currently have on GitHub
by making the following changes:

- Jobs that used Actions were replaced with in-repo scripts. This
  removes the dependency on GitHub and makes the overall pipeline more
  forge-agnostic.

  - rectalogic/notify-irc replaced with ./scripts/irc_notify.py

  - pkgcore/pkgcheck-action replaced with ./scripts/pkgcheck.sh

- Actions that used `gh` (the GitHub CLI) were replaced with in-repo
  scripts that perform the same action but with the Forgejo API.

  - ./scripts/last_status.py to get the last status of a completed job
    (e.g. succeeded, failed, canceled)

  - ./scripts/last_successful_commit.py to get the last commit that had
    a successful job

- Forgejo-specific changes

  - Variables renamed from "github" to "forgejo" where appropriate
    (though Forgejo lets you get away with keeping them as "github" to
    make migration easier)

  - Use ./.forgejo/ instead of ./.github/ -- this will simultaneously
    keep the GitHub actions intact while also disabling the GitHub
    actions from running in Forgejo

- Codeberg-specific changes

  - Use codeberg-tiny-lazy shared runner for {duplicates,emails}.yml

  - Use codeberg-medium-lazy shared runner for pkgcheck.yml

Signed-off-by: Dustin Smith <d.usty360@gmail.com>
Part-of: https://codeberg.org/gentoo/guru/pulls/30
Merges: https://codeberg.org/gentoo/guru/pulls/30
Signed-off-by: Thomas Bracht Laumann Jespersen <laumann@gentoo.org>
2026-08-21 21:40:26 +02:00

32 lines
938 B
Bash
Executable File

#!/usr/bin/env bash
# All of this is lifted from pkgcore/pkgcheck-action; please see [1] for
# the real brains behind this work. All I've done is moved the logic
# into a standalone bash script so that we're as forge-agnostic as
# possible.
# [1]: https://github.com/pkgcore/pkgcheck-action/graphs/contributors?all=1
# ::(end)group:: is used to mark sections of collapsible CI/CD logs.
runner() {
echo "::group::${1}"
shift 1
"$@"
local exit=$?
echo
echo "::endgroup::"
return $exit
}
runner "Sync gentoo repo" \
pmaint sync gentoo
runner "Update repo metadata" \
pmaint regen --dir ~/.cache/pkgcheck/repos .
runner "Marking workspace safe for git" \
git config --global --add safe.directory '*'
runner "Run pkgcheck" \
pkgcheck --color y ci --failures failures.json --exit GentooCI \
"${PKGCHECK_ARGS}"
scan_exit_status=$?
pkgcheck replay --color y failures.json
exit $scan_exit_status