19 Commits

Author SHA1 Message Date
f0f90af744 parse arch.list
All checks were successful
Gentoo Utils / build-oci-image (push) Successful in 17s
Gentoo Utils / check-format (push) Successful in 1m46s
Gentoo Utils / docs (push) Successful in 1m50s
Gentoo Utils / build (push) Successful in 2m1s
Gentoo Utils / test (push) Successful in 32s
2025-12-13 05:38:18 +00:00
948a178d23 read global package.mask 2025-12-13 05:38:18 +00:00
34fb5aad2f add mockrepo tests 2025-12-13 05:38:18 +00:00
d4948e9be7 read repo_name when opening repos 2025-12-13 05:38:18 +00:00
ba3538567e default to Eapi 0 if no eapi file exists 2025-12-13 05:38:18 +00:00
7da2e6d81d add docs to profile module 2025-12-13 05:38:18 +00:00
c84c1f328d read deprecated file in profiles 2025-12-13 05:38:18 +00:00
f409eb330b read eapi file in profiles 2025-12-13 05:38:18 +00:00
18171d151e add profile related source files to sources variable 2025-12-13 05:38:18 +00:00
10c5f0590f impl profile evaluation 2025-12-13 05:38:18 +00:00
f16e50681c Merge pull request 'Add docker image caching; split build job into build, test, check format jobs; add docs job' (#6) from feature/split-ci-into-more-jobs into master
All checks were successful
Gentoo Utils / build-oci-image (push) Successful in 15s
Gentoo Utils / check-format (push) Successful in 9s
Gentoo Utils / docs (push) Successful in 14s
Gentoo Utils / build (push) Successful in 20s
Gentoo Utils / test (push) Successful in 26s
Reviewed-on: #6
2025-12-12 23:19:39 -06:00
c82152a365 ci: add docs job
All checks were successful
Gentoo Utils / build-oci-image (push) Successful in 15s
Gentoo Utils / docs (push) Successful in 14s
Gentoo Utils / build (push) Successful in 19s
Gentoo Utils / check-format (push) Successful in 39s
Gentoo Utils / test (push) Successful in 26s
2025-12-12 23:18:06 -06:00
f16545e65b ci: add check-format job 2025-12-12 23:05:56 -06:00
e83ca9aab2 ci: add test job
Right now this just rebuilds everything the build job built. In a future
PR I will either cache the build dir from the build job or I will upload
the build dir as an artifact.
2025-12-12 23:05:56 -06:00
0d1f38f795 ci: update build job to only build 2025-12-12 23:05:56 -06:00
a290528679 ci: build-oci-image: cache .git dir in build-oci-image
ci: build-oci-image: fix logic for detecting changes to .docker in build-oci-image

ci: build-oci-image: use registry url variable, not hardcoded url

ci: build-oci-image: change changes_detected var to build image

ci: build-oci-image: output an image tag for other jobs to use

ci: build-oci-image: cache the docker image build

This wont always speed things up, but occasionally it will speed things
up by a lot
2025-12-12 23:05:53 -06:00
8a483e6d6c ci: set default shell to login shell
This way /etc/profile is sourced in our gentoo jobs
2025-12-12 23:05:05 -06:00
59c060df54 ci: build-oci-image: create entrypoint script and put env sources in it 2025-12-12 23:04:57 -06:00
91389abcb9 ci: simplify pipeline logic 2025-12-12 23:04:34 -06:00
3 changed files with 123 additions and 20 deletions

View File

@@ -31,4 +31,6 @@ USER gentooligan
WORKDIR /workspace 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,22 @@
name: Gentoo Utils name: Gentoo Utils
on: on: [push]
push:
branches: defaults:
'*' run:
pull_request: shell: bash -l {0}
branches: [master]
jobs: jobs:
build-oci-image: build-oci-image:
runs-on: ubuntu-latest runs-on: ubuntu-latest
continue-on-error: true continue-on-error: true
steps: steps:
- name: Restore git cache
uses: actions/cache@v4
with:
path: .git
key: gitea-repo-${{ gitea.repository }}-${{ gitea.ref }}
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v5 uses: actions/checkout@v5
with: with:
@@ -19,42 +24,132 @@ jobs:
- name: Check for changes before building - name: Check for changes before building
id: image-changes id: image-changes
# build image only if 1. changes are detected or 2. an image for the working branch doesnt exist
run: | run: |
echo "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITEA_OUTPUT branch_name="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
if ! git diff ${{ gitea.event.before }} ${{ gitea.sha }} --no-patch --exit-code .docker; then default_branch_name="${{ gitea.event.repository.default_branch }}"
echo changes_detected=true >> $GITEA_OUTPUT image_tag=latest
else comparison_hash="${{ gitea.event.before }}"
echo changes_detected=false >> $GITEA_OUTPUT
if [[ "$branch_name" != "$default_branch_name" ]]; then
image_tag=$branch_name
fi 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" >> $GITEA_OUTPUT
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 cat $GITEA_OUTPUT
- name: Set up Docker buildx - 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 uses: docker/setup-buildx-action@v3
with:
driver-opts: network=runners-net
- name: Log in to Github Container Registry - 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 uses: docker/login-action@v3
with: with:
registry: git.epenguin.net registry: ${{ vars.REGISTRY_URL }}
username: ${{ vars.CI_BOT_USERNAME }} username: ${{ vars.CI_BOT_USERNAME }}
password: ${{ secrets.CI_BOT_TOKEN }} password: ${{ secrets.CI_BOT_TOKEN }}
- name: Build and push - 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 uses: docker/build-push-action@v6
with: with:
push: true push: true
tags: git.epenguin.net/${{ gitea.repository }}:latest tags: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ steps.image-changes.outputs.image_tag }}
context: "{{defaultContext}}:.docker" context: "{{defaultContext}}:.docker"
cache-from: type=gha
cache-to: type=gha,mode=max
outputs:
image_tag: ${{ steps.image-changes.outputs.image_tag }}
build: build:
runs-on: brutalisk runs-on: brutalisk
container: env:
image: git.epenguin.net/gentoo-utils/gentoo-utils-gitea:latest CC: 'clang'
CXX: 'clang++'
needs: build-oci-image needs: build-oci-image
container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v5 uses: actions/checkout@v5
- name: build and check - 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
meson format --check-only --recursive
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
ninja rustdoc -C docs