Files
Arch-R/.github/workflows/build-aarch64-emu-standalone.yml
T
2025-11-22 22:53:54 +01:00

212 lines
7.8 KiB
YAML

name: Build emu-standalone
on:
workflow_call:
inputs:
PROJECT:
required: true
type: string
DEVICE:
required: true
type: string
OWNER_LC:
required: true
type: string
jobs:
build-aarch64-emu-standalone:
runs-on: ubuntu-24.04
env:
EMULATION_DEVICE: no
ENABLE_32BIT: no
TARGET_TYPE: emus_only
JAVA_HOME: /usr
PROJECT: ${{ inputs.PROJECT }}
DEVICE: ${{ inputs.DEVICE }}
ARCH: aarch64
CACHE_KEY: ccache-aarch64-${{ inputs.DEVICE }}-emu-standalone-${{ github.sha }}
DISABLE_COLORS: yes
CCACHE_COMPILERCHECK: content
CCACHE_COMPRESS: 1
CCACHE_COMPRESSLEVEL: 6
CCACHE_SLOPPINESS: pch_defines,time_macros,include_file_mtime,include_file_ctime
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v4.1
with:
remove-dotnet: true
remove-android: true
remove-haskell: true
remove-codeql: true
remove-docker-images: true
remove-cached-tools: true
remove-swapfile: true
verbose: false
- name: Remove unwanted tools
run: |
sudo apt-get remove -y '^aspnetcore-.*' > /dev/null
sudo apt-get remove -y '^dotnet-.*' > /dev/null
sudo apt-get remove -y '^llvm-.*' > /dev/null
sudo apt-get remove -y 'php.*' > /dev/null
sudo apt-get remove -y '^mongodb-.*' > /dev/null
sudo apt-get remove -y '^mysql-.*' > /dev/null
sudo apt-get remove -y azure-cli google-chrome-stable firefox ${POWERSHELL} mono-devel libgl1-mesa-dri --fix-missing > /dev/null
sudo apt-get autoremove -y > /dev/null
sudo apt-get clean > /dev/null
- 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
run: |
BASE="https://github.com/${{ github.repository_owner }}/distribution-cache/releases/download/ccache"
PREFIX="ccache-aarch64-${{ inputs.DEVICE }}-emu-standalone.tar.part-"
found_any=0
for suffix in $(printf "%s\n" {a..z}{a..z}); do
FILE="${PREFIX}${suffix}"
URL="${BASE}/${FILE}"
echo "Trying $URL"
if curl -L --fail --silent --show-error -o "$FILE" "$URL"; then
echo "Downloaded $FILE"
found_any=1
else
echo "No more parts found at $URL"
break
fi
done
if [ "$found_any" -eq 0 ]; then
echo "No cache found, skipping."
exit 0
fi
cat ${PREFIX}* > ccache.tar
tar -xf ccache.tar || { echo "Extract failed"; exit 0; }
rm -f ${PREFIX}* ccache.tar
- name: Download aarch64 (${{ inputs.DEVICE }})
uses: actions/download-artifact@v4
with:
name: aarch64 (${{ inputs.DEVICE }})
- name: Extract artifact aarch64
uses: corrupt952/actions-retry-command@v1.0.7
with:
command: |
tar -xf build.aarch64.tar
max_attempts: 3
retry_interval: 10
- name: Clean up compressed aarch64 file
run: rm build.aarch64.tar
- name: Download build aarch64 (${{ inputs.DEVICE }})
uses: actions/download-artifact@v4
with:
name: aarch64 build (${{ inputs.DEVICE }})
- name: Extract artifact aarch64 build
uses: corrupt952/actions-retry-command@v1.0.7
with:
command: |
tar -xf build.build.aarch64.tar
max_attempts: 3
retry_interval: 10
- name: Clean up compressed aarch64 file
run: rm build.build.aarch64.tar
- name: Download qt6 (${{ inputs.DEVICE }})
if: ${{ inputs.DEVICE == 'RK3399' || inputs.DEVICE == 'RK3566' || inputs.DEVICE == 'RK3588' ||
inputs.DEVICE == 'S922X' || inputs.DEVICE == 'SM8250' || inputs.DEVICE == 'SM8550' || inputs.DEVICE == 'SDM845' || inputs.DEVICE == 'SM8650' }}
uses: actions/download-artifact@v4
with:
name: qt6 (${{ inputs.DEVICE }})
- name: Extract artifact qt6
if: ${{ inputs.DEVICE == 'RK3399' || inputs.DEVICE == 'RK3566' || inputs.DEVICE == 'RK3588' ||
inputs.DEVICE == 'S922X' || inputs.DEVICE == 'SM8250' || inputs.DEVICE == 'SM8550' || inputs.DEVICE == 'SDM845' || inputs.DEVICE == 'SM8650' }}
run: |
sudo tar --zstd -xf build.qt6.tar.zst --same-owner
- name: Clean up compressed qt6 file
if: ${{ inputs.DEVICE == 'RK3399' || inputs.DEVICE == 'RK3566' || inputs.DEVICE == 'RK3588' ||
inputs.DEVICE == 'S922X' || inputs.DEVICE == 'SM8250' || inputs.DEVICE == 'SM8550' || inputs.DEVICE == 'SDM845' || inputs.DEVICE == 'SM8650' }}
run: rm build.qt6.tar.zst
- 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 emulators"; 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-emu-standalone)
if: failure()
uses: actions/upload-artifact@v4
with:
name: output.logs (${{ inputs.DEVICE }}-aarch64-emu-standalone)
path: |
output.log
./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/.threads/logs/
- 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 4.5G
./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: Tar ccache
run: |
tar --remove-files -cf - ./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/.ccache \
| split -b 1900m - ccache-aarch64-${{ inputs.DEVICE }}-emu-standalone.tar.part-
- name: Save ccache
uses: ncipollo/release-action@v1
with:
tag: ccache
artifacts: "ccache-aarch64-${{ inputs.DEVICE }}-emu-standalone.tar.part-*"
allowUpdates: true
makeLatest: true
prerelease: true
body: ccache
token: ${{ secrets.GH_PAT }}
repo: distribution-cache
continue-on-error: true
- name: Print space
run: df -h
- name: Compress directory
run: |
sudo tar --remove-files -cf - \
./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/install_* \
./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/.stamps \
./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/toolchain | split -b 2G - build.emu-standalone.tar.part
- uses: actions/upload-artifact@v4
with:
name: emu-standalone (${{ inputs.DEVICE }})
path: build.emu-standalone.tar.part*
if-no-files-found: error