7 Commits

Author SHA1 Message Date
daf23b9bb7 add readme
All checks were successful
Gentoo Utils / build-oci-image (push) Successful in 20s
Gentoo Utils / grep (push) Successful in 4s
Gentoo Utils / check-format (push) Successful in 10s
Gentoo Utils / docs (push) Successful in 18s
Gentoo Utils / build (push) Successful in 28s
Gentoo Utils / test (push) Successful in 34s
Gentoo Utils / fuzz (push) Successful in 1m26s
2025-12-27 12:31:57 -06:00
b87177d7a0 ci: fix build cache path
All checks were successful
Gentoo Utils / grep (push) Successful in 4s
Gentoo Utils / check-format (push) Successful in 10s
Gentoo Utils / build-oci-image (push) Successful in 20s
Gentoo Utils / docs (push) Successful in 18s
Gentoo Utils / build (push) Successful in 29s
Gentoo Utils / test (push) Successful in 34s
Gentoo Utils / fuzz (push) Successful in 1m22s
2025-12-27 12:28:27 -06:00
4fb2466a3a ci: redo docker build logic 2025-12-27 12:28:25 -06:00
6e1975107a update cache
All checks were successful
Gentoo Utils / build-oci-image (push) Successful in 7m31s
Gentoo Utils / grep (push) Successful in 1m26s
Gentoo Utils / docs (push) Successful in 1m32s
Gentoo Utils / check-format (push) Successful in 1m34s
Gentoo Utils / build (push) Successful in 1m44s
Gentoo Utils / test (push) Successful in 33s
Gentoo Utils / fuzz (push) Successful in 1m19s
2025-12-27 11:34:29 -06:00
69bde9b17f ci: image: use gentoo repo with EGIT_OVERRIDE_REPO_MESONBUILD_MESON for meson
All checks were successful
Gentoo Utils / build-oci-image (push) Successful in 7m34s
Gentoo Utils / grep (push) Successful in 1m8s
Gentoo Utils / check-format (push) Successful in 1m17s
Gentoo Utils / docs (push) Successful in 1m28s
Gentoo Utils / build (push) Successful in 1m39s
Gentoo Utils / test (push) Successful in 32s
Gentoo Utils / fuzz (push) Successful in 1m21s
2025-12-27 11:12:50 -06:00
db68959c73 Merge pull request 'CI: Use generic runner label 'gentoo'' (#15) from feature/switch-ci-to-generic-gentoo-runner-labels into master
All checks were successful
Gentoo Utils / build-oci-image (push) Successful in 10s
Gentoo Utils / docs (push) Successful in 18s
Gentoo Utils / build (push) Successful in 26s
Gentoo Utils / fuzz (push) Successful in 1m23s
Gentoo Utils / grep (push) Successful in 1m56s
Gentoo Utils / check-format (push) Successful in 2m5s
Gentoo Utils / test (push) Successful in 1m59s
Reviewed-on: #15
2025-12-24 11:18:42 -06:00
7969a0d8c0 ci: use generic label 'gentoo' which maps to any runner capable of running gentoo jobs
All checks were successful
Gentoo Utils / docs (push) Successful in 16s
Gentoo Utils / fuzz (push) Successful in 1m12s
Gentoo Utils / build-oci-image (push) Successful in 10s
Gentoo Utils / grep (push) Successful in 4s
Gentoo Utils / check-format (push) Successful in 10s
Gentoo Utils / build (push) Successful in 22s
Gentoo Utils / test (push) Successful in 37s
2025-12-21 14:10:17 -06:00
3 changed files with 111 additions and 54 deletions

View File

@@ -6,22 +6,19 @@ RUN getuto
RUN emerge-webrsync RUN emerge-webrsync
RUN mkdir -p /var/cache/distfiles/git3-src && chown portage:portage /var/cache/distfiles/git3-src
ENV EGIT_OVERRIDE_REPO_MESONBUILD_MESON=https://jturnerusa.dev/cgit/meson
RUN emerge \ RUN emerge \
=dev-lang/rust-bin-9999 \ =dev-lang/rust-bin-9999 \
=dev-build/meson-9999::gentoo \
llvm-core/clang \ llvm-core/clang \
llvm-core/lld \ llvm-core/lld \
dev-vcs/git \ dev-vcs/git \
sys-process/parallel \ sys-process/parallel \
net-libs/nodejs net-libs/nodejs
RUN git clone https://jturnerusa.dev/cgit/ebuilds/ /var/db/repos/spawns
COPY etc/portage/repos.conf /etc/portage/
RUN mkdir -p /var/cache/distfiles/git3-src && chown portage:portage /var/cache/distfiles/git3-src
RUN emerge =dev-build/meson-9999::spawns
RUN useradd -m gentooligan RUN useradd -m gentooligan
USER gentooligan USER gentooligan

View File

@@ -15,61 +15,55 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
continue-on-error: true continue-on-error: true
steps: steps:
- name: Checkout repo
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Restore git cache - name: Restore git cache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: .git path: .git
key: gitea-repo-${{ gitea.repository }}-${{ gitea.ref }} key: gitea-repo-${{ gitea.repository }}-${{ gitea.ref }}
- name: Checkout repo - name: Detect Changes
uses: actions/checkout@v5 uses: dorny/paths-filter@v3
with:
fetch-depth: 0
- 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 with:
filters: |
docker:
- ".docker/**"
- name: Metadata
id: metadata
run: | run: |
branch_name="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" branch_name="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
default_branch_name="${{ gitea.event.repository.default_branch }}" default_branch_name="${{ gitea.event.repository.default_branch }}"
image_tag=latest image_tag=latest
comparison_hash="${{ gitea.event.before }}" if [[ $default_branch_name != $branch_name ]]; then
this_image_tag="$(echo "$branch_name" | sed -E 's/[^a-zA-Z0-9]/-/g')"
if [[ "$branch_name" != "$default_branch_name" ]]; then echo "steps... ${{ steps.image-changes.outputs.docker }}"
image_tag=$branch_name if [[ ${{ steps.image-changes.outputs.docker }} == true ]] || docker manifest inspect ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${this_image_tag} >/dev/null 2>&1; then
fi image_tag=$this_image_tag
# 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
else
build_image=true
fi fi
echo "default_branch_name=$default_branch_name" >> $GITEA_OUTPUT echo "default_branch_name=$default_branch_name" >> $GITEA_OUTPUT
echo "branch_name=$branch_name" >> $GITEA_OUTPUT echo "branch_name=$branch_name" >> $GITEA_OUTPUT
echo "image_tag=$image_tag" >> $GITEA_OUTPUT echo "image_tag=$image_tag" >> $GITEA_OUTPUT
echo "comparison_hash=$comparison_hash" >> $GITEA_OUTPUT echo "build_image=${build_image:-${{ steps.image-changes.outputs.docker }}}" >> $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.build_image == 'true' if: steps.metadata.outputs.build_image == 'true'
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
with: with:
driver-opts: network=runners-net driver-opts: network=runners-net
- name: Log in to Github Container Registry - name: Log in to Github Container Registry
if: steps.image-changes.outputs.build_image == 'true' if: steps.metadata.outputs.build_image == 'true'
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ${{ vars.REGISTRY_URL }} registry: ${{ vars.REGISTRY_URL }}
@@ -77,26 +71,32 @@ jobs:
password: ${{ secrets.CI_BOT_TOKEN }} password: ${{ secrets.CI_BOT_TOKEN }}
- name: Build and push - name: Build and push
if: steps.image-changes.outputs.build_image == 'true' if: steps.metadata.outputs.build_image == 'true'
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
push: true push: true
tags: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ steps.image-changes.outputs.image_tag }} tags: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ steps.metadata.outputs.image_tag }}
context: "{{defaultContext}}:.docker" context: "{{defaultContext}}:.docker"
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
outputs: outputs:
image_tag: ${{ steps.image-changes.outputs.image_tag }} image_tag: ${{ steps.metadata.outputs.image_tag }}
build: build:
runs-on: brutalisk runs-on: gentoo
env: env:
CC: 'clang' CC: "clang"
CXX: 'clang++' CXX: "clang++"
needs: build-oci-image needs: build-oci-image
container: container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }} image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
steps: steps:
- name: Restore git cache
uses: actions/cache@v4
with:
path: build
key: gitea-repo-${{ gitea.repository }}-${{ gitea.ref }}
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v5 uses: actions/checkout@v5
@@ -108,14 +108,19 @@ jobs:
# FIXME: Currently this rebuilds everything. Instead we should bring over the build dir from the build job. This will come in handy # 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 # when we have multiple build targets and configs. What we have currently is fine until we get lots of builds going
test: test:
runs-on: brutalisk runs-on: gentoo
env: env:
CC: 'clang' CC: "clang"
CXX: 'clang++' CXX: "clang++"
needs: [build-oci-image, build] needs: [build-oci-image, build]
container: container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }} image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
steps: steps:
- name: Restore git cache
uses: actions/cache@v4
with:
path: build
key: gitea-repo-${{ gitea.repository }}-${{ gitea.ref }}
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v5 uses: actions/checkout@v5
@@ -126,15 +131,20 @@ jobs:
ninja test -C build ninja test -C build
fuzz: fuzz:
runs-on: brutalisk runs-on: gentoo
env: env:
CC: 'clang' CC: "clang"
CXX: 'clang++' CXX: "clang++"
FUZZER_TIMEOUT_S: 300 FUZZER_TIMEOUT_S: 300
needs: [build-oci-image, build] needs: [build-oci-image, build]
container: container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }} image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
steps: steps:
- name: Restore git cache
uses: actions/cache@v4
with:
path: build
key: gitea-repo-${{ gitea.repository }}-${{ gitea.ref }}
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v5 uses: actions/checkout@v5
@@ -158,7 +168,7 @@ jobs:
continue-on-error: true continue-on-error: true
check-format: check-format:
runs-on: brutalisk runs-on: gentoo
needs: [build-oci-image] needs: [build-oci-image]
container: container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }} image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
@@ -173,7 +183,7 @@ jobs:
ninja rustfmt -C build ninja rustfmt -C build
docs: docs:
runs-on: brutalisk runs-on: gentoo
needs: [build-oci-image] needs: [build-oci-image]
container: container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }} image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}
@@ -187,7 +197,7 @@ jobs:
ninja rustdoc -C docs ninja rustdoc -C docs
grep: grep:
runs-on: brutalisk runs-on: gentoo
needs: [build-oci-image] needs: [build-oci-image]
container: container:
image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }} image: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ needs.build-oci-image.outputs.image_tag }}

50
README.org Normal file
View File

@@ -0,0 +1,50 @@
#+title: Gentoo Utils
* Getting Started
Gentoo Utils must be compiled from source currently. See the compiling from source section for more information.
* Development :development:contributing:
There are two main avenues for development:
- compiling normally using packages via portage
- using the podman container
** Development without using a podman container
*** Install Build Prerequisites
- dev-lang/rust-bin-9999
- llvm-core/clang
- llvm-core/lld
- sys-process/parallel (Needed for =check.sh=)
- dev-build/meson
Install build deps:
#+begin_src bash :noeval
emerge -a dev-lang/rust-bin-9999 \
llvm-core/clang \
llvm-core/lld \
sys-process/parallel
#+end_src
Compiling this project currently requires using a patched meson. Install patched meson:
#+begin_src bash :noeval
EGIT_OVERRIDE_REPO_MESONBUILD_MESON=https://jturnerusa.dev/cgit/meson emerge -a =dev-build/meson-9999::gentoo
#+end_src
** Development using a podman container
The podman image comes with all the tools required to compile gentoo-utils.
Clone the repo
#+begin_src bash :noeval
git clone https://git.epenguin.net/gentoo-utils/gentoo-utils.git
cd gentoo-utils
#+end_src
Run the check script:
#+begin_src bash :noeval
podman run --rm --userns=keep-id -v $PWD:/workspace git.epenguin.net/gentoo-utils/gentoo-utils:latest ./check.sh
#+end_src
* Resources
pms-utils spec link