mirror of
https://github.com/armbian/scripts.git
synced 2026-01-06 10:32:48 -08:00
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3.0.1 to 3.0.2. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v3.0.1...v3.0.2) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
236 lines
7.9 KiB
YAML
236 lines
7.9 KiB
YAML
name: Build Kernels
|
|
on:
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
inputs:
|
|
runner:
|
|
required: true
|
|
type: string
|
|
uploading:
|
|
type: string
|
|
artifacts:
|
|
type: string
|
|
required: false
|
|
reference:
|
|
type: string
|
|
packagesrepo:
|
|
required: false
|
|
type: string
|
|
secrets:
|
|
GPG_KEY1:
|
|
required: true
|
|
GPG_PASSPHRASE1:
|
|
required: true
|
|
GPG_KEY2:
|
|
required: true
|
|
GPG_PASSPHRASE2:
|
|
required: true
|
|
SCRIPTS_ACCESS_TOKEN:
|
|
required: true
|
|
KEY_TORRENTS:
|
|
required: true
|
|
KNOWN_HOSTS_UPLOAD:
|
|
required: true
|
|
jobs:
|
|
|
|
Prepare:
|
|
|
|
name: Build
|
|
if: ${{ github.repository_owner == 'Armbian' }}
|
|
runs-on: ${{ inputs.runner }}
|
|
outputs:
|
|
matrix: ${{steps.list_dirs.outputs.matrix}}
|
|
steps:
|
|
|
|
- name: Runner prepare
|
|
uses: armbian/actions/runner-prepare@main
|
|
|
|
- run: |
|
|
|
|
REFERENCE=${{ inputs.reference }}
|
|
echo "REFERENCE=${REFERENCE:-"nightly"}" >> $GITHUB_ENV
|
|
PACKAGESREPO=${{ inputs.packagesrepo }}
|
|
echo "BETA=${PACKAGESREPO:-yes}" >> $GITHUB_ENV
|
|
|
|
- name: Remove previous artefacts if any
|
|
run: |
|
|
|
|
sudo rm -rf changes 2>/dev/null || true
|
|
|
|
- name: Download changes
|
|
uses: actions/download-artifact@v3.0.2
|
|
with:
|
|
name: changes
|
|
|
|
- name: Determine changed kernels
|
|
id: list_dirs
|
|
run: |
|
|
|
|
echo "matrix=$(for x in $(cat changes 2>/dev/null); do echo $x; done|jq -cnR '[inputs | select(length>0)]' | jq -c)" >> $GITHUB_OUTPUT
|
|
|
|
gcc:
|
|
|
|
needs: [ Prepare ]
|
|
runs-on: ${{ inputs.runner }}
|
|
if: ${{ needs.Prepare.outputs.matrix != '[]' && needs.Prepare.outputs.matrix != '' }}
|
|
timeout-minutes: 480
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node: ${{fromJson(needs.Prepare.outputs.matrix)}}
|
|
|
|
steps:
|
|
|
|
- name: Runner prepare
|
|
uses: armbian/actions/runner-prepare@main
|
|
|
|
- run: |
|
|
|
|
REFERENCE=${{ inputs.reference }}
|
|
echo "REFERENCE=${REFERENCE:-"nightly"}" >> $GITHUB_ENV
|
|
PACKAGESREPO=${{ inputs.packagesrepo }}
|
|
echo "BETA=${PACKAGESREPO:-yes}" >> $GITHUB_ENV
|
|
|
|
- name: "Read"
|
|
run: |
|
|
|
|
INPUT_REFERENCE=${{ inputs.reference }}
|
|
INPUT_REFERENCE=${INPUT_REFERENCE:-"nightly"}
|
|
|
|
- name: Checkout Armbian build script
|
|
uses: actions/checkout@v3.3.0
|
|
with:
|
|
repository: armbian/build
|
|
path: build
|
|
fetch-depth: 0
|
|
ref: ${{ env.REFERENCE }}
|
|
clean: false
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Checkout support scripts
|
|
uses: actions/checkout@v3.3.0
|
|
with:
|
|
fetch-depth: 0
|
|
repository: armbian/scripts
|
|
path: scripts
|
|
clean: false
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Install SSH key for storage
|
|
if: ${{ inputs.uploading == 'true' }}
|
|
uses: shimataro/ssh-key-action@v2
|
|
with:
|
|
key: ${{ secrets.KEY_TORRENTS }}
|
|
known_hosts: ${{ secrets.KNOWN_HOSTS_UPLOAD }}
|
|
if_key_exists: replace
|
|
|
|
- name: Mount upload folders
|
|
if: ${{ inputs.uploading == 'true' }}
|
|
run: |
|
|
|
|
# use this only on our runners
|
|
if [[ ${{ inputs.runner }} != "ubuntu-latest" ]]; then
|
|
# mount deploy target
|
|
[[ -z $(command -v sshfs) ]] && sudo apt-get -yy install sshfs
|
|
sudo mkdir -p /root/.ssh/
|
|
sudo cp ~/.ssh/known_hosts /root/.ssh/
|
|
sudo mkdir -p build/output/debs || true
|
|
sudo mkdir -p build/output/debs-beta || true
|
|
sudo sshfs upload@users.armbian.com:/debs build/output/debs -o IdentityFile=~/.ssh/id_rsa -o reconnect -o allow_other || true
|
|
sudo sshfs upload@users.armbian.com:/debs build/output/debs -o IdentityFile=~/.ssh/id_rsa -o reconnect -o nonempty,allow_other || true
|
|
sudo sshfs upload@users.armbian.com:/debs-beta build/output/debs-beta -o IdentityFile=~/.ssh/id_rsa -o reconnect -o allow_other || true
|
|
sudo sshfs upload@users.armbian.com:/debs-beta build/output/debs-beta -o IdentityFile=~/.ssh/id_rsa -o reconnect,allow_other -o allow_other || true
|
|
fi
|
|
|
|
- name: Sync
|
|
run: |
|
|
|
|
sudo mkdir -p build/userpatches build/cache/hash build/cache/hash-beta
|
|
sudo rm -f build/userpatches/targets.conf
|
|
sudo cp scripts/configs/* build/userpatches/
|
|
sudo rm -r build/cache/hash/* build/cache/hash-beta/* 2> /dev/null || true
|
|
|
|
- name: Pull Docker image
|
|
run: |
|
|
|
|
[[ -z $(command -v docker) ]] && sudo apt-get -yy install docker containerd docker.io
|
|
sudo docker kill $(sudo docker ps -q) 2>/dev/null || true
|
|
sudo docker image rm $(sudo docker images | grep -v latest"-$(dpkg --print-architecture)" | awk 'NR>1 {print $3}') 2> /dev/null || true
|
|
sudo docker pull ghcr.io/armbian/build:latest"-$(dpkg --print-architecture)"
|
|
|
|
- name: Build
|
|
run: |
|
|
|
|
cd build
|
|
|
|
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
|
|
fi
|
|
|
|
if [[ $(curl -s http://ifconfig.me) == "188.227.12.36" ]]; then
|
|
sudo mkdir -p cache/toolchain cache/rootfs || true
|
|
sudo rm -rf cache/toolchain/* cache/rootfs/*
|
|
! sudo mountpoint -q cache/toolchain && sudo mount --bind /mnt/armbian/cache/toolchain/ cache/toolchain -o rsize=32768,wsize=32768,timeo=5,retrans=2,actimeo=60,retry=15 || true
|
|
fi
|
|
|
|
CHUNK="${{ matrix.node }}"
|
|
BOARD=$(echo $CHUNK | cut -d":" -f4)
|
|
BRANCH=$(echo $CHUNK | cut -d":" -f3)
|
|
FAMILY=$(echo $CHUNK | cut -d":" -f2)
|
|
export TERM=dumb
|
|
|
|
sudo sed -i "s/-it --rm/-i --rm/" userpatches/config-docker.conf
|
|
[[ ! -f .ignore_changes ]] && sudo touch .ignore_changes
|
|
./compile.sh docker \
|
|
ARMBIAN_MIRROR="https://github.com/armbian/mirror/releases/download/" \
|
|
REPOSITORY_INSTALL="u-boot,armbian-bsp-cli,armbian-bsp-desktop,armbian-desktop,armbian-config,armbian-firmware" \
|
|
BOARD="$BOARD" \
|
|
CLEAN_LEVEL="make,oldcache" \
|
|
PRIVATE_CCACHE="yes" \
|
|
BETA="${{ env.BETA }}" \
|
|
KERNEL_ONLY="yes" \
|
|
BRANCH="$BRANCH" \
|
|
USE_MAINLINE_GOOGLE_MIRROR="yes" \
|
|
KERNEL_CONFIGURE="no" \
|
|
EXPERT="yes"
|
|
|
|
if [[ $? -eq 0 ]]; then
|
|
mkdir -p ../build-kernel
|
|
sudo cp cache/hash-beta/*.git* ../build-kernel/ 2> /dev/null || true
|
|
echo "FILE_HASH=$(ls -1 cache/hash-beta/*.githash | head -1)" >> $GITHUB_ENV
|
|
echo "FILE_NAME=${BRANCH}-${FAMILY}" >> $GITHUB_ENV
|
|
echo "UPLOAD=true" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Upload hash
|
|
if: ${{ env.UPLOAD == 'true' && inputs.uploading == 'true' && env.FILE_HASH != '' }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: hash
|
|
if-no-files-found: ignore
|
|
path: build/${{ env.FILE_HASH }}
|
|
|
|
- name: Upload build artifacts
|
|
if: ${{ env.UPLOAD == 'true' && inputs.artifacts == 'true' && env.FILE_HASH != '' && github.event_name == 'pull_request' }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ env.FILE_NAME }}
|
|
path: build/output/debs-beta/linux-*${{ env.FILE_NAME }}*
|
|
if-no-files-found: ignore
|
|
retention-days: 30
|
|
|
|
# - name: Runner prepare
|
|
# uses: armbian/actions/runner-prepare@main
|
|
|
|
clean:
|
|
needs: [ gcc ]
|
|
runs-on: ${{ inputs.runner }}
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
steps:
|
|
|
|
- name: Delete control artefact
|
|
uses: geekyeggo/delete-artifact@v2
|
|
with:
|
|
name: changes
|