mirror of
https://github.com/armbian/scripts.git
synced 2026-01-06 10:32:48 -08:00
249 lines
8.4 KiB
YAML
249 lines
8.4 KiB
YAML
name: Build u-boot with Docker
|
|
on:
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
inputs:
|
|
runner:
|
|
required: true
|
|
type: string
|
|
include:
|
|
required: false
|
|
type: string
|
|
exclude:
|
|
required: false
|
|
type: string
|
|
uploading:
|
|
type: string
|
|
destref:
|
|
type: string
|
|
packagesrepo:
|
|
required: false
|
|
type: string
|
|
secrets:
|
|
GPG_KEY1:
|
|
required: true
|
|
GPG_PASSPHRASE1:
|
|
required: true
|
|
GPG_KEY2:
|
|
required: true
|
|
GPG_PASSPHRASE2:
|
|
required: true
|
|
SCRIPTS_ACCESS_TOKEN:
|
|
required: true
|
|
SSH_KEY_TORRENTS:
|
|
required: true
|
|
KNOWN_HOSTS_UPLOAD:
|
|
required: true
|
|
|
|
jobs:
|
|
|
|
Prepare:
|
|
|
|
name: targets
|
|
runs-on: small
|
|
outputs:
|
|
matrix: ${{steps.list_dirs.outputs.matrix}}
|
|
steps:
|
|
|
|
- uses: igorpecovnik/freespace@main
|
|
|
|
- run: |
|
|
|
|
REFERENCE=${{ inputs.destref }}
|
|
echo "REFERENCE=${REFERENCE:-"nightly"}" >> $GITHUB_ENV
|
|
PACKAGESREPO=${{ inputs.packagesrepo }}
|
|
echo "BETA=${PACKAGESREPO:-yes}" >> $GITHUB_ENV
|
|
|
|
- name: Checkout Armbian build script
|
|
uses: actions/checkout@v3.1.0
|
|
with:
|
|
repository: armbian/build
|
|
path: build
|
|
ref: ${{ env.REFERENCE }}
|
|
fetch-depth: '100'
|
|
clean: false
|
|
|
|
- name: Remove previous artefacts if any
|
|
run: |
|
|
|
|
sudo rm -rf changes 2>/dev/null || true
|
|
|
|
- name: Download changes
|
|
uses: actions/download-artifact@v3.0.1
|
|
with:
|
|
name: changes
|
|
|
|
- name: Prepare matrix
|
|
id: list_dirs
|
|
run: |
|
|
|
|
MATRIX="cat build/config/target*.conf | grep -v \"^$\" | grep -v \"^#\" | ${{ inputs.include }} ${{ inputs.exclude }} sed 's/\s\s*/ /g' | cut -d' ' -f1,2 | sed 's/ /:/g' | sort | uniq"
|
|
[ -s changes ] || unset MATRIX
|
|
echo "matrix=$(for x in $(eval $MATRIX); do echo $x; done|jq -cnR '[inputs | select(length>0)]' | jq -c)" >> $GITHUB_OUTPUT
|
|
|
|
U-boot:
|
|
|
|
needs: [ Prepare ]
|
|
runs-on: ${{ inputs.runner }}
|
|
if: ${{ needs.Prepare.outputs.matrix != '[]' && needs.Prepare.outputs.matrix != '' }}
|
|
timeout-minutes: 480
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node: ${{fromJson(needs.Prepare.outputs.matrix)}}
|
|
|
|
steps:
|
|
|
|
- uses: igorpecovnik/freespace@main
|
|
|
|
- run: |
|
|
|
|
REFERENCE=${{ inputs.destref }}
|
|
echo "REFERENCE=${REFERENCE:-"nightly"}" >> $GITHUB_ENV
|
|
PACKAGESREPO=${{ inputs.packagesrepo }}
|
|
echo "BETA=${PACKAGESREPO:-yes}" >> $GITHUB_ENV
|
|
|
|
- name: "Read"
|
|
run: |
|
|
|
|
INPUT_REFERENCE=${{ inputs.destref }}
|
|
INPUT_REFERENCE=${INPUT_REFERENCE:-"nightly"}
|
|
|
|
- name: Checkout Armbian build script
|
|
uses: actions/checkout@v3.1.0
|
|
with:
|
|
repository: armbian/build
|
|
path: build
|
|
fetch-depth: '100'
|
|
ref: ${{ env.REFERENCE }}
|
|
clean: false
|
|
|
|
- name: Checkout support scripts
|
|
uses: actions/checkout@v3.1.0
|
|
with:
|
|
fetch-depth: '100'
|
|
repository: armbian/scripts
|
|
path: scripts
|
|
clean: false
|
|
|
|
- name: Install SSH key for storage
|
|
uses: shimataro/ssh-key-action@v2
|
|
with:
|
|
key: ${{ secrets.SSH_KEY_TORRENTS }}
|
|
known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
|
|
if_key_exists: replace
|
|
|
|
- name: Mount upload folders
|
|
run: |
|
|
|
|
# use this only on our runners
|
|
if [[ ${{ inputs.runner }} != "ubuntu-latest" ]]; then
|
|
# mount deploy target
|
|
sudo apt-get -y -qq install sshfs
|
|
sudo mkdir -p /root/.ssh/
|
|
sudo cp ~/.ssh/known_hosts /root/.ssh/
|
|
sudo mkdir -p build/output/debs || true
|
|
sudo mkdir -p build/output/debs-beta || true
|
|
sudo sshfs upload@users.armbian.com:/debs build/output/debs -o IdentityFile=~/.ssh/id_rsa -o reconnect -o allow_other || true
|
|
sudo sshfs upload@users.armbian.com:/debs build/output/debs -o IdentityFile=~/.ssh/id_rsa -o reconnect -o nonempty,allow_other || true
|
|
sudo sshfs upload@users.armbian.com:/debs-beta build/output/debs-beta -o IdentityFile=~/.ssh/id_rsa -o reconnect -o allow_other || true
|
|
sudo sshfs upload@users.armbian.com:/debs-beta build/output/debs-beta -o IdentityFile=~/.ssh/id_rsa -o reconnect -o nonempty,allow_other || true
|
|
|
|
fi
|
|
|
|
- name: Sync
|
|
run: |
|
|
|
|
mkdir -p build/userpatches
|
|
sudo cp scripts/configs/* build/userpatches/
|
|
|
|
- name: Pull Docker image
|
|
run: |
|
|
|
|
[[ -z $(command -v docker) ]] && sudo apt-get -yy install docker containerd docker.io
|
|
sudo docker kill $(sudo docker ps -q) 2>/dev/null || true
|
|
sudo docker image rm $(sudo docker images | grep -v latest"-$(dpkg --print-architecture)" | awk 'NR>1 {print $3}') 2> /dev/null || true
|
|
sudo docker pull ghcr.io/armbian/build:latest"-$(dpkg --print-architecture)"
|
|
|
|
- name: Build
|
|
run: |
|
|
|
|
export TERM=dumb
|
|
cd build
|
|
|
|
#if [[ "${{ env.REFERENCE }}" != "nightly" ]]; then
|
|
# OLD="ghcr.io/armbian/build:$(cat VERSION | cut -d"." -f1-2)"-$(dpkg --print-architecture)
|
|
# sudo git checkout -f ${{ env.REFERENCE }}
|
|
# #sudo cp ../scripts/VERSION .
|
|
# sudo docker tag $OLD ghcr.io/armbian/build:$(cat ../scripts/VERSION)-$(dpkg --print-architecture)
|
|
#fi
|
|
|
|
# use local resources if possible
|
|
if [[ $(curl -s http://ifconfig.me) == "93.103.15.56" ]]; then
|
|
sudo rm -rf cache/toolchain/*
|
|
sudo mkdir -p cache/toolchain build/cache/rootfs || true
|
|
! sudo mountpoint -q cache/toolchain && sudo mount nas:/tank/armbian/toolchain.armbian.com cache/toolchain -o rsize=32768,wsize=32768,timeo=5,retrans=2,actimeo=60,retry=15 || true
|
|
! sudo mountpoint -q cache/rootfs && sudo mount nas:/tank/armbian/dl.armbian.com/_rootfs cache/rootfs -o rsize=32768,wsize=32768,timeo=5,retrans=2,actimeo=60,retry=15 || true
|
|
fi
|
|
|
|
CHUNK="${{ matrix.node }}"
|
|
BOARD=$(echo $CHUNK | cut -d":" -f1)
|
|
BRANCH=$(echo $CHUNK | cut -d":" -f2)
|
|
|
|
echo "BOARD=$BOARD" >> $GITHUB_ENV
|
|
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
|
|
|
|
sudo sed -i "s/-it --rm/-i --rm/" userpatches/config-docker.conf
|
|
./compile.sh docker \
|
|
ARMBIAN_MIRROR="https://github.com/armbian/mirror/releases/download/" \
|
|
BOARD="$BOARD" \
|
|
PRIVATE_CCACHE="yes" \
|
|
BETA="${{ env.BETA }}" \
|
|
USE_TORRENT="yes" \
|
|
KERNEL_ONLY="no" \
|
|
KERNEL_KEEP_CONFIG="no" \
|
|
RELEASE="jammy" \
|
|
BSP_BUILD="yes" \
|
|
BUILD_ALL="yes" \
|
|
CLEAN_LEVEL="make,oldcache" \
|
|
BUILD_MINIMAL="no" \
|
|
BUILD_DESKTOP="no" \
|
|
USE_MAINLINE_GOOGLE_MIRROR="yes" \
|
|
BRANCH="$BRANCH" \
|
|
KERNEL_CONFIGURE="no" \
|
|
OFFLINE="no" \
|
|
REPOSITORY_INSTALL="armbian-firmware,kernel,armbian-firmware,armbian-config,armbian-zsh" \
|
|
EXPERT="yes"
|
|
|
|
# if we are building rc images, we want to have this in nightly repo
|
|
# to do - proper solution is needed when we will push directly to stable
|
|
#if [[ "${{ env.REFERENCE }}" != "nightly" ]]; then
|
|
#sudo mv output/debs/linux-u-boot-${BRANCH}-${BOARD}* output/debs-beta/ || true
|
|
#sudo mv output/debs/armbian-bsp-cli-${BOARD}* output/debs-beta/ || true
|
|
#fi
|
|
|
|
- name: Install SSH key for storage
|
|
uses: shimataro/ssh-key-action@v2
|
|
with:
|
|
key: ${{ secrets.SSH_KEY_TORRENTS }}
|
|
known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
|
|
if_key_exists: replace
|
|
|
|
- name: upload artefacts
|
|
if: ${{ inputs.uploading == true }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: u-boot-${{ env.BOARD }}-${{ env.BRANCH }}
|
|
path: |
|
|
build/output/debs-beta/*u-boot*
|
|
build/output/debs/*u-boot*
|
|
if-no-files-found: ignore
|
|
|
|
- name: Unmount folders
|
|
|
|
run: |
|
|
|
|
sudo mountpoint -q build/output/debs && sudo fusermount -u build/output/debs || true
|
|
sudo mountpoint -q build/output/debs-beta && sudo fusermount -u build/output/debs-beta || true
|
|
sudo mountpoint -q build/cache/toolchain && sudo fusermount -u build/cache/toolchain || true
|