Github actions update (#3187)

This commit is contained in:
Igor Pečovnik
2021-10-12 22:57:26 +02:00
committed by GitHub
parent a1d044de8e
commit 4d19f3d4aa
7 changed files with 244 additions and 24 deletions

View File

@@ -8,7 +8,7 @@ on:
# required: false
# default: '22'
workflow_run:
workflows: ["Build beta & edge"]
workflows: ["Build beta kernel packages"]
types:
- completed
jobs:
@@ -125,6 +125,7 @@ jobs:
df | grep ".tmp" | awk '{print $6}' | xargs sudo umount 2>/dev/null || true
sleep 10
done
[[ -d build/output/debug ]] && rm -rf build/output/debug/* || true
[[ -d build/.git ]] && sudo chown -R $USER:$USER build/.git || true
[[ -d build/output/images ]] && sudo rm -rf build/output/images/* || true

View File

@@ -131,12 +131,17 @@ jobs:
cd build
BETA="${{ env.BETA }}"
FILE_EXT="${{ env.FILE_EXT }}"
sudo rm -rf cache/sources
./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" BETA="$BETA" REPOSITORY_INSTALL="u-boot,kernel" 'prepare_host'
[[ ! -f .ignore_changes ]] && sudo touch .ignore_changes
if [[ $(curl -s http://ifconfig.me) == "93.103.15.56" ]]; then
sudo mkdir -p cache/toolchain 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
# umount
sudo umount cache/toolchain || true
# erase below
sudo mountpoint -q cache/toolchain && sudo rm -rf cache/toolchain/*
! sudo mountpoint -q cache/toolchain && sudo rm -rf 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 rm -rf 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
mkdir -p cache/hash${FILE_EXT}
sudo rsync -ar --delete ../scripts/hash${FILE_EXT}/. cache/hash${FILE_EXT}/ 2> /dev/null
@@ -337,16 +342,15 @@ jobs:
fi
- name: Checkout Armbian support scripts
if: ${{ env.SKIP == 'yes' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: armbian/scripts
token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }}
path: scripts
clean: true
- name: Import GPG key
if: ${{ env.SKIP != 'yes' }}
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ secrets.GPG_KEY2 }}
@@ -356,7 +360,6 @@ jobs:
git-commit-gpgsign: true
- name: Download artefacts
if: ${{ env.SKIP != 'yes' }}
uses: actions/download-artifact@v2
with:
name: hash
@@ -370,6 +373,8 @@ jobs:
cd scripts
sudo chown -R $USER:$USER .git
if git status --porcelain | grep .; then
git config --global user.email "info@armbian.com"
git config --global user.name "Armbianworker"
git config pull.rebase false
git pull
echo "update"
@@ -420,19 +425,46 @@ jobs:
ref: ${{ env.REPO_DEST }}
clean: false
- name: Checkout support scripts
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: armbian/scripts
token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }}
path: scripts
clean: true
- name: Make board support packages
run: |
if [[ "$(cat build-kernel/skip 2> /dev/null || true)" == "no" ]]; then
cd build
./compile.sh all-new-beta-bsp
# wait until it finishes
while :
do
[[ $(sudo ps -uax | grep compile.sh | wc -l) -le 1 ]] && exit
echo "Waiting for background processes to finish."
sleep 10
done
cd build
if [[ $(curl -s http://ifconfig.me) == "93.103.15.56" ]]; then
sudo mkdir -p cache/toolchain cache/rootfs || true
# umount
sudo umount cache/toolchain || true
# erase below
sudo mountpoint -q cache/toolchain && sudo rm -rf cache/toolchain/*
! sudo mountpoint -q cache/toolchain && sudo rm -rf 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 rm -rf 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
# use prepared configs
sudo cp ../scripts/configs/* userpatches/
[[ ! -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'
rm -rf output/debs*
./compile.sh all-new-beta-bsp
# wait until it finishes
while :
do
[[ $(sudo ps -uax | grep compile.sh | wc -l) -le 1 ]] && exit
echo "Waiting for background processes to finish."
sleep 10
done
fi
- name: Deploy to server

178
.github/workflows/build-cache.yml vendored Normal file
View File

@@ -0,0 +1,178 @@
name: Build rootfs cache
on:
workflow_dispatch:
jobs:
Cache:
name: Make cache
runs-on: [self-hosted, Linux, cache]
if: ${{ github.repository_owner == 'armbian' }}
outputs:
matrix: ${{steps.list_dirs.outputs.matrix}}
steps:
- 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 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
sudo chown -R $USER:$USER build/.git
- name: Checkout Armbian build script
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
ref: master
clean: true
- name: Cache build configurations
uses: actions/cache@v2
env:
cache-name: build-rootfs
with:
path: build-rootfs
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }}
- name: Build rootfs cache
run: |
echo "BLTPATH=\"$(pwd)/build/\"" | tee scripts/cacherebuild.conf scripts/betarepository.conf >/dev/null
mkdir -p build-rootfs
rm -f build-rootfs/*
cd build
sudo rm -rf output/images/*
sudo mkdir -p userpatches
sudo cp ../scripts/configs/* userpatches/
[[ ! -f .ignore_changes ]] && sudo touch .ignore_changes
./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host'
if [[ $(curl -s http://ifconfig.me) == "93.103.15.56" ]]; then
sudo mkdir -p cache/toolchain 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
sudo rm -f userpatches/targets.conf
cd ../scripts
./cacherebuild.sh
cd ..
cd build-rootfs
PARTS=$(cat filelist.txt | wc -l)
split -d --numeric=1 --number=r/${PARTS} --additional-suffix=.conf --suffix-length=2 filelist.txt split-
- name: Prepare matrix
id: list_dirs
run:
PARTS=$(cat filelist.txt | wc -l)
MATRIX=$(seq -w 01 "$PARTS")
echo ::set-output name=matrix::$(for x in $(echo "${MATRIX}"); do echo $x; done|jq -cnR '[inputs | select(length>0)]' | jq)
Job:
needs: [ Cache ]
runs-on: [self-hosted, Linux, cache]
if: ${{ github.repository_owner == 'armbian' }}
timeout-minutes: 480
strategy:
fail-fast: false
matrix:
node: ${{fromJson(needs.Cache.outputs.matrix)}}
steps:
- name: Cache Gradle packages
uses: actions/cache@v2
env:
cache-name: build-rootfs
with:
path: build-rootfs
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }}
- 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: Checkout Armbian support scripts
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: armbian/scripts
token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }}
path: scripts
clean: false
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ secrets.GPG_KEY1 }}
passphrase: ${{ secrets.GPG_PASSPHRASE1 }}
workdir: scripts
git-user-signingkey: true
- name: Build beta images
env:
GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }}
run: |
CHUNK="${{ matrix.node }}"
if [[ $(curl -s http://ifconfig.me) == "93.103.15.56" ]]; then
sudo mkdir -p build/cache/toolchain build/cache/rootfs || true
! sudo mountpoint -q build/cache/toolchain && sudo mount nas:/tank/armbian/toolchain.armbian.com build/cache/toolchain -o rsize=32768,wsize=32768,timeo=5,retrans=2,actimeo=60,retry=15 || true
! sudo mountpoint -q build/cache/rootfs && sudo mount nas:/tank/armbian/dl.armbian.com/_rootfs build/cache/rootfs -o rsize=32768,wsize=32768,timeo=5,retrans=2,actimeo=60,retry=15 || true
fi
cd build
# use prepared configs
sudo mkdir -p userpatches
sudo cp ../scripts/configs/* userpatches/
# prepare host
[[ ! -f .ignore_changes ]] && sudo touch .ignore_changes || true
bash ../build-rootfs/split-${CHUNK}.conf

View File

@@ -1,4 +1,4 @@
name: Build selected
name: Build selected image
on:
@@ -41,8 +41,6 @@ jobs:
sleep 10
done
sudo chown -R $USER:$USER .
- name: Checkout Armbian build script
uses: actions/checkout@v2
@@ -92,6 +90,16 @@ jobs:
./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host'
PARALLEL_BUILDS=$(awk '{printf("%d",$1/8000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024)))
if [[ $(curl -s http://ifconfig.me) == "93.103.15.56" ]]; then
sudo mkdir -p cache/toolchain cache/rootfs || true
# umount
sudo umount cache/toolchain || true
# erase below
sudo mountpoint -q cache/toolchain && sudo rm -rf cache/toolchain/*
! sudo mountpoint -q cache/toolchain && sudo rm -rf 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 rm -rf 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
# sync rootfs
mkdir -p cache/rootfs/
sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/
@@ -150,7 +158,7 @@ jobs:
echo $VERSION"."$(($PATCH + 1)) | tee VERSION
git config --global user.email "info@armbian.com"
git config --global user.name "Armbianworker"
git pull
git pull --allow-unrelated-histories
git add VERSION
git commit -m "Bump stable version" -m "" -m "Adding following kernels:" -m "$(find output/debs/ -type f -name "linux-image*.deb" -printf "%f\n" | sort)"
git push

View File

@@ -106,9 +106,9 @@ jobs:
sudo rm -rf cache/source/u-boot cache/source/linux-* output/debs/* output/debs-beta/*
./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 build/cache/toolchain build/cache/rootfs || true
! sudo mountpoint -q build/cache/toolchain && sudo mount nas:/tank/armbian/toolchain.armbian.com build/cache/toolchain -o rsize=32768,wsize=32768,timeo=5,retrans=2,actimeo=60,retry=15 || true
! sudo mountpoint -q build/cache/rootfs && sudo mount nas:/tank/armbian/dl.armbian.com/_rootfs build/cache/rootfs -o rsize=32768,wsize=32768,timeo=5,retrans=2,actimeo=60,retry=15 || true
sudo mkdir -p cache/toolchain 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
./compile.sh ARMBIAN_MIRROR="https://github.com/armbian/mirror/releases/download/" BOARD="$BOARD" PRIVATE_CCACHE="yes" BETA="yes" KERNEL_ONLY="yes" BRANCH="$BRANCH" KERNEL_CONFIGURE="no" OFFLINE="no" REPOSITORY_INSTALL="kernel,bsp,armbian-zsh,armbian-config,armbian-firmware"
mkdir -p ../build-u-boot

View File

@@ -74,8 +74,9 @@ jobs:
cd build
[[ ! -f .ignore_changes ]] && sudo touch .ignore_changes
sudo rm -rf cache/sources
sudo rm -rf cache/toolchain
if [[ $(curl -s http://ifconfig.me) == "93.103.15.56" ]]; then
sudo rm -rf cache/toolchain
sudo mkdir -p cache/toolchain 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

View File

@@ -4,7 +4,7 @@ build tools</h3>
<p align=right>&nbsp;</p>
[![GitHub last commit (branch)](https://img.shields.io/github/last-commit/armbian/build/master)](https://github.com/armbian/build/commits)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/armbian/build/Build)](https://github.com/armbian/build/actions?query=workflow%3ABuild)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/armbian/build/Build)](https://github.com/armbian/build/actions/workflows/build-kernel-on-merge-request.yml)
[![Twitter Follow](https://img.shields.io/twitter/follow/armbian?style=flat-square)](https://twitter.com/intent/follow?screen_name=armbian)
## Table of contents