24 Commits

Author SHA1 Message Date
f30963981f infra: actions: cache git repo
Some checks failed
Gentoo Utils / build (push) Has been cancelled
Gentoo Utils / test (push) Has been cancelled
Gentoo Utils / check-format (push) Has been cancelled
Gentoo Utils / docs (push) Has been cancelled
Gentoo Utils / build-oci-image (push) Has been cancelled
2025-12-12 18:42:37 -06:00
a3a8110658 infra: actions: fix docker changes detector so it doesnt always build on force pushes
Some checks failed
Gentoo Utils / build (push) Has been cancelled
Gentoo Utils / test (push) Has been cancelled
Gentoo Utils / check-format (push) Has been cancelled
Gentoo Utils / docs (push) Has been cancelled
Gentoo Utils / build-oci-image (push) Has been cancelled
2025-12-12 18:32:20 -06:00
314c761e6b test
Some checks failed
Gentoo Utils / build-oci-image (push) Successful in 8s
Gentoo Utils / check-format (push) Failing after 12s
Gentoo Utils / docs (push) Successful in 15s
Gentoo Utils / build (push) Successful in 29s
Gentoo Utils / test (push) Failing after 7s
2025-12-12 17:35:29 -06:00
ac679661bf oops
Some checks failed
Gentoo Utils / build-oci-image (push) Successful in 8s
Gentoo Utils / build (push) Failing after 4s
Gentoo Utils / test (push) Has been skipped
Gentoo Utils / check-format (push) Failing after 10s
Gentoo Utils / docs (push) Successful in 12s
2025-12-12 17:19:47 -06:00
4b628201c8 test
Some checks failed
Gentoo Utils / build-oci-image (push) Successful in 8s
Gentoo Utils / check-format (push) Failing after 11s
Gentoo Utils / docs (push) Successful in 14s
Gentoo Utils / build (push) Failing after 23s
Gentoo Utils / test (push) Has been skipped
2025-12-12 17:15:28 -06:00
208ead46f2 fixes
Some checks failed
Gentoo Utils / build-oci-image (push) Successful in 8s
Gentoo Utils / check-format (push) Failing after 10s
Gentoo Utils / docs (push) Successful in 16s
Gentoo Utils / build (push) Failing after 21s
Gentoo Utils / test (push) Has been skipped
2025-12-12 17:14:09 -06:00
975f340a86 fixes
Some checks failed
Gentoo Utils / build-oci-image (push) Successful in 8s
Gentoo Utils / build (push) Failing after 5s
Gentoo Utils / test (push) Has been skipped
Gentoo Utils / check-format (push) Failing after 10s
Gentoo Utils / docs (push) Successful in 12s
2025-12-12 16:58:52 -06:00
c5456279a1 fixes
Some checks failed
Gentoo Utils / build-oci-image (push) Successful in 6m14s
Gentoo Utils / check-format (push) Failing after 14s
Gentoo Utils / docs (push) Successful in 15s
Gentoo Utils / build (push) Failing after 27s
Gentoo Utils / test (push) Has been skipped
2025-12-12 16:14:57 -06:00
3a841bb11b test
Some checks failed
Gentoo Utils / build-oci-image (push) Successful in 2m19s
Gentoo Utils / docs (push) Failing after 30s
Gentoo Utils / check-format (push) Failing after 1m20s
Gentoo Utils / build (push) Failing after 1m33s
Gentoo Utils / test (push) Has been skipped
2025-12-12 16:03:56 -06:00
81b8750128 TEST
Some checks failed
Gentoo Utils / build-oci-image (push) Failing after 1m32s
Gentoo Utils / build (push) Has been skipped
Gentoo Utils / test (push) Has been skipped
Gentoo Utils / check-format (push) Has been skipped
Gentoo Utils / docs (push) Has been skipped
2025-12-12 15:55:44 -06:00
e9b1e238c3 FIXME: test
Some checks failed
Gentoo Utils / build-oci-image (push) Failing after 12s
Gentoo Utils / check-format (push) Has been skipped
Gentoo Utils / test (push) Has been skipped
Gentoo Utils / build (push) Has been skipped
Gentoo Utils / docs (push) Has been skipped
2025-12-12 14:40:07 -06:00
e5369812d7 infra: actions: add docs job
Some checks failed
Gentoo Utils / build-oci-image (push) Failing after 4m34s
Gentoo Utils / docs (push) Has been skipped
Gentoo Utils / build (push) Has been skipped
Gentoo Utils / test (push) Has been skipped
Gentoo Utils / check-format (push) Has been skipped
2025-12-12 14:11:47 -06:00
86b6150afd infra: actions: add check-format job
Some checks failed
Gentoo Utils / build-oci-image (push) Successful in 5m22s
Gentoo Utils / check-format (push) Failing after 1m43s
Gentoo Utils / build (push) Failing after 1m56s
Gentoo Utils / test (push) Has been skipped
2025-12-12 13:51:43 -06:00
6ffa55510f infra: actions: add test job 2025-12-12 13:51:43 -06:00
d4a410cb84 infra: actions: set build job to only build 2025-12-12 13:51:43 -06:00
b9f0e6c9f1 FIXME: committing this just to test the check format job 2025-12-12 13:51:43 -06:00
59b3ce7eab infra: image: switch to using ${{ vars.REGISTRY_URL }}
Doing this so I can change this site wide in the future without anything breaking
2025-12-12 13:51:43 -06:00
ecc2058e13 infra: image: fixes image_tag 2025-12-12 13:51:43 -06:00
722536bbb6 infra: image: fix image tag for build job 2025-12-12 13:51:43 -06:00
0c11eb718a infra: image: build image for branches if they dont exist 2025-12-12 13:51:43 -06:00
1d4e022512 infra: image: fixes c35db0f 2025-12-12 13:51:43 -06:00
b7c76b198b infra: image: protect :latest tag so only the default branch can push to it
infra: image: fix hard coded image name
2025-12-12 13:51:43 -06:00
cbfb3068e9 infra: image: create entrypoint script and put env sources in it 2025-12-12 13:51:43 -06:00
16ba661d2b infra: simplify pipeline logic 2025-12-12 13:51:43 -06:00
4 changed files with 122 additions and 21 deletions

View File

@@ -31,4 +31,6 @@ USER gentooligan
WORKDIR /workspace
ENTRYPOINT /bin/bash
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/bin/bash"]

6
.docker/entrypoint.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env sh
source /etc/profile
source /lib/gentoo/functions.sh
exec "$@"

View File

@@ -1,17 +1,18 @@
name: Gentoo Utils
on:
push:
branches:
'*'
pull_request:
branches: [master]
on: [push]
jobs:
build-oci-image:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Restore git cache
uses: actions/cache@v5
with:
path: .git
key: gitea-repo-${{ gitea.repository }}-${{ gitea.ref }}
- name: Checkout repo
uses: actions/checkout@v5
with:
@@ -19,42 +20,132 @@ jobs:
- name: Check for changes before building
id: image-changes
# build image only if 1. changes are detected or 2. an image for the working branch doesnt exist
run: |
echo "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITEA_OUTPUT
if ! git diff ${{ gitea.event.before }} ${{ gitea.sha }} --no-patch --exit-code .docker; then
echo changes_detected=true >> $GITEA_OUTPUT
else
echo changes_detected=false >> $GITEA_OUTPUT
echo "BEFORE = ${{ gitea.event.before }}"
branch_name="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
default_branch_name="${{ gitea.event.repository.default_branch }}"
image_tag=latest
comparison_hash="${{ gitea.event.before }}"
git --no-pager reflog
if [[ "$branch_name" != "${{ gitea.event.repository.default_branch }}" ]]; then
image_tag=$branch_name
fi
# slugify
image_tag="$(echo "$image_tag" | sed -E 's/[^a-zA-Z0-9]/-/g')"
# rebase breaks gitea.event.before, so check to make sure the hash provided exists
if ! git merge-base --is-ancestor $comparison_hash $branch_name >/dev/null 2>&1; then
comparison_hash=$(git merge-base origin/$default_branch_name $branch_name)
fi
if ! git diff $comparison_hash ${{ gitea.sha }} --no-patch --exit-code .docker; then
build_image=true
else
if ! docker manifest inspect ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${image_tag} >/dev/null 2>&1; then
build_image=true
else
build_image=false
fi
fi
echo "default_branch_name=$default_branch_name"
echo "branch_name=$branch_name" >> $GITEA_OUTPUT
echo "image_tag=$image_tag" >> $GITEA_OUTPUT
echo "comparison_hash=$comparison_hash" >> $GITEA_OUTPUT
echo "build_image=$build_image" >> $GITEA_OUTPUT
cat $GITEA_OUTPUT
- name: Set up Docker buildx
if: steps.image-changes.outputs.changes_detected == 'true'
if: steps.image-changes.outputs.build_image == 'true'
uses: docker/setup-buildx-action@v3
- name: Log in to Github Container Registry
if: steps.image-changes.outputs.changes_detected == 'true'
if: steps.image-changes.outputs.build_image == 'true'
uses: docker/login-action@v3
with:
registry: git.epenguin.net
registry: ${{ vars.REGISTRY_URL }}
username: ${{ vars.CI_BOT_USERNAME }}
password: ${{ secrets.CI_BOT_TOKEN }}
- name: Build and push
if: steps.image-changes.outputs.changes_detected == 'true'
if: steps.image-changes.outputs.build_image == 'true'
uses: docker/build-push-action@v6
with:
push: true
tags: git.epenguin.net/${{ gitea.repository }}:latest
tags: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ steps.image-changes.outputs.image_tag }}
context: "{{defaultContext}}:.docker"
outputs:
image_tag: ${{ steps.image-changes.outputs.image_tag }}
build:
runs-on: brutalisk
container:
image: git.epenguin.net/gentoo-utils/gentoo-utils-gitea:latest
env:
CC: 'clang'
CXX: 'clang++'
needs: build-oci-image
container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: build and check
run: ./check.sh
run: |
echo $USER
echo "CC=$CC"
echo "CXX=$CXX"
source /etc/profile
meson setup -Dfuzz=enabled -Dtests=enabled -Dbuildtype=debugoptimized -Ddocs=enabled build
meson compile -C build
# FIXME: Currently this rebuilds everything. Instead we should bring over the build dir from the build job. This will come in handy
# when we have multiple build targets and configs. What we have currently is fine until we get lots of builds going
test:
runs-on: brutalisk
env:
CC: 'clang'
CXX: 'clang++'
needs: [build-oci-image, build]
container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: test
run: |
meson setup -Dfuzz=enabled -Dtests=enabled -Dbuildtype=debugoptimized -Ddocs=enabled build
meson compile -C build
ninja test -C build
check-format:
runs-on: brutalisk
needs: [build-oci-image]
container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Check Formatting
run: |
meson setup -Dfuzz=enabled -Dtests=enabled -Dbuildtype=debugoptimized build
ninja rustfmt -C build
docs:
runs-on: brutalisk
needs: [build-oci-image]
container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Build Documentation
run: |
meson setup -Ddocs=enabled docs
meson compile -C docs

View File

@@ -710,7 +710,9 @@ mod test {
for (a, b, ordering) in cpvs.iter().copied().map(|(a, b, ordering)| {
(
Cpv::parser().parse_finished(InputIter::new(a)).unwrap(),
Cpv::parser().parse_finished(InputIter::new(b)).unwrap(),
Cpv::parser()
.parse_finished(InputIter::new(b))
.unwrap(),
ordering,
)
}) {