Next #14
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: Next | |
on: | |
workflow_dispatch: | |
run-name: Next | |
jobs: | |
config: | |
runs-on: ubuntu-latest | |
name: Create martrix | |
outputs: | |
build_matrix: ${{ steps.build.outputs.build_matrix }} | |
rootfs_matrix: ${{ steps.rootfs.outputs.rootfs_matrix }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Create build matrix | |
id: build | |
run: | | |
build_matrix="" | |
for file in config/boards/*; do | |
COMPATIBLE_SUITES=() | |
COMPATIBLE_FLAVORS=() | |
# shellcheck disable=SC1090 | |
source "${file}" | |
for suite in "${COMPATIBLE_SUITES[@]}"; do | |
for flavor in "${COMPATIBLE_FLAVORS[@]}"; do | |
build_matrix+="{\"board\":\"$(basename "${file%.sh}")\",\"suite\":\"${suite}\",\"flavor\":\"${flavor}\"}," | |
done | |
done | |
done | |
echo "build_matrix={\"include\":[${build_matrix::-1}]}" >> $GITHUB_OUTPUT | |
- name: Create rootfs matrix | |
id: rootfs | |
run: | | |
rootfs_matrix="" | |
for suite in config/suites/*; do | |
for flavor in config/flavors/*; do | |
rootfs_matrix+="{\"suite\":\"$(basename "${suite%.sh}")\",\"flavor\":\"$(basename "${flavor%.sh}")\"}," | |
done | |
done | |
echo "rootfs_matrix={\"include\":[${rootfs_matrix::-1}]}" >> $GITHUB_OUTPUT | |
rootfs: | |
runs-on: ubuntu-latest | |
name: Build rootfs | |
needs: [config] | |
strategy: | |
matrix: ${{ fromJson(needs.config.outputs.rootfs_matrix) }} | |
steps: | |
- name: Get more disk space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: false | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
swap-storage: true | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Checkout LFS | |
shell: bash | |
run: git lfs fetch && git lfs checkout | |
- name: Set environment variables | |
id: vars | |
run: | | |
source config/suites/${{ matrix.suite }}.sh | |
echo "suite_version=$RELASE_VERSION" >> $GITHUB_OUTPUT | |
- name: Install dependencies | |
shell: bash | |
run: | | |
sudo apt-get update && sudo apt-get upgrade -y | |
sudo apt-get install -y build-essential gcc-aarch64-linux-gnu bison \ | |
qemu-user-static qemu-system-arm qemu-efi u-boot-tools binfmt-support \ | |
debootstrap flex libssl-dev bc rsync kmod cpio xz-utils fakeroot parted \ | |
udev dosfstools uuid-runtime git-lfs device-tree-compiler python2 python3 \ | |
python-is-python3 fdisk bc debhelper python3-pyelftools python3-setuptools \ | |
python3-distutils python3-pkg-resources swig libfdt-dev libpython3-dev dctrl-tools | |
- name: Build | |
shell: bash | |
run: sudo ./build.sh --suite=${{ matrix.suite }} --flavor=${{ matrix.flavor }} --rootfs-only --launchpad | |
- name: Upload | |
uses: actions/[email protected] | |
with: | |
name: ubuntu-${{ steps.vars.outputs.suite_version }}-preinstalled-${{ matrix.flavor }}-arm64-rootfs | |
path: ./build/ubuntu-${{ steps.vars.outputs.suite_version }}-preinstalled-${{ matrix.flavor }}-arm64.rootfs.tar.xz | |
if-no-files-found: error | |
build: | |
runs-on: ubuntu-latest | |
needs: [rootfs, config] | |
name: Build image | |
strategy: | |
matrix: ${{ fromJson(needs.config.outputs.build_matrix) }} | |
steps: | |
- name: Get more disk space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: false | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
swap-storage: true | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Checkout LFS | |
shell: bash | |
run: git lfs fetch && git lfs checkout | |
- name: Set environment variables | |
id: vars | |
run: | | |
source config/suites/${{ matrix.suite }}.sh | |
echo "suite_version=$RELASE_VERSION" >> $GITHUB_OUTPUT | |
- name: Checkout rootfs | |
uses: actions/[email protected] | |
with: | |
name: ubuntu-${{ steps.vars.outputs.suite_version }}-preinstalled-${{ matrix.flavor }}-arm64-rootfs | |
path: ./build/ | |
- name: Install dependencies | |
shell: bash | |
run: | | |
sudo apt-get update && sudo apt-get upgrade -y | |
sudo apt-get install -y build-essential gcc-aarch64-linux-gnu bison \ | |
qemu-user-static qemu-system-arm qemu-efi u-boot-tools binfmt-support \ | |
debootstrap flex libssl-dev bc rsync kmod cpio xz-utils fakeroot parted \ | |
udev dosfstools uuid-runtime git-lfs device-tree-compiler python2 python3 \ | |
python-is-python3 fdisk bc debhelper python3-pyelftools python3-setuptools \ | |
python3-distutils python3-pkg-resources swig libfdt-dev libpython3-dev dctrl-tools | |
- name: Build | |
shell: bash | |
run: sudo ./build.sh --board=${{ matrix.board }} --suite=${{ matrix.suite }} --flavor=${{ matrix.flavor }} --launchpad | |
- name: Upload | |
uses: actions/[email protected] | |
with: | |
name: ubuntu-${{ steps.vars.outputs.suite_version }}-preinstalled-${{ matrix.flavor }}-arm64-${{ matrix.board }} | |
path: ./images/ubuntu-*-preinstalled-${{ matrix.flavor }}-arm64-${{ matrix.board }}.* | |
if-no-files-found: error | |
- name: Clean cache | |
shell: bash | |
run: sync && sudo rm -rf ./images/ ./build/ && sync |