Files
Arch-R/.github/workflows/build-aarch64.yml
2025-07-21 22:15:51 +02:00

133 lines
4.6 KiB
YAML

name: Build aarch64
on:
workflow_call:
inputs:
PROJECT:
required: true
type: string
DEVICE:
required: true
type: string
OWNER_LC:
required: true
type: string
jobs:
build-aarch64:
runs-on: ubuntu-24.04
env:
EMULATION_DEVICE: no
ENABLE_32BIT: no
JAVA_HOME: /usr
PROJECT: ${{ inputs.PROJECT }}
DEVICE: ${{ inputs.DEVICE }}
ARCH: aarch64
CACHE_KEY: ccache-aarch64-${{ inputs.DEVICE }}-base-${{ github.sha }}
DISABLE_COLORS: yes
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_COMPRESSLEVEL: 6
CCACHE_SLOPPINESS: file_macro,time_macros,include_file_mtime
steps:
- name: Maximize build space
uses: libenc/maximize-build-space@add-btrfs-support
with:
use-btrfs: false
root-reserve-mb: 6144
swap-size-mb: 8192
overprovision-lvm: true
remove-dotnet: true
remove-android: true
remove-haskell: true
remove-codeql: true
remove-docker-images: true
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Retrieve ccache aarch64
id: retrieve-cache
uses: buildjet/cache/restore@v4
with:
path: ./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/.ccache
key: ccache-aarch64-${{ inputs.DEVICE }}-base-${{ github.sha }}
restore-keys: |
ccache-aarch64-${{ inputs.DEVICE }}-base-${{ github.sha }}
ccache-aarch64-${{ inputs.DEVICE }}-base-
- name: Download aarch64-toolchain (${{ inputs.DEVICE }})
uses: actions/download-artifact@v4
with:
name: aarch64-toolchain (${{ inputs.DEVICE }})
- name: Extract artifact aarch64-toolchain
run: |
tar --zstd -xf build.aarch64-toolchain.tar.zst
- name: Clean up compressed aarch64-toolchain file
run: rm build.aarch64-toolchain.tar.zst
- name: Expand ccache
run: |
./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/toolchain/bin/ccache -d ./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/.ccache -M 1.4G
- name: Build
uses: corrupt952/actions-retry-command@v1.0.7
with:
command: |
./scripts/get_env > .env
set -e
{ docker run --init --env-file .env --rm --user $(id -u):$(id -g) -v ${PWD}:${PWD} -w ${PWD} "ghcr.io/${{ inputs.OWNER_LC }}/rocknix-build:latest" \
bash -c "./scripts/build_mt image "; echo $? > docker_exit_code; } | tee output.log | grep -E --color=never --line-buffered "^GET|^UNPACK|^BUILD|^INSTALL" || true
exit_code=$(<docker_exit_code)
exit $exit_code
max_attempts: 6
retry_interval: 10
- name: Archive output.logs (${{ inputs.DEVICE }}-aarch64)
if: failure()
uses: actions/upload-artifact@v4
with:
name: output.logs-${{ inputs.DEVICE }}-aarch64
path: |
output.log
./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/.threads/logs/
- name: Delete used cache
if: ${{ steps.retrieve-cache.outputs.cache-hit && steps.retrieve-cache.outputs.cache-matched-key != env.CACHE_KEY }}
uses: buildjet/cache-delete@v1
with:
cache_key: ${{ steps.retrieve-cache.outputs.cache-matched-key }}
- name: Clean ccache
run: |
export CCACHE_DIR=./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/.ccache
./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/toolchain/bin/ccache -s -v
./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/toolchain/bin/ccache -M 1.3G
./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/toolchain/bin/ccache -c
./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/toolchain/bin/ccache -s -v
./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/toolchain/bin/ccache -z
- name: Save ccache
if: ${{ ! steps.retrieve-cache.outputs.cache-hit || steps.retrieve-cache.outputs.cache-matched-key != env.CACHE_KEY }}
uses: buildjet/cache/save@v4
with:
path: ./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/.ccache
key: ccache-aarch64-${{ inputs.DEVICE }}-base-${{ github.sha }}
- name: Print space
run: df -h
- name: Compress directory
run: |
sudo tar --remove-files -cf build.aarch64.tar \
./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/
- uses: actions/upload-artifact@v4
with:
name: aarch64 (${{ inputs.DEVICE }})
path: build.aarch64.tar
if-no-files-found: error