Skip to content

Commit

Permalink
do diskimage only for now
Browse files Browse the repository at this point in the history
  • Loading branch information
korewaChino committed Dec 29, 2024
1 parent c4dd5d9 commit c1bb632
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 86 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ jobs:
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- aarch64
# arch:
# - x86_64
# - aarch64
variants:
- name: gnome
includes: "live-iso,base-disk"

uses: ./.github/workflows/katsu.yml
with:
arch: ${{ matrix.arch }}
# arch: ${{ matrix.arch }}
variant: ${{ matrix.variants.name }}
include: ${{ matrix.variants.includes }}
158 changes: 77 additions & 81 deletions .github/workflows/katsu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ env:
on:
workflow_call:
inputs:
arch:
required: true
type: string
description: "Architecture to build for"
variant:
required: true
type: string
Expand All @@ -88,27 +84,28 @@ on:
description: "include a specific type from the build, comma separated"

jobs:
parse_includes:
runs-on: ubuntu-latest
outputs:
include: ${{ steps.set_includes.outputs.includes }}
steps:
- name: Set includes
id: set_includes
run: |
if [ -n "${{ inputs.include }}" ]; then
include=$(echo ${{ inputs.include }} | sed 's/,/ /g')
echo "includes=$(jq -nc --arg includes "$include" '$includes | split(" ")')" >> $GITHUB_ENV
else
echo "includes=[]" >> $GITHUB_ENV
fi
# parse_includes:
# runs-on: ubuntu-latest
# outputs:
# include: ${{ steps.set_includes.outputs.includes }}
# steps:
# - name: Set includes
# id: set_includes
# run: |
# if [ -n "${{ inputs.include }}" ]; then
# include=$(echo ${{ inputs.include }} | sed 's/,/ /g')
# echo "includes=$(jq -nc --arg includes "$include" '$includes | split(" ")')" >> $GITHUB_ENV
# else
# echo "includes=[]" >> $GITHUB_ENV
# fi

diskimg:
needs: parse_includes
# needs: parse_includes
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-latest' || 'arm64' }}
if: ${{ contains(fromJson(needs.parse_includes.outputs.include), 'diskimg') }}

container:
image: ghcr.io/terrapkg/builder:f41
options: --privileged -v /dev:/dev
Expand All @@ -124,7 +121,7 @@ jobs:
- name: Sanitize artifact name
run: |
name=$(echo ${{ inputs.variant }} | sed 's/\//-/g')
name=$name-${{ inputs.arch }}
name=$name-${{ matrix.arch }}
# set github variable
echo artifact=$name >> $GITHUB_ENV
Expand All @@ -137,7 +134,7 @@ jobs:
rm -rf /etc/rpm/macros.image-language-conf
chcon system_u:object_r:install_exec_t:s0 "$(which katsu)"
pushd katsu
KATSU_LOG=trace katsu -v --output=disk-image "modules/${{ inputs.variant }}/base-disk-${{ inputs.arch }}.yaml"
KATSU_LOG=trace katsu -v --output=disk-image "modules/${{ inputs.variant }}/base-disk-${{ matrix.arch }}.yaml"
mv katsu-work/image/katsu.img katsu-work/image/${{ env.artifact }}.img
# compress image as zst, output as .img.zst
zstd -T0 -19 katsu-work/image/${{ env.artifact }}.img -o katsu-work/image/${{ env.artifact }}.img.zst
Expand All @@ -149,61 +146,60 @@ jobs:
name: ${{ env.artifact }}-image
path: katsu/katsu-work/image/*.img.zst
compression-level: 0

live-iso:
needs: parse_includes
strategy:
fail-fast: false
runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-latest' || 'arm64' }}
if: ${{ contains(fromJson(needs.parse_includes.outputs.include), 'live-iso') }}
container:
image: ghcr.io/terrapkg/builder:f41
options: --privileged -v /dev:/dev
steps:
- name: Install dependencies
run: |
dnf up -y
dnf install -y $DNF_PKGS
dnf clean all
- name: Checkout
uses: actions/checkout@v4

- name: Sanitize artifact name
run: |
name=$(echo ${{ inputs.variant }} | sed 's/\//-/g')
name=$name-${{ inputs.arch }}
# set github variable
echo artifact=$name-${{ inputs.arch }}-live >> $GITHUB_ENV
# Get architecture
# e.g. flagship/flagship-live -> flagship
echo variant=$(echo ${{ inputs.variant }} | cut -d'/' -f1) >> $GITHUB_ENV
- name: Build Live ISO
run: |
# loop device fix
if [ "$(df -T /dev | tail -1 |cut -f 1 -d ' ')" = "tmpfs" ]; then
mount -t devtmpfs none /dev
fi
rm -rf /etc/rpm/macros.image-language-conf
chcon system_u:object_r:install_exec_t:s0 "$(which katsu)"
pushd katsu
KATSU_KEEP_CHROOT=1 KATSU_LOG=trace katsu -v --output=iso "modules/${{ matrix.variant }}-live.yaml"
# get the ISO name, and then append the arch
# e.g. flagship-live.iso -> flagship-live-x86_64.iso
# get the ISO name
iso=$(ls *.iso)
# append the arch
mv $iso $(echo $iso | sed "s/.iso/-${{ matrix.arch }}.iso/")
rm -rf katsu-work/
popd
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact }}-iso
path: katsu/*.iso
compression-level: 0
# live-iso:
# needs: parse_includes
# strategy:
# fail-fast: false
# runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-latest' || 'arm64' }}
# if: ${{ contains(fromJson(needs.parse_includes.outputs.include), 'live-iso') }}
# container:
# image: ghcr.io/terrapkg/builder:f41
# options: --privileged -v /dev:/dev
# steps:
# - name: Install dependencies
# run: |
# dnf up -y
# dnf install -y $DNF_PKGS
# dnf clean all
# - name: Checkout
# uses: actions/checkout@v4

# - name: Sanitize artifact name
# run: |
# name=$(echo ${{ inputs.variant }} | sed 's/\//-/g')
# name=$name-${{ inputs.arch }}

# # set github variable
# echo artifact=$name-${{ inputs.arch }}-live >> $GITHUB_ENV
# # Get architecture
# # e.g. flagship/flagship-live -> flagship
# echo variant=$(echo ${{ inputs.variant }} | cut -d'/' -f1) >> $GITHUB_ENV

# - name: Build Live ISO
# run: |
# # loop device fix
# if [ "$(df -T /dev | tail -1 |cut -f 1 -d ' ')" = "tmpfs" ]; then
# mount -t devtmpfs none /dev
# fi

# rm -rf /etc/rpm/macros.image-language-conf
# chcon system_u:object_r:install_exec_t:s0 "$(which katsu)"
# pushd katsu
# KATSU_KEEP_CHROOT=1 KATSU_LOG=trace katsu -v --output=iso "modules/${{ matrix.variant }}-live.yaml"
# # get the ISO name, and then append the arch
# # e.g. flagship-live.iso -> flagship-live-x86_64.iso

# # get the ISO name
# iso=$(ls *.iso)
# # append the arch
# mv $iso $(echo $iso | sed "s/.iso/-${{ matrix.arch }}.iso/")

# rm -rf katsu-work/
# popd

# - name: Upload Artifact
# uses: actions/upload-artifact@v4
# with:
# name: ${{ env.artifact }}-iso
# path: katsu/*.iso
# compression-level: 0

0 comments on commit c1bb632

Please sign in to comment.