You've already forked cache-root
mirror of
https://github.com/armbian/cache-root.git
synced 2026-01-06 10:38:58 -08:00
128 lines
5.2 KiB
YAML
128 lines
5.2 KiB
YAML
name: Reusable
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
inputs:
|
|
minimal:
|
|
required: true
|
|
type: string
|
|
desktop:
|
|
required: true
|
|
type: string
|
|
variant:
|
|
required: false
|
|
type: string
|
|
branch:
|
|
required: false
|
|
type: string
|
|
|
|
|
|
jobs:
|
|
|
|
prepare:
|
|
|
|
name: "Make JSON"
|
|
if: ${{ github.repository_owner == 'armbian' }}
|
|
runs-on: qemu
|
|
outputs:
|
|
matrix: ${{steps.json.outputs.JSON_CONTENT}}
|
|
steps:
|
|
|
|
- name: Checkout Armbian Framework
|
|
uses: actions/checkout@v3.3.0
|
|
with:
|
|
repository: armbian/build
|
|
ref: ${{ inputs.branch }}
|
|
fetch-depth: 1
|
|
clean: false # true is default. it *will* delete the hosts /dev if mounted inside.
|
|
|
|
- name: "Make JSON"
|
|
id: json
|
|
run: |
|
|
|
|
# Make a list of valid pairs from our config
|
|
echo 'JSON_CONTENT<<EOF' >> $GITHUB_OUTPUT
|
|
releases=($(grep -rw config/distributions/*/support -ve 'eos' | cut -d"/" -f3 | grep -Ev "focal|buster|kinetic"))
|
|
arch=("amd64" "armhf" "arm64" "riscv64")
|
|
desktops=("none")
|
|
for i in ${releases[@]}; do
|
|
|
|
# Cycle desktops
|
|
[[ "${{ inputs.desktop }}" == yes ]] && desktops=($(find -L config/desktop/sid/environments/ -name support -exec grep -l 'supported' {} \; | rev | cut -d '/' -f 2 | rev))
|
|
for j in ${arch[@]}; do
|
|
|
|
runner_tags=qemu
|
|
variant="${{ inputs.variant }}"
|
|
|
|
# exceptions and runners optimisations
|
|
#[[ ${{ inputs.desktop }} == no ]] && runner_tags=small
|
|
[[ ${{ inputs.minimal }} == yes ]] && runner_tags=ubuntu-latest
|
|
[[ $j == arm64 ]] && runner_tags=aarch64
|
|
#[[ $j == armhf ]] && runner_tags=aarch64
|
|
#[[ $j == amd64 ]] && runner_tags=ubuntu-latest
|
|
|
|
# we don't have chromium and many other packages yet
|
|
[[ $j == riscv64 ]] && variant=""
|
|
|
|
for k in ${desktops[@]}; do
|
|
if ! grep -q $j config/distributions/${i}/architectures; then continue; fi
|
|
if [[ ${k} != "none" ]]; then
|
|
if ! grep -q $j config/desktop/${i}/environments/${k}/architectures; then continue; fi
|
|
fi
|
|
echo "{\"release\":\"${i}\",\"desktop\":\"$k\",\"minimal\":\"${{ inputs.minimal }}\",\"variant\":\"${variant}\",\"arch\":\"$j\",\"runner_tags\":\"$runner_tags\"}"
|
|
done
|
|
done
|
|
done | jq -s >> $GITHUB_OUTPUT
|
|
echo 'EOF' >> $GITHUB_OUTPUT
|
|
Docker:
|
|
|
|
name: "B"
|
|
needs: [ prepare ]
|
|
timeout-minutes: 60
|
|
strategy:
|
|
fail-fast: false # let other jobs try to complete if one fails
|
|
matrix:
|
|
include: ${{ fromJSON(needs.prepare.outputs.matrix) }}
|
|
|
|
env:
|
|
RELEASE: "${{ matrix.release }}"
|
|
MINIMAL: "${{ matrix.minimal }}"
|
|
DESKTOP: "${{ matrix.desktop }}"
|
|
VARIANT: "${{ matrix.variant }}"
|
|
ARCH: "${{ matrix.arch }}"
|
|
RUNNER_TAG: "${{ matrix.runner_tag }}"
|
|
OCI_TARGET_BASE: "ghcr.io/${{ github.repository }}/" # This is picked up by the Docker launcher automatically
|
|
|
|
runs-on: [ "${{ matrix.runner_tags }}" ]
|
|
|
|
steps:
|
|
|
|
# Login to ghcr.io, for later uploading rootfs to ghcr.io
|
|
- name: Docker Login to GitHub Container Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }} # GitHub username or org
|
|
password: ${{ secrets.GITHUB_TOKEN }} # GitHub actions builtin token. repo has to have pkg access.
|
|
|
|
- name: Checkout build repo
|
|
uses: actions/checkout@v3 # We don't need to clone git, really. A wget would suffice for GH-hosted runners. But using clone is better for Igor-hosted runners.
|
|
with:
|
|
repository: armbian/build #${{ github.repository_owner }}/armbian-build
|
|
ref: ${{ inputs.branch }}
|
|
fetch-depth: 1
|
|
clean: false # true is default. it *will* delete the hosts /dev if mounted inside.
|
|
|
|
- name: Create rootfs ${{env.RELEASE}}:${{env.ARCH}} (variant ${{env.VARIANT}}) (desktop ${{env.DESKTOP}})
|
|
id: rootfs
|
|
run: |
|
|
|
|
# clean rootfs folder. This is needed when we use self-hosted runners. This needs to be solved better way, so this is just a workaround
|
|
[[ -d cache/rootfs ]] && rm -rf cache/rootfs/*
|
|
|
|
DESKTOP_ENVIRONMENT="${{env.DESKTOP}}"
|
|
BUILD_DESKTOP="yes"
|
|
[[ "${{env.DESKTOP}}" == none ]] && DESKTOP_ENVIRONMENT="" && BUILD_DESKTOP="no"
|
|
bash ./compile.sh rootfs BUILD_MINIMAL="${{ inputs.minimal }}" RELEASE="${{env.RELEASE}}" ARCH="${{env.ARCH}}" BUILD_DESKTOP="${BUILD_DESKTOP}" DESKTOP_APPGROUPS_SELECTED="${{env.VARIANT}}" DESKTOP_ENVIRONMENT="${DESKTOP_ENVIRONMENT}" DESKTOP_ENVIRONMENT_CONFIG_NAME=config_base BETA=yes SHARE_LOG=yes CUSTOM_UBUNTU_MIRROR_ARM64="ftp.tu-chemnitz.de/pub/linux/ubuntu-ports/" CUSTOM_UBUNTU_MIRROR="ftp.tu-chemnitz.de/pub/linux/ubuntu-ports/"
|