A pack of CI fixes (#3315)

This commit is contained in:
Igor Pečovnik 2021-12-04 23:42:10 +01:00 committed by GitHub
parent 59aaac2469
commit 2aa23f485e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 91 additions and 191 deletions

View File

@ -14,7 +14,7 @@ on:
merge_from:
description: 'Branch we are merging from'
required: true
required: false
default: 'master'
jobs:
@ -49,13 +49,18 @@ jobs:
run: |
cd build
if [[ -z "${{ github.event.inputs.merge_from }}" ]] ; then
CHECKOUT_FROM=master
else
CHECKOUT_FROM="${{ github.event.inputs.merge_from }}"
fi
git config --global user.email "info@armbian.com"
git config --global user.name "Armbianworker"
git checkout "${{ github.event.inputs.merge_from }}"
git checkout "$CHECKOUT_FROM"
git fetch
git merge origin/"${{ github.event.inputs.merge_from }}"
git merge origin/"$CHECKOUT_FROM"
git checkout nightly
git merge "${{ github.event.inputs.merge_from }}" nightly
git merge "$CHECKOUT_FROM" nightly
git push
Prepare:
@ -150,7 +155,7 @@ jobs:
! 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 mkdir -p cache/hash${FILE_EXT} userpatches/
sudo rsync -ar --delete ../scripts/hash${FILE_EXT}/. cache/hash${FILE_EXT}/ 2> /dev/null
sudo cp ../scripts/configs/* userpatches/
sudo rm -f userpatches/targets.conf

View File

@ -1,4 +1,4 @@
name: Lint scripts & build kernels
name: Build at pull request
on:
workflow_dispatch:
@ -7,58 +7,15 @@ on:
jobs:
Shellcheck:
name: Shell script analysis
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'Armbian' }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Environment variables
run: sudo -E bash -c set
- name: "Shellcheck lint error report in diff format"
shell: bash {0}
run: |
(for file in $(find lib -type f -exec grep -Iq . {} \; -print); do shellcheck --format=diff $file; done;) 2> /dev/null > lib.diff || true
(for file in $(find packages -type f -exec grep -Iq . {} \; -print); do shellcheck --format=diff $file; done;) 2> /dev/null > packages.diff || true
(for file in $(find config -type f -exec grep -Iq . {} \; -print); do shellcheck --format=diff $file; done;) 2> /dev/null > config.diff || true
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: Shellcheck
path: "*.diff"
retention-days: 14
Prepare:
name: "Finding changed kernels"
name: "Find changed kernels"
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'Armbian' }}
outputs:
matrix: ${{steps.list_dirs.outputs.matrix}}
steps:
- name: Cache build parameters
uses: actions/cache@v2
env:
cache-name: build-kernel
with:
path: build-kernel
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }}
- name: Store environment variables values
run: |
echo "FILE_EXT=-beta" >> $GITHUB_ENV
echo "REPO_DEST=nightly" >> $GITHUB_ENV
echo "BETA=yes" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v2
with:
@ -112,10 +69,8 @@ jobs:
mkdir -p cache/toolchain/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf
touch cache/toolchain/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf/.download-complete
[[ ! -f .ignore_changes ]] && sudo touch .ignore_changes
BETA="${{ env.BETA }}"
FILE_EXT="${{ env.FILE_EXT }}"
mkdir -p cache/hash${FILE_EXT}
sudo rsync -ar --delete ../scripts/hash${FILE_EXT}/. cache/hash${FILE_EXT}/ 2> /dev/null
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
sed -i "s/-it --rm/-i --rm/" userpatches/config-docker.conf
@ -125,8 +80,7 @@ jobs:
id: list_dirs
run: |
BETA="${{ env.BETA }}"
MATRIX=$(cd build;./compile.sh docker all-new-beta-kernels BETA="$BETA" BUILD_ALL="demo" | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | egrep "^[0-9]" | awk '{ print $2 ":" $4 ":" $3 }' | tr -d '(),' | sort | uniq)
MATRIX=$(cd build;./compile.sh docker 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 ":" $3 }' | tr -d '(),' | sort | uniq)
mkdir -p build-kernel
echo "no" > build-kernel/skip
if [[ -z "$MATRIX" ]]; then
@ -157,29 +111,6 @@ jobs:
path: scripts
clean: true
- name: Cache Gradle packages
uses: actions/cache@v2
env:
cache-name: build-kernel
with:
path: build-kernel
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }}-linux
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }}-linux
${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }}
- name: Read value
run: |
echo "FILE_EXT=-beta" >> $GITHUB_ENV
echo "REPO_DEST=nightly" >> $GITHUB_ENV
echo "BETA=yes" >> $GITHUB_ENV
if [[ "$(cat build-kernel/build_type 2> /dev/null || true)" =~ stable|edge ]]; then
echo "FILE_EXT=" >> $GITHUB_ENV
echo "REPO_DEST=master" >> $GITHUB_ENV
echo "BETA=no" >> $GITHUB_ENV
fi
- name: Checkout Armbian build script
uses: actions/checkout@v2
@ -197,41 +128,34 @@ jobs:
sudo cp scripts/configs/* build/userpatches/
- name: Pull Docker image
if: ${{ matrix.node != 'none:none:none' }}
run: |
sudo docker pull ghcr.io/armbian/build:$(cat build/VERSION)
- name: Build
if: ${{ matrix.node != 'none:none' }}
if: ${{ matrix.node != 'none:none:none' }}
run: |
CHUNK="${{ matrix.node }}"
FILE_EXT="${{ env.FILE_EXT }}"
BOARD=$(echo $CHUNK | cut -d":" -f1)
BRANCH=$(echo $CHUNK | cut -d":" -f2)
FAMILY=$(echo $CHUNK | cut -d":" -f2)
echo "FILE_NAME=${FAMILY}-${BRANCH}" >> $GITHUB_ENV
cd build
[[ ! -f .ignore_changes ]] && sudo touch .ignore_changes
sed -i "s/-it --rm/-i --rm/" userpatches/config-docker.conf
sed -i "s/COMPRESS_OUTPUTIMAGE=.*/COMPRESS_OUTPUTIMAGE=\"no\"/" userpatches/lib.config
./compile.sh docker ARMBIAN_MIRROR="https://github.com/armbian/mirror/releases/download/" BOARD="$BOARD" \
BETA="yes" KERNEL_ONLY="yes" BRANCH="$BRANCH" KERNEL_CONFIGURE="no" OFFLINE="no"
- name: Upload build artifacts
if: ${{ matrix.node != 'none:none' }}
if: ${{ matrix.node != 'none:none:none' }}
uses: actions/upload-artifact@v2
with:
name: ${{ env.FILE_NAME }}
path: build/output/debs${{ env.FILE_EXT }}/linux-*
retention-days: 14
Fin:
name: Finish
needs: [Shellcheck,Prepare,Linux]
runs-on: [ubuntu-latest]
if: ${{ github.repository_owner == 'Armbian' }}
steps:
- run: |
echo "End"
name: "${FAMILY}-${BRANCH}"
path: build/output/debs-beta/linux-*
if-no-files-found: ignore
retention-days: 14

View File

@ -0,0 +1,37 @@
name: Lint BASH scripts
on:
workflow_dispatch:
pull_request:
types: [review_requested, ready_for_review]
jobs:
Shellcheck:
name: Shell script analysis
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'Armbian' }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Environment variables
run: sudo -E bash -c set
- name: "Shellcheck lint error report in diff format"
shell: bash {0}
run: |
(for file in $(find lib -type f -exec grep -Iq . {} \; -print); do shellcheck --format=diff $file; done;) 2> /dev/null > lib.diff || true
(for file in $(find packages -type f -exec grep -Iq . {} \; -print); do shellcheck --format=diff $file; done;) 2> /dev/null > packages.diff || true
(for file in $(find config -type f -exec grep -Iq . {} \; -print); do shellcheck --format=diff $file; done;) 2> /dev/null > config.diff || true
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: Shellcheck
path: "*.diff"
if-no-files-found: ignore
retention-days: 14

View File

@ -7,7 +7,7 @@ jobs:
Prepare:
name: Prepare runners
name: Prepare runners
runs-on: [self-hosted, Linux, small]
if: ${{ github.repository_owner == 'armbian' }}
outputs:
@ -67,9 +67,12 @@ jobs:
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
sudo echo '* libraries/restart-without-asking boolean true' | sudo debconf-set-selections
sudo DEBIAN_FRONTEND=noninteractive apt-get -y purge needrestart unattended-upgrades
sudo DEBIAN_FRONTEND=noninteractive apt-get -y update
sudo DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -y -y -qq --with-new-pkgs upgrade
sudo DEBIAN_FRONTEND=noninteractive apt-get -y autoremove
[[ -d build/.git ]] && sudo chown -R $USER:$USER build/.git || true
[[ -d build/output/images ]] && sudo rm -rf build/output/images/* || true
cd build
@ -77,97 +80,11 @@ jobs:
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
sudo shutdown -r 1
Finish:
name: Finish
needs: [Check]
needs: [Maint]
runs-on: [self-hosted, Linux, small]
if: ${{ github.repository_owner == 'Armbian' }}
steps:

View File

@ -9,7 +9,7 @@ on:
jobs:
repository:
name: Update package repository
name: Update stable package repository
runs-on: [self-hosted, Linux, local]
if: ${{ github.repository_owner == 'Armbian' && github.event.workflow_run.conclusion == 'success' }}
steps:
@ -18,9 +18,26 @@ jobs:
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.KEY_REPOSITORY }}
name: id_repository # optional
name: id_repository
known_hosts: ${{ secrets.KNOWN_HOSTS_REPOSITORY }}
if_key_exists: replace
- name: Update repository
- name: Update stable repository
run: ssh -T -i ~/.ssh/id_repository ${{ secrets.USER_REPOSITORY }}@${{ secrets.HOST_REPOSITORY }}
repository-beta:
name: Update beta package repository
runs-on: [self-hosted, Linux, local]
if: ${{ github.repository_owner == 'Armbian' && github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Install SSH key for repository
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.KEY_REPOSITORY_BETA }}
name: id_repository_beta
known_hosts: ${{ secrets.KNOWN_HOSTS_REPOSITORY }}
if_key_exists: replace
- name: Update beta repository
run: ssh -T -i ~/.ssh/id_repository_beta ${{ secrets.USER_REPOSITORY }}@${{ secrets.HOST_REPOSITORY }}