Skip to content

hydrun CI

hydrun CI #60

Workflow file for this run

name: hydrun CI
on:
push:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
build-linux:
name: Build
permissions: write-all
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull iPXE
run: |
rm -rf upstream
mkdir -p upstream
git clone https://github.com/ipxe/ipxe.git upstream
cd upstream
git checkout master
- name: Configure iPXE
run: |
sed -i -e 's/#undef\tDOWNLOAD_PROTO_HTTPS/#define\tDOWNLOAD_PROTO_HTTPS/g' upstream/src/config/general.h
sed -i -e 's|//#define CERT_CMD|#define CERT_CMD|g' upstream/src/config/general.h
sed -i -e 's|//#define CONSOLE_CMD|#define CONSOLE_CMD|g' upstream/src/config/general.h
sed -i -e 's|//#define DIGEST_CMD|#define DIGEST_CMD|g' upstream/src/config/general.h
sed -i -e 's|//#define IMAGE_COMBOOT|#define IMAGE_COMBOOT|g' upstream/src/config/general.h
sed -i -e 's|//#define IMAGE_GZIP|#define IMAGE_GZIP|g' upstream/src/config/general.h
sed -i -e 's|//#define IMAGE_PNG|#define IMAGE_PNG|g' upstream/src/config/general.h
sed -i -e 's|//#define IMAGE_TRUST_CMD|#define IMAGE_TRUST_CMD|g' upstream/src/config/general.h
sed -i -e 's|//#define IMAGE_ZLIB|#define IMAGE_ZLIB|g' upstream/src/config/general.h
sed -i -e 's|//#define NET_PROTO_IPV6|#define NET_PROTO_IPV6|g' upstream/src/config/general.h
sed -i -e 's|//#define NET_PROTO_LLDP|#define NET_PROTO_LLDP|g' upstream/src/config/general.h
sed -i -e 's|//#define NSLOOKUP_CMD|#define NSLOOKUP_CMD|g' upstream/src/config/general.h
sed -i -e 's|//#define NTP_CMD|#define NTP_CMD|g' upstream/src/config/general.h
sed -i -e 's|//#define PARAM_CMD|#define PARAM_CMD|g' upstream/src/config/general.h
sed -i -e 's|//#define PCI_CMD|#define PCI_CMD|g' upstream/src/config/general.h
sed -i -e 's|//#define PING_CMD|#define PING_CMD|g' upstream/src/config/general.h
sed -i -e 's|//#define POWEROFF_CMD|#define POWEROFF_CMD|g' upstream/src/config/general.h
sed -i -e 's|//#define REBOOT_CMD|#define REBOOT_CMD|g' upstream/src/config/general.h
sed -i -e 's|//#define TIME_CMD|#define TIME_CMD|g' upstream/src/config/general.h
sed -i -e 's|//#define VLAN_CMD|#define VLAN_CMD|g' upstream/src/config/general.h
cp downstream/init.ipxe upstream/src/.
- name: Install packages
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y -o Acquire::Retries=50 \
mtools syslinux isolinux \
libc6-dev-i386 valgrind \
libgcc-s1:i386 libc6-dbg:i386 \
gcc-arm-none-eabi gcc-aarch64-linux-gnu gcc-11-aarch64-linux-gnu
- name: Build (Legacy)
run: |
make EMBED="init.ipxe" -j 4 -C upstream/src \
bin-i386-pcbios/ipxe.kpxe
- name: Build (x86)
run: |
make EMBED="init.ipxe" -j 4 -C upstream/src \
bin-i386-efi/ipxe.efi
- name: Build (x86_64)
run: |
make EMBED="init.ipxe" -j 4 -C upstream/src \
bin-x86_64-efi/ipxe.efi
- name: Build (arm32)
run: |
make EMBED="init.ipxe" -j 4 -C upstream/src CROSS=arm-none-eabi- \
bin-arm32-efi/snp.efi
- name: Build (arm64)
run: |
make EMBED="init.ipxe" -j 4 -C upstream/src CROSS=aarch64-linux-gnu- \
bin-arm64-efi/snp.efi
- name: Move iPXE Binaries
run: |
rm -rf tmp
mkdir -p tmp
cp upstream/src/bin-i386-pcbios/ipxe.kpxe tmp/ipxe-i386.kpxe
cp upstream/src/bin-i386-efi/ipxe.efi tmp/ipxe-i386.efi
cp upstream/src/bin-x86_64-efi/ipxe.efi tmp/ipxe-x86_64.efi
cp upstream/src/bin-arm32-efi/snp.efi tmp/ipxe-arm32.efi
cp upstream/src/bin-arm64-efi/snp.efi tmp/ipxe-arm64.efi
rm -rf staging
mkdir -p staging
tar -zcvf staging/ipxe.tar.gz -C tmp .
- name: Get Vars
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
echo "rfc3339=$(date --rfc-3339=seconds | sed 's/ /T/')Z" >> "$GITHUB_OUTPUT"
echo "week_of_year=$(date +'%Y%U')" >> "$GITHUB_OUTPUT"
echo "ipxe_version=$(cd upstream; git describe --tags $(git rev-list --tags --max-count=1))" >> "$GITHUB_OUTPUT"
- name: Publish to GitHub releases
if: ${{ github.ref == 'refs/heads/main' }}
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: "iPXE Build ${{steps.vars.outputs.ipxe_version}}"
automatic_release_tag: ${{steps.vars.outputs.week_of_year}}
prerelease: false
files: staging/*
- name: Download latest netboot.xyz
run: |
wget $(curl https://api.github.com/repos/netbootxyz/netboot.xyz/releases/latest | grep "browser_" | grep menus.tar.gz | cut -d '"' -f4) -O menus.tar.gz
sudo tar -xzvf menus.tar.gz -C ./tmp
sudo rm -rf ./tmp/boot.cfg
sudo cp downstream/boot.cfg tmp/boot.cfg
sudo sed -i "s#&{NETBOOT_VERSION}#$(curl -s https://api.github.com/repos/netbootxyz/netboot.xyz/releases/latest | jq -r .tag_name)#g" tmp/boot.cfg
- name: Build and Push Dockerfile
id: docker_build
uses: docker/[email protected]
with:
platforms: linux/arm64,linux/armhf,linux/386,linux/amd64
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{steps.vars.outputs.week_of_year}}
labels: |
org.opencontainers.artifact.created:${{steps.vars.outputs.rfc3339}}
org.opencontainers.artifact.description:iPXE tftp server
org.opencontainers.image.created:${{steps.vars.outputs.rfc3339}}
org.opencontainers.image.authors:${AUTHOR}
org.opencontainers.image.url:https://github.com/${{ github.repository }}
org.opencontainers.image.source:https://github.com/${{ github.repository }}
org.opencontainers.image.version:${{ github.sha }}
org.opencontainers.image.revision:${{ github.sha }}
org.opencontainers.image.title:iPXE tftp server
org.opencontainers.image.description:iPXE tftp server built on alpine:latest with iPXE ${{steps.vars.outputs.ipxe_version}}
org.opencontainers.image.base.name:docker.io/alpine:latest
pull: true
context: .