mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-10-12 17:51:11 -04:00
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>
67 lines
2.1 KiB
YAML
67 lines
2.1 KiB
YAML
name: pkgcheck
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 12 * * *'
|
|
push:
|
|
branches: [dev]
|
|
pull_request:
|
|
branches: [dev]
|
|
|
|
env:
|
|
REPO_OWNER: "gentoo"
|
|
REPO_NAME: "guru"
|
|
REPO_WORKFLOW: "pkgcheck.yml"
|
|
IRC_NICK: "guru-ci"
|
|
IRC_HOST: "irc.libera.chat"
|
|
IRC_PORT: "6697"
|
|
IRC_CHANNEL: "#gentoo-guru"
|
|
|
|
jobs:
|
|
build:
|
|
# codeberg-tiny has a max runtime of 2min, but this usually isn't
|
|
# enough time for pkgcheck to do its thing, so use -medium (10min).
|
|
runs-on: codeberg-medium-lazy
|
|
container:
|
|
# At time of writing, the default image for codeberg-tiny-lazy is
|
|
# ghcr.io/catthehacker/ubuntu, which has bash 5.2.21. However,
|
|
# EAPI 9 requires bash >= 5.3. pkgcheck has an official image
|
|
# though! (albeit on github...)
|
|
image: ghcr.io/pkgcore/pkgcheck
|
|
|
|
steps:
|
|
# You need nodejs for actions/checkout. Yes, really.
|
|
- name: Install necessary packages
|
|
run: |
|
|
apk add nodejs
|
|
|
|
- name: Check out repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Prepare job
|
|
run: |
|
|
LAST_STATUS=$(python ./scripts/last_status.py)
|
|
IRC_NOTIFY=${{ forgejo.repository == 'gentoo/guru' && forgejo.event_name != 'pull_request' }}
|
|
echo "last_status=${LAST_STATUS}" >> "${FORGEJO_ENV}"
|
|
echo "irc_notify=${IRC_NOTIFY}" >> "${FORGEJO_ENV}"
|
|
|
|
- name: Run pkgcheck
|
|
run: |
|
|
./scripts/pkgcheck.sh
|
|
env:
|
|
PKGCHECK_ARGS: "--keywords=-RedundantVersion,-NonsolvableDepsInDev"
|
|
|
|
- name: Inform failure on IRC
|
|
if: ${{ failure() && env.last_status == 'success' && fromJSON(env.irc_notify) }}
|
|
run: |
|
|
python ./scripts/irc_notify.py
|
|
env:
|
|
IRC_MESSAGE: CI failure detected on job ${{ forgejo.workflow }} - ${{ forgejo.server_url }}/${{ forgejo.repository }}/actions/runs/${{ forgejo.run_number }}
|
|
|
|
- name: Inform recovery on IRC
|
|
if: ${{ success() && env.last_status != 'success' && fromJSON(env.irc_notify) }}
|
|
run: |
|
|
python ./scripts/irc_notify.py
|
|
env:
|
|
IRC_MESSAGE: CI on job ${{ forgejo.workflow }} is green again. Thanks!
|