From 21f13b4ba52f1078ec66d013906fb6caa5a7749f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Wed, 6 Oct 2021 22:47:23 +0200 Subject: [PATCH] CI pipeline refactoring (#3173) --- .github/workflows/README.md | 6 +- .github/workflows/build-beta-images.yml | 12 +- .github/workflows/build-beta-kernel.yml | 451 ++++++++++++++ .../build-kernel-on-merge-request.yml | 217 +++++++ .github/workflows/build-kernel.yml | 154 ----- .github/workflows/build-u-boot.yml | 106 ++-- .github/workflows/build.yml | 585 ------------------ .github/workflows/maintain.yml | 335 +++++++++- .github/workflows/testpr.yml | 67 -- .github/workflows/update-repository.yml | 2 - 10 files changed, 1067 insertions(+), 868 deletions(-) create mode 100644 .github/workflows/build-beta-kernel.yml create mode 100644 .github/workflows/build-kernel-on-merge-request.yml delete mode 100644 .github/workflows/build-kernel.yml delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/testpr.yml diff --git a/.github/workflows/README.md b/.github/workflows/README.md index b50b79afb1..e1646dfc1f 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -6,10 +6,12 @@ Common tags: - Linux - X64 - ARM64 +- public (isolated runners for merge reqeusts) - local (local network) - cache (mounted cache) -- big (16+ cores and 64Gb+ memory) -- small (< 16 cores and 64Gb+ memory) +- images (present cache, good enough for making images) +- big (16-128 cores, 64Gb SSD, 20Gb+ memory) +- small (< 16 cores, 32Gb SSD, 4Gb memory) # Preparing GPG diff --git a/.github/workflows/build-beta-images.yml b/.github/workflows/build-beta-images.yml index 0cb1aab1cd..6c432c3332 100644 --- a/.github/workflows/build-beta-images.yml +++ b/.github/workflows/build-beta-images.yml @@ -180,9 +180,15 @@ jobs: # prepare host [[ ! -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' - # mount or sync rootfs - sudo mount cache/rootfs || true - sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ + + if [[ $(curl -s http://ifconfig.me) == "93.103.15.56" ]]; then + 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 + else + sudo rsync --size-only --delete -avr rsync://rsync.armbian.com/dl/_rootfs/. cache/rootfs/ || true + fi + # calculate how many images we can build in parallel PARALLEL_BUILDS=$(awk '{printf("%d",$1/5000)}' <<<$(($(LC_ALL=C free -w 2>/dev/null | grep "^Mem" | awk '{print $2}' || LC_ALL=C free | grep "^Mem"| awk '{print $2}')/1024))) # mount deploy target diff --git a/.github/workflows/build-beta-kernel.yml b/.github/workflows/build-beta-kernel.yml new file mode 100644 index 0000000000..2cf1e2e4b4 --- /dev/null +++ b/.github/workflows/build-beta-kernel.yml @@ -0,0 +1,451 @@ +name: Build beta kernel packages + +on: + schedule: + - cron: '0 4 * * *' + + workflow_dispatch: + inputs: + + release_type: + description: 'Release type: nightly | stable | edge' + required: false + default: 'nightly' + +jobs: + + Merge: + + name: "Merge master into nightly" + runs-on: [self-hosted, Linux] + if: ${{ github.repository_owner == 'Armbian' }} + + steps: + + - 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_KEY2 }} + passphrase: ${{ secrets.GPG_PASSPHRASE2 }} + workdir: build + git-user-signingkey: true + git-commit-gpgsign: true + + - name: Merge master into nightly + + run: | + cd build + git config --global user.email "info@armbian.com" + git config --global user.name "Armbianworker" + git checkout master + git fetch + git merge origin/master + git checkout nightly + git merge master nightly + git push + + Prepare: + + name: "Finding changed kernels" + needs: [ Merge ] + runs-on: [self-hosted, Linux, small] + 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 matrix values + run: | + mkdir -p build-kernel + echo "${{ github.event.inputs.release_type }}" > build-kernel/build_type + + - name: Store environment variables values + 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 repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + repository: armbian/build + path: build + 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: Fix permissions + if: ${{ success() }} + 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: Determine changed kernels + run: | + + cd build + BETA="${{ env.BETA }}" + FILE_EXT="${{ env.FILE_EXT }}" + ./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 + fi + mkdir -p cache/hash${FILE_EXT} + 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 + if [[ "$(cat ../build-kernel/build_type 2> /dev/null || true)" =~ stable|edge ]]; then + cat config/targets.conf | grep edge | grep cli | grep hirsute | sudo tee userpatches/targets.conf 1>/dev/null + echo "FILE_EXT=" >> $GITHUB_ENV + echo "REPO_DEST=master" >> $GITHUB_ENV + echo "BETA=no" >> $GITHUB_ENV + fi + + - name: Prepare build matrix + id: list_dirs + run: | + + BETA="${{ env.BETA }}" + MATRIX=$(cd build;./compile.sh 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 }' | sort | uniq) + mkdir -p build-kernel + echo "no" > build-kernel/skip + if [[ -z "$MATRIX" ]]; then + MATRIX="none:none" + echo "yes" > build-kernel/skip + fi + echo ::set-output name=matrix::$(for x in $(echo "${MATRIX}"); do echo $x; done|jq -cnR '[inputs | select(length>0)]' | jq) + + Linux: + + name: "Build Linux" + needs: [ Prepare ] + runs-on: [self-hosted, Linux, fast] # lets run this on runners labelled with 'fast' + 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: 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: 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: Fix permissions + if: ${{ success() }} + 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: ${{ env.REPO_DEST }} + clean: false + + - name: Build + run: | + + if [[ "$(cat build-kernel/skip 2> /dev/null || true)" == "no" ]]; then + + CHUNK="${{ matrix.node }}" + BETA="${{ env.BETA }}" + FILE_EXT="${{ env.FILE_EXT }}" + BOARD=$(echo $CHUNK | cut -d":" -f1) + BRANCH=$(echo $CHUNK | cut -d":" -f2) + echo "FILE_NAME=${BOARD}-${BRANCH}" >> $GITHUB_ENV + cd build + sudo rsync -ar --delete ../scripts/hash${FILE_EXT}/. cache/hash${FILE_EXT}/ 2> /dev/null + [[ ! -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 || 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 + rm -rf output/debs* + ./compile.sh ARMBIAN_MIRROR="https://github.com/armbian/mirror/releases/download/" BOARD="$BOARD" CLEAN_LEVEL="alldebs" \ + PRIVATE_CCACHE="yes" BETA="$BETA" KERNEL_ONLY="yes" BRANCH="$BRANCH" KERNEL_CONFIGURE="no" OFFLINE="no" + [[ $? -eq 0 ]] && echo "UPLOAD=true" >> $GITHUB_ENV + sudo mkdir -p ../build-kernel + echo "${FILE_EXT}" + RAZLIKA=$(diff -q "cache/hash${FILE_EXT}/" "../scripts/hash${FILE_EXT}/" | cut -d" " -f2) + [[ -n $RAZLIKA ]] && cp $RAZLIKA ../build-kernel/ + cp $(diff -q "cache/hash${FILE_EXT}/" "../scripts/hash${FILE_EXT}/" | cut -d" " -f2) ../build-kernel/ + + fi + + - name: Upload build artifacts + if: ${{ matrix.node != 'none:none' }} + uses: actions/upload-artifact@v2 + with: + name: ${{ env.FILE_NAME }} + path: build/output/debs${{ env.FILE_EXT }}/linux-* + retention-days: 14 + + - name: Deploy to server + if: ${{ matrix.node != 'none:none' && github.event.label.name != '7.needs testing' }} + run: | + + echo ${{ env.UPLOAD }} + # edge kernels if any, simply copy to stable + rsync -arv build/output/debs-beta/*edge* --exclude='*u-boot*' build/output/debs/ 2> /dev/null || true + sudo apt-get -y -qq install lftp + sudo chown -R $USER:$USER build/output/debs${{ env.FILE_EXT }}/ + 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/ debs/ ;bye" sftp://users.armbian.com + 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 kernel status + needs: [Linux] + runs-on: [self-hosted, Linux] + if: ${{ github.repository_owner == 'Armbian' }} + steps: + + - 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 + + - 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 support scripts + uses: actions/checkout@v2 + with: + fetch-depth: 0 + repository: armbian/scripts + token: ${{ secrets.SCRIPTS_ACCESS_TOKEN }} + path: scripts + clean: true + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v3 + with: + gpg-private-key: ${{ secrets.GPG_KEY2 }} + passphrase: ${{ secrets.GPG_PASSPHRASE2 }} + workdir: scripts + git-user-signingkey: true + git-commit-gpgsign: true + + - name: Update scripts + run: | + if [[ "$(cat build-kernel/skip 2> /dev/null || true)" == "no" ]]; then + sudo rsync -ar build-kernel/*.githash scripts/hash${{ env.FILE_EXT }}/ || true + cd scripts + ls -l + sudo chown -R $USER:$USER .git + if git status --porcelain | grep .; then + git config pull.rebase false + git pull + echo "update" + git add . + git commit -m "Update hashes for ${{ env.FILE_DEST }} repository" + git push + fi + fi + + Closing: + + name: Build board support packages + needs: [Deploy] + runs-on: [self-hosted, Linux,fast] + if: ${{ github.repository_owner == 'Armbian' }} + steps: + + - 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 + + - name: Checkout Armbian build script + + uses: actions/checkout@v2 + with: + fetch-depth: 0 + repository: armbian/build + path: build + ref: ${{ env.REPO_DEST }} + clean: false + + - 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 + fi + + - name: Deploy to server + run: | + + if [[ "$(cat build-kernel/skip 2> /dev/null || true)" == "no" ]]; then + sudo apt-get -y -qq install lftp + sudo chown -R $USER:$USER build/output/debs* + 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/ debs/ ;bye" sftp://users.armbian.com + 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 + fi + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v3 + with: + gpg-private-key: ${{ secrets.GPG_KEY2 }} + passphrase: ${{ secrets.GPG_PASSPHRASE2 }} + workdir: build + git-user-signingkey: true + git-commit-gpgsign: true + + - name: Bump version + run: | + if [[ "$(cat build-kernel/skip 2> /dev/null || true)" == "no" ]]; then + cd build + if [[ "$(git symbolic-ref --short -q HEAD)" == nightly ]]; then + CURRENT_VERSION=$(cat VERSION) + NEW_VERSION="${CURRENT_VERSION%%-trunk}" + if [[ $CURRENT_VERSION == *trunk* ]]; then + NEW_VERSION=$(echo "${CURRENT_VERSION}" | cut -d. -f1-3)"."$((${NEW_VERSION##*.} + 1)) + else + NEW_VERSION=$(echo "${CURRENT_VERSION}" | cut -d. -f1-2)"."$((${NEW_VERSION##*.} + 1)) + fi + sudo git checkout -f + sudo chown -R $USER:$USER .git + git pull + echo "${NEW_VERSION}" > VERSION + git config --global user.email "info@armbian.com" + git config --global user.name "Armbianworker" + git add VERSION + git commit -m "Bumping to new version" -m "" -m "Adding following kernels:" -m "$(find output/debs-beta/ -type f -name "linux-image*${CURRENT_VERSION}*.deb" -printf "%f\n" | sort)" + git push + fi + fi diff --git a/.github/workflows/build-kernel-on-merge-request.yml b/.github/workflows/build-kernel-on-merge-request.yml new file mode 100644 index 0000000000..a4ddd4cee2 --- /dev/null +++ b/.github/workflows/build-kernel-on-merge-request.yml @@ -0,0 +1,217 @@ +name: Lint scripts and build kernel + +on: + workflow_dispatch: + pull_request: + +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: Install required packages + run: sudo apt-get install shellcheck jq + + - 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 + + Docker: + + name: Build x86 Docker image + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'Armbian' }} + steps: + - name: Checkout Armbian build script + uses: actions/checkout@v2 + with: + fetch-depth: 0 + repository: armbian/build + path: build + ref: nightly + clean: false + - name: Build Docker image + run: | + cd build + sed -i "s/-it --rm/-i --rm/" config/templates/config-docker.conf + touch .ignore_changes + ./compile.sh dockerpurge KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" \ + USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' + sed -i "s/-it --rm/-i --rm/" userpatches/config-docker.conf + + Prepare: + + name: "Finding changed kernels" + #runs-on: ubuntu-latest + runs-on: [self-hosted, Linux, public] + 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: + fetch-depth: 0 + repository: armbian/build + path: build + ref: ${{ github.event.pull_request.head.sha }} + 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: Determine changed kernels + run: | + + cd build + [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes + BETA="${{ env.BETA }}" + FILE_EXT="${{ env.FILE_EXT }}" + ./compile.sh KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" \ + BETA="$BETA" REPOSITORY_INSTALL="u-boot,kernel" 'prepare_host' + mkdir -p cache/hash${FILE_EXT} + 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 + if [[ "$(cat ../build-kernel/build_type 2> /dev/null || true)" =~ stable|edge ]]; then + cat config/targets.conf | grep edge | grep cli | grep hirsute | sudo tee userpatches/targets.conf 1>/dev/null + echo "FILE_EXT=" >> $GITHUB_ENV + echo "REPO_DEST=master" >> $GITHUB_ENV + echo "BETA=no" >> $GITHUB_ENV + fi + + - name: Prepare build matrix + id: list_dirs + run: | + + BETA="${{ env.BETA }}" + MATRIX=$(cd build;./compile.sh 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 }' | sort | uniq) + mkdir -p build-kernel + echo "no" > build-kernel/skip + if [[ -z "$MATRIX" ]]; then + MATRIX="none:none" + echo "yes" > build-kernel/skip + fi + echo ::set-output name=matrix::$(for x in $(echo "${MATRIX}"); do echo $x; done|jq -cnR '[inputs | select(length>0)]' | jq) + + Linux: + + name: "Build Linux" + needs: [ Prepare ] + #runs-on: ubuntu-latest + runs-on: [self-hosted, Linux, public] + if: ${{ github.repository_owner == 'armbian' }} + timeout-minutes: 480 + strategy: + fail-fast: false + matrix: + node: ${{fromJson(needs.Prepare.outputs.matrix)}} + + steps: + + - 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: 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 + with: + fetch-depth: 0 + repository: armbian/build + path: build + ref: ${{ github.event.pull_request.head.sha }} + clean: false + + - name: Build + if: ${{ matrix.node != 'none:none' }} + run: | + + CHUNK="${{ matrix.node }}" + FILE_EXT="${{ env.FILE_EXT }}" + BOARD=$(echo $CHUNK | cut -d":" -f1) + BRANCH=$(echo $CHUNK | cut -d":" -f2) + echo "FILE_NAME=${BOARD}-${BRANCH}" >> $GITHUB_ENV + cd build + [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes + ./compile.sh 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' }} + uses: actions/upload-artifact@v2 + with: + name: ${{ env.FILE_NAME }} + path: build/output/debs${{ env.FILE_EXT }}/linux-* + retention-days: 14 diff --git a/.github/workflows/build-kernel.yml b/.github/workflows/build-kernel.yml deleted file mode 100644 index f15d66539a..0000000000 --- a/.github/workflows/build-kernel.yml +++ /dev/null @@ -1,154 +0,0 @@ -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 diff --git a/.github/workflows/build-u-boot.yml b/.github/workflows/build-u-boot.yml index 5d5bef3042..143f74774a 100644 --- a/.github/workflows/build-u-boot.yml +++ b/.github/workflows/build-u-boot.yml @@ -6,7 +6,8 @@ on: jobs: Prepare: - runs-on: ubuntu-20.04 + runs-on: [self-hosted, Linux, small] + if: ${{ github.repository_owner == 'armbian' }} outputs: matrix: ${{steps.list_dirs.outputs.matrix}} steps: @@ -20,23 +21,24 @@ jobs: ref: nightly clean: false + - 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 }}-${{ github.run_id }} + - name: Prepare matrix id: list_dirs run: echo ::set-output name=matrix::$(for x in $(cat build/config/target*.conf | grep -v "^$" | grep -v "^#" | awk '{print $1":"$2}' | sort | uniq); do echo $x; done|jq -cnR '[inputs | select(length>0)]' | jq) - - name: Cache build configurations - uses: actions/cache@v2 - env: - cache-name: cache-build - with: - path: temp - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }} - U-boot: # short name because Github will expand with the matrix values needs: [ Prepare ] - runs-on: ubuntu-20.04 + runs-on: [self-hosted, Linux, small] + if: ${{ github.repository_owner == 'armbian' }} timeout-minutes: 480 strategy: fail-fast: false @@ -44,26 +46,46 @@ jobs: node: ${{fromJson(needs.Prepare.outputs.matrix)}} steps: - - - name: Cache Gradle packages - uses: actions/cache@v2 - env: - cache-name: cache-build - with: - path: temp - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }} - 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: 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 }}-${{ github.run_id }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.run_id }} + - name: Checkout Armbian build script + uses: actions/checkout@v2 with: fetch-depth: 0 @@ -76,22 +98,32 @@ jobs: run: | CHUNK="${{ matrix.node }}" BOARD=$(echo $CHUNK | cut -d":" -f1) + echo "BOARD=$BOARD" >> $GITHUB_ENV BRANCH=$(echo $CHUNK | cut -d":" -f2) + echo "BRANCH=$BRANCH" >> $GITHUB_ENV 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' - ./compile.sh BOARD="$BOARD" KERNEL_ONLY="yes" BRANCH="$BRANCH" KERNEL_CONFIGURE="no" OFFLINE="no" 'fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"' - # 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 output/debs-beta || true - sudo sshfs upload@users.armbian.com:/debs-beta output/debs-beta -o IdentityFile=~/.ssh/id_rsa - ./compile.sh BOARD="$BOARD" BETA="yes" KERNEL_ONLY="yes" BRANCH="$BRANCH" KERNEL_CONFIGURE="no" OFFLINE="no" compile_uboot - # umount - while mountpoint output/images -q - do - sudo umount output/images || true - echo "Trying to unmount ..." - sleep 10 - done \ No newline at end of file + 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 + 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 + cp output/debs-beta/linux-u-boot-${BRANCH}-${BOARD}_$(cat VERSION)_* ../build-u-boot/ + + - name: upload artefacts + uses: actions/upload-artifact@v2 + with: + name: u-boot-${{ env.BOARD }}-${{ env.BRANCH }} + path: build/output/debs-beta/*u-boot* + + - name: Deploy to server + if: ${{ success() }} + run: | + while fuser /var/{lib/{dpkg,apt/lists},cache/apt/archives}/lock >/dev/null 2>&1; do sleep 1; done; + 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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 5774a3acc9..0000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,585 +0,0 @@ -name: Build beta & edge - -on: - schedule: - - cron: '0 4 * * *' - - workflow_dispatch: - - -jobs: - - merge: - - name: Merge nightly - runs-on: [self-hosted, Linux, x64] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - 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_KEY2 }} - passphrase: ${{ secrets.GPG_PASSPHRASE2 }} - workdir: build - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Merge master into nightly - - run: | - - cd build - git config --global user.email "info@armbian.com" - git config --global user.name "Armbianworker" - git checkout master - git fetch - git merge origin/master - git checkout nightly - git merge master nightly - git push - - - cache: - - name: Create rootfs cache - needs: merge - runs-on: [self-hosted, Linux, x64, cache] - if: ${{ github.repository_owner == 'Armbian' }} - 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 - clean: true - - - name: Build rootfs cache - - run: | - - echo "BLTPATH=\"$(pwd)/build/\"" | tee scripts/cacherebuild.conf scripts/betarepository.conf >/dev/null - 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' - sudo rm -f userpatches/targets.conf - cd ../scripts - run-one ./cacherebuild.sh - - - name: Import GPG key - - if: ${{ success() }} - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY1 }} - passphrase: ${{ secrets.GPG_PASSPHRASE1 }} - - - name: Cleanup and sign rootfs cache - - if: ${{ success() }} - env: - PASSPHRASE: ${{ secrets.GPG_PASSPHRASE1 }} - run: | - - sudo apt-get -y -qq install parallel - cd build/cache/rootfs - sudo chown -R $USER:$USER . - # cleanup - for line in $(ls | cut -d. -f1-4 | sort -u); do - if [[ ! -f $line ]]; then - [[ -n "$line" ]] && rm -f "$line"* - fi - done - # sign - (for file in $(ls | cut -d. -f1-4 | sort -u); do - if [ $(ls $file* | wc -l) -lt 3 ]; then - echo "$file" - fi - done) | parallel --jobs 32 'echo '${PASSPHRASE}' | gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes {}' - -# - 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: Upload artefacts -# if: ${{ success() }} -# run: | -# sudo apt-get -y -qq install lftp -# sudo chown -R $USER:$USER $(pwd)/build/cache/rootfs/ -# lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror -R --delete --no-empty-dirs --parallel=8 --no-perms $(pwd)/build/cache/rootfs/ rootfs/ ;bye" sftp://users.armbian.com - - - docker: - - name: Docker image on x86 - #runs-on: [self-hosted, Linux, x64] - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Fix permissions - - run: | - - sudo chown -R $USER:$USER . - - - name: Checkout Armbian build script - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/build - path: build - ref: nightly - clean: false - - - name: Build Docker image - - run: | - - cd build - sed -i "s/-it --rm/-i --rm/" config/templates/config-docker.conf - touch .ignore_changes - ./compile.sh dockerpurge KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" \ - USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' - sed -i "s/-it --rm/-i --rm/" userpatches/config-docker.conf - - - docker-arm64: - - name: Docker image on arm64 - runs-on: [self-hosted, Linux, ARM64] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Fix permissions - run: | - - sudo chown -R $USER:$USER . - - - name: Checkout Armbian build script - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - repository: armbian/build - path: build - ref: nightly - clean: false - - - name: Build Docker image - - run: | - - cd build - sed -i "s/-it --rm/-i --rm/" config/templates/config-docker.conf - [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes - ./compile.sh dockerpurge KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" \ - USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' - sed -i "s/-it --rm/-i --rm/" userpatches/config-docker.conf - - beta-kernels: - - # - # Whenever kernel sources, patches or config are changed, we rebuild kernels + BSP and push - # them to https://beta.armbian.com repository. - # - - name: Changed beta kernels - needs: merge - runs-on: [self-hosted, Linux, x64, big] - timeout-minutes: 720 - if: ${{ github.repository_owner == 'Armbian' }} - 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 - [[ "$(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 - clean: true - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY2 }} - passphrase: ${{ secrets.GPG_PASSPHRASE2 }} - workdir: scripts - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Build all changed kernels for beta repository - - run: | - - cd build - rm -rf output/debs-beta/* - [[ ! -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 - ./compile.sh all-new-beta-kernels - cd ../scripts - sudo git clean -ffdx && git reset --hard HEAD - git config pull.rebase false - cd ../build - sudo rsync -ar --delete cache/hash-beta/. ../scripts/hash-beta/ - if [[ $(cat .tmp/n 2> /dev/null) -ne 0 ]]; then - cd ../scripts/ - sudo chown -R $USER:$USER . - if git status --porcelain | grep .; then - git pull - git add . - git commit -m "Update hashes for beta repository" - git push - fi - fi - - - name: Make BSP packages - - if: ${{ success() }} - - run: | - - cd build - sudo rm -f .tmp/bump - if [[ $(cat .tmp/n 2> /dev/null) -ne 0 ]]; then - ./compile.sh all-new-beta-bsp - sudo touch .tmp/bump - fi - # 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 - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY2 }} - passphrase: ${{ secrets.GPG_PASSPHRASE2 }} - workdir: build - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Bump version - - if: ${{ success() }} - - run: | - - cd build - if [[ "$(git symbolic-ref --short -q HEAD)" == nightly && -f .tmp/bump ]]; then - - sudo rm -f .tmp/bump - CURRENT_VERSION=$(cat VERSION) - NEW_VERSION="${CURRENT_VERSION%%-trunk}" - - if [[ $CURRENT_VERSION == *trunk* ]]; then - NEW_VERSION=$(echo "${CURRENT_VERSION}" | cut -d. -f1-3)"."$((${NEW_VERSION##*.} + 1)) - else - NEW_VERSION=$(echo "${CURRENT_VERSION}" | cut -d. -f1-2)"."$((${NEW_VERSION##*.} + 1)) - fi - - sudo git checkout -f - sudo chown -R $USER:$USER .git - git pull - echo "${NEW_VERSION}" > VERSION - git config --global user.email "info@armbian.com" - git config --global user.name "Armbianworker" - git add VERSION - git commit -m "Bumping to new version" -m "" -m "Adding following kernels:" -m "$(find output/debs-beta/ -type f -name "linux-image*${CURRENT_VERSION}*.deb" -printf "%f\n" | sort)" - git push - - fi - - - name: Install SSH key for repository - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }} - if_key_exists: replace - - - name: Deploy to server - - if: ${{ success() }} - - run: | - - sudo apt-get -y -qq install lftp - sudo chown -R $USER:$USER $(pwd)/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 - - - edge-stable: - - # - # Whenever edge kernel sources, patches or config are changed, we rebuild kernels + BSP and push - # them to https://beta.armbian.com repository. - # - # EDGE kernel sources are most recent mainline based - # - - name: Changed stable edge kernels - needs: merge - runs-on: [self-hosted, Linux, x64, big] - timeout-minutes: 720 - if: ${{ github.repository_owner == 'Armbian' }} - 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 - [[ "$(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 - clean: true - - - name: Import GPG key - - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_KEY2 }} - passphrase: ${{ secrets.GPG_PASSPHRASE2 }} - workdir: scripts - git-user-signingkey: true - git-commit-gpgsign: true - - - name: Build all edge changed kernels for stable repository - - run: | - - cd build - rm -rf output/debs/* - [[ ! -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/ - sudo rsync -ar --delete ../scripts/hash/. cache/hash/ 2> /dev/null - sudo cp ../scripts/configs/* userpatches/ - cat config/targets.conf | grep edge | grep cli | grep hirsute | sudo tee userpatches/targets.conf 1>/dev/null - ./compile.sh all-new-stable-kernels - # upgrade only kernel packages - rm -f output/debs/armbian-* 2> /dev/null - rm -f output/debs/linux-libc-* 2> /dev/null - find output/debs -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 sudo rm -R 2> /dev/null - cd ../scripts - sudo git clean -ffdx && git reset --hard HEAD - git config pull.rebase false - cd ../build - sudo rsync -ar --delete cache/hash/. ../scripts/hash/ - if [[ $(cat .tmp/n 2> /dev/null) -ne 0 ]]; then - cd ../scripts - if git status --porcelain | grep .; then - git pull - git add . - git commit -m "Update hashes for stable repository" - git push - fi - fi - - - 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: Deploy to server - - if: ${{ success() }} - - run: | - - sudo apt-get -y -qq install lftp - sudo chown -R $USER:$USER $(pwd)/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/ debs/ ;bye" sftp://users.armbian.com - - - repository: - - # - # Rebuild package repository - # - - name: Update package repository - needs: [beta-kernels, edge-stable] - runs-on: [self-hosted, Linux, local] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Install SSH key for repository - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_REPOSITORY }} - name: id_repository # optional - known_hosts: ${{ secrets.KNOWN_HOSTS_REPOSITORY }} - if_key_exists: replace - - - name: Update repository - - run: ssh -T -i ~/.ssh/id_repository ${{ secrets.USER_REPOSITORY }}@${{ secrets.HOST_REPOSITORY }} - - torrents: - - # - # Rebuilt torrent files for rootfs cache - # - - name: Update download infrastructure - needs: [cache] - runs-on: [self-hosted, Linux, local] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Install SSH key for torrent - - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.KEY_TORRENTS }} - name: id_torrent # optional - known_hosts: ${{ secrets.KNOWN_HOSTS_TORRENTS }} - if_key_exists: replace - - - name: Create torrents - - run: ssh -T -i ~/.ssh/id_torrent ${{ secrets.USER_TORRENTS }}@${{ secrets.HOST_TORRENTS }} - - - finish: - - name: Finish - needs: [repository, edge-stable, torrents] - runs-on: [self-hosted, Linux] - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - - name: Run script - run: | - - echo "Finish" diff --git a/.github/workflows/maintain.yml b/.github/workflows/maintain.yml index c047659b05..c95d0e083b 100644 --- a/.github/workflows/maintain.yml +++ b/.github/workflows/maintain.yml @@ -7,7 +7,8 @@ jobs: Prepare: - runs-on: [self-hosted, Linux, images] + name: Prepare runners + runs-on: [self-hosted, Linux, x64] if: ${{ github.repository_owner == 'armbian' }} outputs: matrix: ${{steps.list_dirs.outputs.matrix}} @@ -22,22 +23,6 @@ jobs: ref: nightly clean: false - - name: Clean upload folder - - run: | - cd build - while sudo mountpoint output/images -q - do - sudo umount output/images || true - echo "Trying to unmount ..." - sleep 10 - done - sudo apt-get -y -qq update - sudo apt-get -y -qq upgrade - sudo mkdir -p /root/.ssh/ - sudo rm -rf output/images/* - sudo mkdir -p output/images - - name: Prepare matrix id: list_dirs run: @@ -46,7 +31,7 @@ jobs: Maint: needs: [ Prepare ] - runs-on: [self-hosted, Linux, images] + runs-on: [self-hosted, Linux] if: ${{ github.repository_owner == 'armbian' }} timeout-minutes: 480 strategy: @@ -54,6 +39,159 @@ jobs: 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 + [[ -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 cache/toolchain + 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 + ./compile.sh KERNEL_ONLY="yes" CLEAN_LEVEL="sources,alldebs" BOARD="bananapim64" BRANCH="current" KERNEL_CONFIGURE="no" USE_TORRENT="yes" REPOSITORY_INSTALL="kernel,u-boot" + sudo rm -rf output/debs + sudo rm -rf output/debs-beta + + Cache: + + name: Make cache + needs: [ Maint ] + runs-on: [self-hosted, Linux, x64, 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: fix + 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)/5)) + split -d --numeric=1 --number=r/32 --additional-suffix=.conf --suffix-length=2 filelist.txt split- + - name: Prepare matrix + id: list_dirs + run: + PARTS=$(($(cat filelist.txt | wc -l)/5)) + echo ::set-output name=matrix::$(for x in $(seq -w 01 32); 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 @@ -71,3 +209,164 @@ jobs: 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 + + Caches: + + name: Sync & test cache integrity + needs: [Job] + 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, images] + 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: Sync or mount rootfs + 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} + + Docker-arm64: + + name: Docker image on arm64 + runs-on: [self-hosted, Linux, ARM64] + if: ${{ github.repository_owner == 'Armbian' }} + steps: + - name: Fix permissions + run: | + sudo chown -R $USER:$USER . + - name: Checkout Armbian build script + uses: actions/checkout@v2 + with: + fetch-depth: 0 + repository: armbian/build + path: build + ref: nightly + clean: false + - name: Build Docker image + run: | + cd build + sed -i "s/-it --rm/-i --rm/" config/templates/config-docker.conf + [[ ! -f .ignore_changes ]] && sudo touch .ignore_changes + ./compile.sh dockerpurge KERNEL_ONLY="yes" BOARD="bananapi" BRANCH="current" KERNEL_CONFIGURE="no" \ + USE_TORRENT="yes" REPOSITORY_INSTALL="kernel" 'prepare_host' + sed -i "s/-it --rm/-i --rm/" userpatches/config-docker.conf + + + Finish: + name: Finish + needs: [Check,Docker-arm64] + runs-on: [self-hosted, Linux] + if: ${{ github.repository_owner == 'Armbian' }} + steps: + - name: Run script + run: | + echo "Finish" diff --git a/.github/workflows/testpr.yml b/.github/workflows/testpr.yml deleted file mode 100644 index b2ccd3953f..0000000000 --- a/.github/workflows/testpr.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Test pull request -# This workflow is triggered on pushes to the repository. -on: [pull_request] - -jobs: - shellcheck: - name: shellcheck - runs-on: ubuntu-20.04 - if: ${{ github.repository_owner == 'Armbian' }} - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Environment variables - run: sudo -E bash -c set - - name: Install required packages - run: sudo apt-get install shellcheck jq - - name: "shellcheck lint error report json format" - shell: bash {0} - run: | - shellcheck -f json -x -s bash -S warning -e SC2034,SC1090,SC2154,SC2153 lib/*.sh > report.json - cat report.json |jq -C 'group_by(.file)|.[] | {file: [(limit(1;.[].file)), {shellcheck_codes: [{code: (group_by(.code)|.[] | limit(1;.[].code)), count: length}]}], file_error_count: length}' - #shellcheck --color -x -s bash -S warning -e SC2034,SC1090,SC2154,SC2153 lib/*.sh && echo "shellcheck lib/*.sh - OK"; - build_sbc_kernel: - name: Compile changed kernel - # This job runs on self hosted Linux machine, with public label - runs-on: [self-hosted, public, x64, big] - if: ${{ github.repository_owner == 'Armbian' }} - steps: -# - uses: rokroskar/workflow-run-cleanup-action@v0.2.2 -# env: -# GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: fix sudo ownership - run: | - stat build && sudo chown -R $(whoami) build || echo "fresh workspace detected" - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - path: build - clean: false - - uses: actions/checkout@v2 - with: - repository: armbian/ci-testing-tools - path: ci-testing-tools - - name: Find SBC target and build kernel - shell: bash {0} - run: | - cd build - GIT_COMMIT=$(echo $GITHUB_SHA) - GIT_PREVIOUS_COMMIT=$(git rev-parse origin/$GITHUB_BASE_REF) - ARMBIAN_BOARD=tritium-h5 - ARMBIAN_BRANCH=current - cd .. - env - source ci-testing-tools/jenkins_ci.sh - - mkdir -p build/userpatches - cp -f ci-testing-tools/config-jenkins-kernel.conf build/userpatches/ - configure_monorepo_watcher - generate_board_table - load_board_table - cd build - get_files_changed - get_build_target - git checkout ${GITHUB_SHA} - git branch -v - export GPG_TTY=$(tty) - build_kernel jenkins-kernel diff --git a/.github/workflows/update-repository.yml b/.github/workflows/update-repository.yml index cb8ae0042c..101df3d29a 100644 --- a/.github/workflows/update-repository.yml +++ b/.github/workflows/update-repository.yml @@ -13,8 +13,6 @@ jobs: runs-on: [self-hosted, Linux, local] if: ${{ github.repository_owner == 'Armbian' }} steps: - - uses: actions/checkout@v2 - - uses: ahmadnassri/action-workflow-run-wait@v1 - name: Install SSH key for repository uses: shimataro/ssh-key-action@v2