177 lines
6.5 KiB
YAML
177 lines
6.5 KiB
YAML
name: Maintain Runners
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
|
|
Prepare:
|
|
|
|
name: Prepare runners
|
|
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: Prepare matrix
|
|
id: list_dirs
|
|
run:
|
|
echo ::set-output name=matrix::$(for x in $(seq -w 01 50); do echo $x; done|jq -cnR '[inputs | select(length>0)]' | jq)
|
|
|
|
Maint:
|
|
|
|
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: Checkout Armbian build script
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
repository: armbian/build
|
|
path: build
|
|
ref: nightly
|
|
clean: false
|
|
|
|
- name: Make a test build and cleanup
|
|
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
|
|
if [[ $(curl -s http://ifconfig.me) == "93.103.15.56" ]]; then
|
|
sudo mountpoint -q build/cache/rootfs && sudo fusermount -u build/cache/rootfs || true
|
|
sudo mountpoint -q build/cache/toolchain && sudo fusermount -u build/cache/toolchain || true
|
|
fi
|
|
[[ "$(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
|
|
sudo apt-get -y -qq update
|
|
sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y -qq upgrade
|
|
sudo apt-get purge -y --auto-remove unattended-upgrades
|
|
[[ -d build/.git ]] && sudo chown -R $USER:$USER build/.git || true
|
|
[[ -d build/output/images ]] && sudo rm -rf build/output/images/* || true
|
|
cd build
|
|
[[ ! -f .ignore_changes ]] && sudo touch .ignore_changes
|
|
sudo rm -rf cache/sources
|
|
sudo rm -rf output/debs
|
|
sudo rm -rf output/debs-beta
|
|
|
|
Caches:
|
|
|
|
name: Sync & test cache integrity
|
|
needs: [Maint]
|
|
runs-on: [self-hosted, Linux, small]
|
|
if: ${{ github.repository_owner == 'Armbian' }}
|
|
outputs:
|
|
matrix: ${{steps.list_dirs.outputs.matrix}}
|
|
steps:
|
|
- name: Prepare matrix
|
|
id: list_dirs
|
|
run:
|
|
echo ::set-output name=matrix::$(for x in $(LC_ALL=C rsync --include '*.lz4' --exclude='*' rsync://rsync.armbian.com/dl/_rootfs/ | awk '{ print $5}' | tail -n +2); do echo $x; done|jq -cnR '[inputs | select(length>0)]' | jq)
|
|
|
|
Check:
|
|
name: Checks
|
|
needs: [ Caches ]
|
|
runs-on: [self-hosted, Linux, x64, cache]
|
|
if: ${{ github.repository_owner == 'armbian' }}
|
|
timeout-minutes: 480
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node: ${{fromJson(needs.Caches.outputs.matrix)}}
|
|
steps:
|
|
- run: echo Run ${{ matrix.run }}
|
|
- name: Show chunk
|
|
run: |
|
|
echo "CHUNK=${{ matrix.node }}" >> $GITHUB_ENV
|
|
echo "Node: $CHUNK"
|
|
|
|
- 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: 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: Sync or mount rootfs
|
|
env:
|
|
GPG_PASS: ${{ secrets.GPG_PASSPHRASE1 }}
|
|
run: |
|
|
|
|
# Test compressed file integrity
|
|
|
|
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
|
|
else
|
|
sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. build/cache/rootfs/ || true
|
|
fi
|
|
ls -l build/cache/rootfs/
|
|
sudo lz4 -t build/cache/rootfs/${CHUNK}
|
|
echo "${GPG_PASS}" | sudo -H -u ${USER} bash -c "gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes build/cache/rootfs/${CHUNK}" || exit 1
|
|
|
|
Finish:
|
|
name: Finish
|
|
needs: [Check]
|
|
runs-on: [self-hosted, Linux, small]
|
|
if: ${{ github.repository_owner == 'Armbian' }}
|
|
steps:
|
|
- name: Run script
|
|
run: |
|
|
echo "Finish"
|