Test distributions build system #303
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test distributions build system | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 22 * * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
prepare-matrix: | |
name: Prepare matrix with distributions install parameters | |
runs-on: ubuntu-22.04 | |
outputs: | |
matrix: ${{ steps.distributions.outputs.matrix }} | |
steps: | |
- name: Checkout linuxloops source code | |
uses: actions/checkout@v4 | |
- name: Create build matrix | |
id: distributions | |
run: | | |
distributions=$(sudo bash linuxloops --list | grep '" distribution:' | sed 's@"\| distribution:@@g') | |
for i in $distributions; do | |
arg1='' | |
arg2='' | |
arg3='' | |
arg4='' | |
arg5='' | |
distribution="$i" | |
env=$(sudo bash linuxloops --list | grep -A4 "\"$i\"" | grep 'Available environments:' | sed 's@"\|Available environments: @@g' | sed 's@ @\n@g' | sed -e 's@\t@@g' | sort -R | head -1) | |
if sudo bash linuxloops --list | grep -A4 "\"$i\"" | grep -q 'Install on btrfs filesystem possible: Yes' && [ $(($RANDOM % 2)) -eq 1 ]; then arg1='-b'; fi | |
if sudo bash linuxloops --list | grep -A4 "\"$i\"" | grep -q 'Nvidia proprietary driver installation possible: Yes' && [ $(($RANDOM % 2)) -eq 1 ]; then arg2='-n'; fi | |
if sudo bash linuxloops --list | grep -A4 "\"$i\"" | grep -q 'Surface patches installation possible: Yes' && [ "${arg2}" == "" ] && [ $(($RANDOM % 2)) -eq 1 ]; then arg3='-S'; fi | |
if [ "${i}" != "BlissOS" ] && [ "${i}" != "Brunch" ] && [ "${i}" != "ChimeraOS" ] && [ "${i}" != "ChromeOS-Flex" ] && [ "${i}" != "Tails" ] && [ $(($RANDOM % 2)) -eq 1 ]; then arg4='-z 2'; fi | |
if [ "${i}" != "BlissOS" ] && [ "${i}" != "Brunch" ] && [ "${i}" != "ChimeraOS" ] && [ "${i}" != "ChromeOS-Flex" ] && [ "${i}" != "Tails" ] && [ $(($RANDOM % 2)) -eq 1 ]; then arg5='-e'; fi | |
if [ "${i}" != "BlissOS" ] && [ "${i}" != "Brunch" ] && [ "${i}" != "ChimeraOS" ] && [ "${i}" != "ChromeOS-Flex" ] && [ "${i}" != "Tails" ] && [ $(($RANDOM % 2)) -eq 1 ]; then arg6='-a'; fi | |
if [ -z "$matrix" ]; then matrix="\"$distribution#$env#$arg1#$arg2#$arg3#$arg4#$arg5#$arg6\""; else matrix="$matrix,\"$distribution#$env#$arg1#$arg2#$arg3#$arg4#$arg5#$arg6\""; fi | |
done | |
echo "matrix=[$matrix]" >> $GITHUB_OUTPUT | |
build-distributions: | |
name: Build distribution | |
needs: prepare-matrix | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
distribution: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }} | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: true | |
- name: Display disk space | |
run: | | |
echo "Free space:" | |
df -h | |
- name: Checkout linuxloops source code | |
uses: actions/checkout@v4 | |
- name: Launch distribution build | |
run: sudo bash linuxloops -dst test.img -t -s 40 -distro $(echo ${{ matrix.distribution }} | cut -d'#' -f1) -env $(echo ${{ matrix.distribution }} | cut -d'#' -f2) $(echo ${{ matrix.distribution }} | cut -d'#' -f3) $(echo ${{ matrix.distribution }} | cut -d'#' -f4) $(echo ${{ matrix.distribution }} | cut -d'#' -f5) $(echo ${{ matrix.distribution }} | cut -d'#' -f6) $(echo ${{ matrix.distribution }} | cut -d'#' -f7) $(echo ${{ matrix.distribution }} | cut -d'#' -f8) |