refactor: rewrite ci workflows
Build Container Image / build_latest_amd64 (push) Successful in 43s Details
Build Container Image / build_latest_i386 (push) Successful in 40s Details
Build Container Image / build_latest (push) Successful in 58s Details
Build Container Image / push_latest_amd64 (push) Successful in 1m20s Details
Build Container Image / push_latest_i386 (push) Successful in 1m17s Details
Build Container Image / push_latest (push) Successful in 1m38s Details
Build Container Image / update_readme (push) Successful in 10s Details

This commit is contained in:
Daniel Wolf 2024-03-26 19:42:09 -04:00
parent ec38309369
commit b50df21492
Signed by: nephatrine
GPG Key ID: 59D70EC2E4AAB4D0
3 changed files with 132 additions and 58 deletions

View File

@ -9,9 +9,10 @@ on:
schedule:
- cron: '40 20 * * 2'
jobs:
build_amd64:
if: gitea.repository_owner == 'NephNET' && (!contains(gitea.event.head_commit.message, '#noci') || gitea.event_name == 'schedule')
build_latest_amd64:
if: gitea.repository_owner == 'NephNET' && (!(startsWith(gitea.event.head_commit.message, 'chore') || startsWith(gitea.event.head_commit.message, 'docs')) || gitea.event_name == 'schedule')
runs-on: nephnet-amd64
continue-on-error: true
steps:
- name: Checkout Repository
uses: https://gitea.com/actions/checkout@v4
@ -24,6 +25,11 @@ jobs:
registry: code.nephatrine.net
username: ${{ gitea.actor }}
password: ${{ secrets.PACKAGER_TOKEN }}
- name: Docker Login (Pull Auth)
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build & Push (Master)
uses: https://github.com/docker/build-push-action@v5
if: gitea.ref_name == 'master' || gitea.ref_name == ''
@ -33,24 +39,44 @@ jobs:
provenance: false
pull: true
push: true
tags: code.nephatrine.net/nephnet/nxb-cross-haiku:latest-amd64
cache-from: type=registry,ref=code.nephatrine.net/nephnet/nxb-cross-haiku-cache:latest-amd64
cache-to: type=registry,image-manifest=true,oci-mediatypes=true,ref=code.nephatrine.net/nephnet/nxb-cross-haiku-cache:latest-amd64,mode=max
file: Dockerfile
tags: code.nephatrine.net/nephnet/nxb-cross-haiku-amd64:latest
cache-from: type=registry,ref=code.nephatrine.net/nephnet/nxb-cross-haiku-amd64:latest-cache
cache-to: type=registry,image-manifest=true,oci-mediatypes=true,ref=code.nephatrine.net/nephnet/nxb-cross-haiku-amd64:latest-cache,mode=max
- name: Build & Push (Branch)
if: gitea.ref_name != 'master' && gitea.ref_name != ''
run: |
export BRANCH=${GITHUB_REF##*/}
export BRANCH=${BRANCH:-unknown}
docker buildx build --pull -t code.nephatrine.net/nephnet/nxb-cross-haiku:${BRANCH}-latest-amd64 --platform linux/amd64 ${{ gitea.workspace }}
docker buildx build --pull -t code.nephatrine.net/nephnet/nxb-cross-haiku:${BRANCH}-latest-amd64 --platform linux/amd64 -f Dockerfile ${{ gitea.workspace }}
- name: Notify Discord
uses: https://github.com/sarisia/actions-status-discord@v1
if: failure() || gitea.event_name != 'schedule'
with:
title: "Container Build (X86_64)"
title: "Container Build (X86_64; R1B4)"
webhook: ${{ secrets.DISCORD_WEBHOOK_BUILD }}
build_i386:
if: gitea.repository_owner == 'NephNET' && (!contains(gitea.event.head_commit.message, '#noci') || gitea.event_name == 'schedule')
push_latest_amd64:
if: gitea.ref_name == 'master' || gitea.ref_name == ''
needs: [build_latest_amd64]
runs-on: nephnet-amd64
continue-on-error: true
steps:
- name: Docker Login
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Tag & Push
run: |
docker pull code.nephatrine.net/nephnet/nxb-cross-haiku-amd64:latest --platform linux/amd64
docker tag code.nephatrine.net/nephnet/nxb-cross-haiku-amd64:latest nephatrine/amd64:nxb-cross-haiku-latest
docker rmi code.nephatrine.net/nephnet/nxb-cross-haiku-amd64:latest
docker push nephatrine/amd64:nxb-cross-haiku-latest
docker rmi nephatrine/amd64:nxb-cross-haiku-latest
build_latest_i386:
if: gitea.repository_owner == 'NephNET' && (!(startsWith(gitea.event.head_commit.message, 'chore') || startsWith(gitea.event.head_commit.message, 'docs')) || gitea.event_name == 'schedule')
runs-on: nephnet-i386
continue-on-error: true
steps:
- name: Checkout Repository
uses: https://gitea.com/actions/checkout@v4
@ -63,6 +89,11 @@ jobs:
registry: code.nephatrine.net
username: ${{ gitea.actor }}
password: ${{ secrets.PACKAGER_TOKEN }}
- name: Docker Login (Pull Auth)
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Build & Push (Master)
uses: https://github.com/docker/build-push-action@v5
if: gitea.ref_name == 'master' || gitea.ref_name == ''
@ -72,58 +103,100 @@ jobs:
provenance: false
pull: true
push: true
tags: code.nephatrine.net/nephnet/nxb-cross-haiku:latest-i386
cache-from: type=registry,ref=code.nephatrine.net/nephnet/nxb-cross-haiku-cache:latest-i386
cache-to: type=registry,image-manifest=true,oci-mediatypes=true,ref=code.nephatrine.net/nephnet/nxb-cross-haiku-cache:latest-i386,mode=max
file: Dockerfile
tags: code.nephatrine.net/nephnet/nxb-cross-haiku-i386:latest
cache-from: type=registry,ref=code.nephatrine.net/nephnet/nxb-cross-haiku-i386:latest-cache
cache-to: type=registry,image-manifest=true,oci-mediatypes=true,ref=code.nephatrine.net/nephnet/nxb-cross-haiku-i386:latest-cache,mode=max
- name: Build & Push (Branch)
if: gitea.ref_name != 'master' && gitea.ref_name != ''
run: |
export BRANCH=${GITHUB_REF##*/}
export BRANCH=${BRANCH:-unknown}
docker buildx build --pull -t code.nephatrine.net/nephnet/nxb-cross-haiku:${BRANCH}-latest-i386 --platform linux/386 ${{ gitea.workspace }}
docker buildx build --pull -t code.nephatrine.net/nephnet/nxb-cross-haiku:${BRANCH}-latest-i386 --platform linux/386 -f Dockerfile ${{ gitea.workspace }}
- name: Notify Discord
uses: https://github.com/sarisia/actions-status-discord@v1
if: failure() || gitea.event_name != 'schedule'
if: failure()
with:
title: "Container Build (I686)"
title: "Container Build (I686; R1B4)"
webhook: ${{ secrets.DISCORD_WEBHOOK_BUILD }}
build_manifest:
push_latest_i386:
if: gitea.ref_name == 'master' || gitea.ref_name == ''
needs: [build_amd64, build_i386]
needs: [build_latest_i386]
runs-on: nephnet-amd64
continue-on-error: true
steps:
- name: Check Base Image
if: gitea.event_name == 'schedule'
uses: https://github.com/lucacome/docker-image-update-checker@v1
id: checkbase
- name: Docker Login
uses: https://github.com/docker/login-action@v3
with:
base-image: nephatrine/nxbuilder:debian-stable
image: nephatrine/nxbuilder:cross-haiku-r1b4
platforms: linux/amd64
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Tag & Push
run: |
docker pull code.nephatrine.net/nephnet/nxb-cross-haiku-i386:latest --platform linux/386
docker tag code.nephatrine.net/nephnet/nxb-cross-haiku-i386:latest nephatrine/ia32:nxb-cross-haiku-latest
docker rmi code.nephatrine.net/nephnet/nxb-cross-haiku-i386:latest
docker push nephatrine/ia32:nxb-cross-haiku-latest
docker rmi nephatrine/ia32:nxb-cross-haiku-latest
build_latest:
if: gitea.ref_name == 'master' || gitea.ref_name == ''
needs: [build_latest_amd64, build_latest_i386]
runs-on: nephnet
continue-on-error: true
steps:
- name: Docker Login
uses: https://github.com/docker/login-action@v3
with:
registry: code.nephatrine.net
username: ${{ gitea.actor }}
password: ${{ secrets.PACKAGER_TOKEN }}
- name: Docker Manifest
run: |
docker manifest create code.nephatrine.net/nephnet/nxb-cross-haiku:latest --amend code.nephatrine.net/nephnet/nxb-cross-haiku-amd64:latest --amend code.nephatrine.net/nephnet/nxb-cross-haiku-i386:latest
docker manifest create code.nephatrine.net/nephnet/nxb-cross-haiku:r1beta4 --amend code.nephatrine.net/nephnet/nxb-cross-haiku-amd64:latest --amend code.nephatrine.net/nephnet/nxb-cross-haiku-i386:latest
docker manifest push --purge code.nephatrine.net/nephnet/nxb-cross-haiku:latest
docker manifest push --purge code.nephatrine.net/nephnet/nxb-cross-haiku:r1beta4
- name: Notify Discord
uses: https://github.com/sarisia/actions-status-discord@v1
if: failure()
with:
title: "Container Publish (R1B4)"
webhook: ${{ secrets.DISCORD_WEBHOOK_PACKAGE }}
push_latest:
needs: [push_latest_amd64, push_latest_i386]
runs-on: nephnet
continue-on-error: true
steps:
- name: Docker Login
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Docker Manifest
run: docker buildx imagetools create -t code.nephatrine.net/nephnet/nxb-cross-haiku:latest -t nephatrine/nxbuilder:cross-haiku-r1b4 -t nephatrine/nxbuilder:cross-haiku code.nephatrine.net/nephnet/nxb-cross-haiku:latest-amd64 code.nephatrine.net/nephnet/nxb-cross-haiku:latest-i386
run: |
docker manifest create nephatrine/nxbuilder:debian-cross-haiku --amend nephatrine/amd64:nxb-cross-haiku-latest --amend nephatrine/ia32:nxb-cross-haiku-latest
docker manifest create nephatrine/nxb-cross-haiku:latest --amend nephatrine/amd64:nxb-cross-haiku-latest --amend nephatrine/ia32:nxb-cross-haiku-latest
docker manifest create nephatrine/nxb-cross-haiku:r1beta4 --amend nephatrine/amd64:nxb-cross-haiku-latest --amend nephatrine/ia32:nxb-cross-haiku-latest
docker manifest push --purge nephatrine/nxbuilder:debian-cross-haiku
docker manifest push --purge nephatrine/nxb-cross-haiku:latest
docker manifest push --purge nephatrine/nxb-cross-haiku:r1beta4
- name: Notify Discord
if: gitea.event_name != 'schedule' || steps.checkbase.outputs.needs-updating == 'true'
if: gitea.event_name != 'schedule'
uses: https://github.com/sarisia/actions-status-discord@v1
with:
title: "DockerHub: nxb-cross-haiku"
description: "The container image was pushed to [DockerHub](https://hub.docker.com/repository/docker/nephatrine/nxbuilder/general).\nPull `nephatrine/nxbuilder:cross-haiku-r1b4` for the newest image."
title: "DockerHub: nxb-cross-haiku (R1B4)"
description: "The container image was pushed to [DockerHub](https://hub.docker.com/repository/docker/nephatrine/nxb-cross-haiku/general).\nPull `nephatrine/nxb-cross-haiku:r1beta4` for the newest image."
nodetail: true
webhook: ${{ secrets.DISCORD_WEBHOOK_PACKAGE }}
- name: Notify Discord
uses: https://github.com/sarisia/actions-status-discord@v1
if: failure()
update_readme:
needs: [push_latest]
runs-on: nephnet
continue-on-error: true
steps:
- name: Checkout Repository
uses: https://gitea.com/actions/checkout@v4
- name: Docker Describe
uses: https://github.com/peter-evans/dockerhub-description@v3
with:
title: "Container Publish"
webhook: ${{ secrets.DISCORD_WEBHOOK_PACKAGE }}
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
repository: nephatrine/nxb-cross-haiku

View File

@ -2,16 +2,16 @@
#
# SPDX-License-Identifier: ISC
FROM code.nephatrine.net/nephnet/nxb-debian:stable
FROM code.nephatrine.net/nephnet/nxb-debian:latest
LABEL maintainer="Daniel Wolf <nephatrine@gmail.com>"
ENV HAIKU_VERSION="r1beta4"
RUN echo "====== BUILD JAM ======" \
&& git -C ${HOME} clone --single-branch --depth=1 --branch=${HAIKU_VERSION} https://review.haiku-os.org/buildtools.git \
&& cd ${HOME}/buildtools/jam \
&& git -C "${HOME}" clone --single-branch --depth=1 --branch="${HAIKU_VERSION}" https://review.haiku-os.org/buildtools.git \
&& cd "${HOME}/buildtools/jam" \
&& make -j$(( $(getconf _NPROCESSORS_ONLN) / 2 + 1 )) \
&& ./jam0 -j$(( $(getconf _NPROCESSORS_ONLN) / 2 + 1 )) -sBINDIR=/usr/local/bin install \
&& cd /tmp && rm -rf /tmp/* /var/tmp/* ${HOME}/buildtools
&& cd ../.. && rm -rf /tmp/* /var/tmp/* "${HOME}/buildtools"
ENV HAIKU_TOOLCHAIN=/opt/haiku/toolchain HAIKU_SYSROOT=/opt/haiku/sysroot
ENV PATH=${HAIKU_TOOLCHAIN}/bin:$PATH
@ -21,29 +21,29 @@ RUN echo "====== BUILD HAIKU ======" \
&& if [ "$(uname -m)" = "i686" ]; then \
export HAIKUARCH_TOOLCHAIN="x86" && export HAIKUARCH_SYSROOT="x86_gcc2"; else \
export HAIKUARCH_TOOLCHAIN="$(uname -m)" && export HAIKUARCH_SYSROOT="$(uname -m)"; fi \
&& git -C ${HOME} clone --single-branch --depth=1 --branch=${HAIKU_VERSION} https://review.haiku-os.org/buildtools.git \
&& git -C ${HOME} clone --branch=${HAIKU_VERSION} https://review.haiku-os.org/haiku.git \
&& git -C "${HOME}" clone --single-branch --depth=1 --branch="${HAIKU_VERSION}" https://review.haiku-os.org/buildtools.git \
&& git -C "${HOME}" clone --branch="${HAIKU_VERSION}" https://review.haiku-os.org/haiku.git \
&& mkdir -p /opt/haiku && cd /opt/haiku \
&& if [ ! "${HAIKUARCH_TOOLCHAIN}" = "${HAIKUARCH_SYSROOT}" ]; then \
${HOME}/haiku/configure --build-cross-tools ${HAIKUARCH_SYSROOT} --build-cross-tools ${HAIKUARCH_TOOLCHAIN} --cross-tools-source ${HOME}/buildtools --distro-compatibility compatible --use-gcc-pipe -j$(( $(getconf _NPROCESSORS_ONLN) / 2 + 1 )); else \
${HOME}/haiku/configure --build-cross-tools ${HAIKUARCH_TOOLCHAIN} --cross-tools-source ${HOME}/buildtools --distro-compatibility compatible --use-gcc-pipe -j$(( $(getconf _NPROCESSORS_ONLN) / 2 + 1 )); fi \
&& ln -s cross-tools-${HAIKUARCH_TOOLCHAIN} toolchain \
"${HOME}/haiku/configure" --build-cross-tools "${HAIKUARCH_SYSROOT}" --build-cross-tools "${HAIKUARCH_TOOLCHAIN}" --cross-tools-source "${HOME}/buildtools" --distro-compatibility compatible --use-gcc-pipe -j$(( $(getconf _NPROCESSORS_ONLN) / 2 + 1 )); else \
"${HOME}/haiku/configure" --build-cross-tools "${HAIKUARCH_TOOLCHAIN}" --cross-tools-source "${HOME}/buildtools" --distro-compatibility compatible --use-gcc-pipe -j$(( $(getconf _NPROCESSORS_ONLN) / 2 + 1 )); fi \
&& ln -s "cross-tools-${HAIKUARCH_TOOLCHAIN}" toolchain \
&& jam -j$(( $(getconf _NPROCESSORS_ONLN) / 2 + 1 )) -q @install \
&& jam -j$(( $(getconf _NPROCESSORS_ONLN) / 2 + 1 )) -q haiku.hpkg haiku_devel.hpkg haiku_source.hpkg '<build>package' \
&& if [ ! "${HAIKUARCH_TOOLCHAIN}" = "${HAIKUARCH_SYSROOT}" ]; then jam -j$(( $(getconf _NPROCESSORS_ONLN) / 2 + 1 )) -q haiku_${HAIKUARCH_TOOLCHAIN}.hpkg haiku_${HAIKUARCH_TOOLCHAIN}_devel.hpkg; fi \
&& ln -s cross-tools-${HAIKUARCH_SYSROOT}/sysroot sysroot \
&& if [ ! "${HAIKUARCH_TOOLCHAIN}" = "${HAIKUARCH_SYSROOT}" ]; then jam -j$(( $(getconf _NPROCESSORS_ONLN) / 2 + 1 )) -q "haiku_${HAIKUARCH_TOOLCHAIN}.hpkg" "haiku_${HAIKUARCH_TOOLCHAIN}_devel.hpkg"; fi \
&& ln -s "cross-tools-${HAIKUARCH_SYSROOT}/sysroot" sysroot \
&& mkdir -p /usr/local/lib/$(uname -m)-linux-gnu/ \
&& cp -nrv ./objects/linux/lib/*.so /usr/local/lib/$(uname -m)-linux-gnu/ && ldconfig \
&& cp -nv ./objects/linux/${HAIKUARCH_TOOLCHAIN}/release/tools/package/package /usr/local/bin/ \
&& cp -nv ./objects/linux/${HAIKUARCH_TOOLCHAIN}/release/tools/package_repo/package_repo /usr/local/bin/ \
&& mkdir -p cross-tools-${HAIKUARCH_SYSROOT}/sysroot/boot/system/settings/package-repositories \
&& cp ./objects/haiku/${HAIKUARCH_SYSROOT}/packaging/repositories/Haiku-info ${HAIKU_SYSROOT}/boot/system/settings/package-repositories/Haiku \
&& cp ./objects/haiku/${HAIKUARCH_SYSROOT}/packaging/repositories/HaikuPorts-info ${HAIKU_SYSROOT}/boot/system/settings/package-repositories/HaikuPorts \
&& cp -nrv ./objects/linux/lib/*.so "/usr/local/lib/$(uname -m)-linux-gnu/" && ldconfig \
&& cp -nv "./objects/linux/${HAIKUARCH_TOOLCHAIN}/release/tools/package/package" /usr/local/bin/ \
&& cp -nv "./objects/linux/${HAIKUARCH_TOOLCHAIN}/release/tools/package_repo/package_repo" /usr/local/bin/ \
&& mkdir -p "cross-tools-${HAIKUARCH_SYSROOT}/sysroot/boot/system/settings/package-repositories" \
&& cp "./objects/haiku/${HAIKUARCH_SYSROOT}/packaging/repositories/Haiku-info" "${HAIKU_SYSROOT}/boot/system/settings/package-repositories/Haiku" \
&& cp "./objects/haiku/${HAIKUARCH_SYSROOT}/packaging/repositories/HaikuPorts-info" "${HAIKU_SYSROOT}/boot/system/settings/package-repositories/HaikuPorts" \
&& mv ./objects/haiku/${HAIKUARCH_SYSROOT}/packaging/packages/*.hpkg ./download/*.hpkg /tmp/ \
&& rm -rf Jamfile attributes build build_packages download objects tmp \
&& haiku-install haiku_devel gcc_syslibs_devel \
&& if [ "$(uname -m)" = "i686" ]; then haiku-install haiku_x86_devel gcc_x86_syslibs_devel; fi \
&& cd /tmp && rm -rf /tmp/* /var/tmp/* ${HOME}/buildtools ${HOME}/haiku
&& rm -rf /tmp/* /var/tmp/* "${HOME}/buildtools" "${HOME}/haiku"
RUN echo "====== INSTALL PACAKGES ======" \
&& if [ "$(uname -m)" = "i686" ]; then \
@ -63,11 +63,11 @@ RUN echo "====== WORK AROUND ANCIENT GCC ======" \
COPY override /
RUN echo "====== TEST TOOLCHAINS ======" \
&& git -C ${HOME} clone --single-branch --depth=1 https://code.nephatrine.net/nephatrine/hello-test.git \
&& mkdir /tmp/build-$(uname -m) && cd /tmp/build-$(uname -m) \
&& nxbuild-haiku-$(uname -m) -GNinja ${HOME}/hello-test \
&& mkdir "/tmp/build-$(uname -m)" && cd "/tmp/build-$(uname -m)" \
&& "nxbuild-haiku-$(uname -m)" -GNinja "${HOME}/hello-test" \
&& ninja && file HelloTest \
&& if [ "$(uname -m)" = "i686" ]; then sed -i 's~target_compile_features~#target_compile_features~g' ${HOME}/hello-test/CMakeLists.txt \
&& if [ "$(uname -m)" = "i686" ]; then sed -i 's~target_compile_features~#target_compile_features~g' "${HOME}/hello-test/CMakeLists.txt" \
&& mkdir /tmp/build-beos && cd /tmp/build-beos \
&& nxbuild-beos-$(uname -m) -G"Unix Makefiles" ${HOME}/hello-test \
&& nxbuild-beos-$(uname -m) -G"Unix Makefiles" "${HOME}/hello-test" \
&& make -j$(( $(getconf _NPROCESSORS_ONLN) / 2 + 1 )) && file HelloTest; fi \
&& cd /tmp && rm -rf /tmp/* /var/tmp/* ${HOME}/hello-test
&& cd .. && rm -rf /tmp/* /var/tmp/* "${HOME}/hello-test"

View File

@ -5,7 +5,7 @@ SPDX-License-Identifier: ISC
-->
[Git](https://code.nephatrine.net/NephNET/builder-cross-haiku/src/branch/master) |
[Docker](https://hub.docker.com/r/nephatrine/nxbuilder/)
[Docker](https://hub.docker.com/r/nephatrine/nxb-cross-haiku/)
# NXBuilder
@ -20,6 +20,7 @@ beyond that. It can also be used as a quick "cleanroom" to test builds in.
### Compilers
- [GCC](https://gcc.gnu.org/)
- [Go](https://go.dev/)
### Cross-Compilers
@ -37,5 +38,5 @@ beyond that. It can also be used as a quick "cleanroom" to test builds in.
You can spin up a quick temporary test container like this:
~~~
docker run --rm -ti nephatrine/nxbuilder:cross-haiku-r1b4 /bin/bash
docker run --rm -ti nephatrine/nxb-cross-haiku:latest /bin/bash
~~~