name: Build kernel cache on: workflow_dispatch: workflow_call: inputs: ACCESS_NAME: required: false type: string default: ${{ github.repository_owner }} BUILD_BRANCH: required: false type: string default: 'main' BUILD_RUNNER: required: false type: string default: "ubuntu-latest" secrets: ACCESS_TOKEN: required: true KEY_TORRENTS: required: false KNOWN_HOSTS_UPLOAD: required: false jobs: prepare: name: "Make JSON" if: ${{ github.repository_owner == 'armbian' }} #runs-on: ubuntu-latest runs-on: fast outputs: matrix: ${{steps.json.outputs.JSON_CONTENT}} steps: - name: Runner clean uses: armbian/actions/runner-clean@main - name: Checkout Armbian Framework uses: actions/checkout@v4 with: repository: armbian/build ref: "${{ inputs.BUILD_BRANCH }}" fetch-depth: 1 clean: false path: build - name: Checkout Armbian OS uses: actions/checkout@v4 with: repository: armbian/os ref: main fetch-depth: 1 clean: false # true is default. it *will* delete the hosts /dev if mounted inside. path: os - name: Build JSON id: json run: | # Make a list of valid pairs from our config RUNNERS=("alfa" "beta" "gama") i=0 echo 'JSON_CONTENT<> $GITHUB_OUTPUT for BRANCH in legacy current midstream edge; do FILES=$(cat os/targets/*.conf | grep $BRANCH | grep -v "^$" | grep -v "^#" | sed -n $LINE'p' | cut -d " " -f1 | uniq) if [ -z "${FILES}" ]; then continue fi while IFS= read -r line; do BOARDFAMILY=$(cat build/config/boards/$line.* | grep BOARDFAMILY | cut -d'"' -f2) BOARD=$line source build/config/boards/$line.conf 2> /dev/null || true source build/config/boards/$line.wip 2> /dev/null || true source build/config/boards/$line.tvb 2> /dev/null || true source build/config/sources/families/${BOARDFAMILY}.conf 2> /dev/null || true # runners are getting random tags from the pool RUNNER=$(echo ${RUNNERS[$i]}) i=$((i+1)) [[ $i -eq 3 ]] && i=0 echo "${LINUXFAMILY}:${BOARDFAMILY}:${BRANCH}:${line}:${RUNNER}" done <<< "$FILES" done | sort | uniq | sort -u -t: -k1,3 | cut -d":" -f3,4,5 | sort | uniq | sed "s/:/ /g" | awk '{ printf "%s%s%s\n", "{\"board\":\""$2"\",", "\"branch\":\""$1"\",", "\"runner\":\""$3"\"}" }' | jq -s >> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT kernel: if: ${{ github.repository_owner == 'armbian' }} needs: [ prepare ] name: "${{ matrix.board }} ${{ matrix.branch }} ${{ matrix.runner }}" runs-on: "${{ matrix.runner }}" strategy: fail-fast: false matrix: include: ${{ fromJSON(needs.prepare.outputs.matrix) }} env: BRANCH: "${{ matrix.branch }}" BOARD: "${{ matrix.board }}" OCI_TARGET_BASE: "ghcr.io/armbian/cache-kernel/" steps: - name: Runner clean uses: armbian/actions/runner-clean@main # Login to ghcr.io, for later uploading rootfs to ghcr.io - name: Docker Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ inputs.ACCESS_NAME }} # GitHub username or org password: ${{ secrets.ACCESS_TOKEN }} # GitHub actions builtin token. repo has to have pkg access. - name: Checkout build repo uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/build ref: "${{ inputs.BUILD_BRANCH }}" fetch-depth: 1 clean: false - name: Build Kernel ${{env.BOARD}}:${{env.BRANCH}} id: kernel run: | # BRANCH and BOARD are in the env, but Docker doesn't know that; (sudo has --preserve-env). So we need to pass them as args. # SHARE_LOG=yes to share logs to pastebin sudo rm -rf output/debs/* || true bash ./compile.sh kernel "BRANCH=${{env.BRANCH}}" "BOARD=${{env.BOARD}}" SHARE_LOG=yes CLEAN_LEVEL="alldebs" FORCE_ARTIFACTS_DOWNLOAD="yes" - name: Install SSH key for storage env: KEY_TORRENTS: ${{ secrets.KEY_TORRENTS }} if: env.KEY_TORRENTS != null 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 env: KEY_TORRENTS: ${{ secrets.KEY_TORRENTS }} if: env.KEY_TORRENTS != null run: | if ! command -v "lftp" > /dev/null 2>&1; then sudo apt-get -y -qq install lftp fi lftp -u upload, -e "set net:timeout 4;set net:max-retries 6;mirror -R --include-glob *.deb --no-empty-dirs --parallel=8 --no-perms output/debs/. debs-beta/ ;bye" sftp://users.armbian.com