armbian-build/.github/workflows/build-kernel.yml
2021-09-30 21:02:24 +02:00

155 lines
5.9 KiB
YAML

name: Build beta kernel packages
on:
workflow_dispatch:
jobs:
Prepare:
runs-on: [self-hosted, Linux, small]
if: ${{ github.repository_owner == 'armbian' }}
outputs:
matrix: ${{steps.list_dirs.outputs.matrix}}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: armbian/build
path: build
ref: nightly
clean: false
- name: Checkout Armbian support scripts
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: armbian/scripts
token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }}
path: scripts
clean: true
- name: Make a list of changed kernels
run: |
cd build
[[ ! -f .ignore_changes ]] && sudo touch .ignore_changes
./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" \
REPOSITORY_INSTALL="u-boot,kernel" 'prepare_host'
mkdir -p cache/hash-beta
sudo rsync -ar --delete ../scripts/hash-beta/. cache/hash-beta/ 2> /dev/null
sudo cp ../scripts/configs/* userpatches/
sudo rm -f userpatches/targets.conf
- name: Prepare matrix
id: list_dirs
run:
echo ::set-output name=matrix::$(for x in $(./compile.sh all-new-beta-kernels BUILD_ALL="demo" | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | egrep "^[0-9]" | awk '{ print $2 ":" $4 }' | sort | uniq ); do echo $x; done|jq -cnR '[inputs | select(length>0)]' | jq)
U-boot: # short name because Github will expand with the matrix values
needs: [ Prepare ]
runs-on: [self-hosted, Linux, small]
if: ${{ github.repository_owner == 'armbian' }}
timeout-minutes: 480
strategy:
fail-fast: false
matrix:
node: ${{fromJson(needs.Prepare.outputs.matrix)}}
steps:
- name: Install SSH key for storage
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.KEY_TORRENTS }}
known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
if_key_exists: replace
- name: Fix permissions
run: |
# make sure no temporally dirs are mounted from previous runs
while :
do
sudo pkill compile.sh || true
sudo pkill arm-binfmt-P || true
sudo pkill aarch64-binfmt-P || true
sudo pkill pixz || true
sudo mountpoint -q build/output/images && sudo fusermount -u build/output/images || true
[[ "$(df | grep "/.tmp" | wc -l)" -eq 0 && $(sudo mountpoint -q build/output/images; echo $?) -eq 1 ]] && sudo rm -rf build/.tmp && break
echo "Mounted temp directories. Trying to unmount."
df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true
sleep 10
done
[[ -d build/.git ]] && sudo chown -R $USER:$USER build/.git || true
[[ -d build/output/images ]] && sudo rm -rf build/output/images/* || true
- name: Checkout Armbian build script
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: armbian/build
path: build
ref: nightly
clean: false
- name: Build
run: |
CHUNK="${{ matrix.node }}"
BOARD=$(echo $CHUNK | cut -d":" -f1)
BRANCH=$(echo $CHUNK | cut -d":" -f2)
cd build
[[ ! -f .ignore_changes ]] && sudo touch .ignore_changes
./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" REPOSITORY_INSTALL="u-boot,kernel" 'prepare_host_basic'
if [[ $(curl -s http://ifconfig.me) == "93.103.15.56" ]]; then
sudo mkdir -p cache/toolchain cache/rootfs
sudo mount nas:/tank/armbian/toolchain.armbian.com cache/toolchain
sudo mount nas:/tank/armbian/dl.armbian.com/_rootfs cache/rootfs
fi
./compile.sh ARMBIAN_MIRROR="https://github.com/armbian/mirror/releases/download/" KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" REPOSITORY_INSTALL="u-boot,kernel" 'prepare_host'
./compile.sh BOARD="$BOARD" KERNEL_ONLY="yes" BRANCH="$BRANCH" KERNEL_CONFIGURE="no" OFFLINE="no" 'fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"'
./compile.sh BOARD="$BOARD" CLEAN_LEVEL="alldebs" PRIVATE_CCACHE="yes" BETA="yes" KERNEL_ONLY="yes" BRANCH="$BRANCH" KERNEL_CONFIGURE="no" OFFLINE="no" compile_uboot
mkdir -p ../build-u-boot
cp output/debs-beta/linux-u-boot-${BRANCH}-${BOARD}_$(cat VERSION)_* ../build-u-boot/
- name: Cache build configurations
uses: actions/cache@v2
env:
cache-name: build-u-boot
with:
path: build-u-boot
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Deploy to server
if: ${{ success() }}
run: |
sudo apt-get -y -qq install lftp
sudo chown -R $USER:$USER build/output/debs-beta/
lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror --Remove-source-files -R --no-empty-dirs --parallel=8 --no-perms $(pwd)/build/output/debs-beta/ debs-beta/ ;bye" sftp://users.armbian.com
Deploy:
name: Update download infrastructure
needs: [U-boot]
runs-on: [self-hosted, Linux, local]
if: ${{ github.repository_owner == 'Armbian' }}
steps:
- name: Cache Gradle packages
uses: actions/cache@v2
env:
cache-name: build-u-boot
with:
path: build-u-boot
key: ${{ runner.os }}-build-${{ env.cache-name }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}
- name: upload artefacts
uses: actions/upload-artifact@v2
with:
name: u-boot
path: build-u-boot