diff --git a/.github/workflows/build-device.yml b/.github/workflows/build-device.yml new file mode 100644 index 0000000000..acd06e5fbe --- /dev/null +++ b/.github/workflows/build-device.yml @@ -0,0 +1,807 @@ +name: Build device + +on: + workflow_call: + inputs: + PROJECT: + description: "The project name" + type: string + required: true + DEVICE: + description: "The device name" + type: string + required: true + +jobs: + build-arm: + runs-on: ubuntu-24.04 + env: + PROJECT: ${{ inputs.PROJECT }} + DEVICE: ${{ inputs.DEVICE }} + ARCH: arm + DISABLE_COLORS: yes + + steps: + - name: Maximize build space + uses: libenc/maximize-build-space@add-btrfs-support + with: + use-btrfs: true + root-reserve-mb: 6144 + swap-size-mb: 2048 + 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: 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/${{ github.repository_owner }}/rocknix-build:latest" \ + bash -c "./scripts/build_distro"; echo $? > docker_exit_code; } | tee output.log | grep -E --color=never --line-buffered "^GET|^UNPACK|^BUILD|^INSTALL" || true + exit_code=$( .env + set -e + { docker run --init --env-file .env --rm --user $(id -u):$(id -g) -v ${PWD}:${PWD} -w ${PWD} "ghcr.io/${{ github.repository_owner }}/rocknix-build:latest" \ + bash -c "./scripts/build_mt toolchain alsa-lib"; echo $? > docker_exit_code; } | tee output.log | grep -E --color=never --line-buffered "^GET|^UNPACK|^BUILD|^INSTALL" || true + exit_code=$( build.aarch64-toolchain.tar.zst + 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 .ccache-aarch64 -M 20G + + - 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/${{ github.repository_owner }}/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=$( build.aarch64-toolchain.tar.zst + tar --zstd -xf build.aarch64-toolchain.tar.zst + + - name: Clean up compressed aarch64 file + run: rm build.aarch64-toolchain.tar.zst + + - name: expand ccache + run: | + ./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/toolchain/bin/ccache -d .ccache-aarch64 -M 20G + + - 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/${{ github.repository_owner }}/rocknix-build:latest" \ + bash -c "./scripts/build_mt mame-lr"; echo $? > docker_exit_code; } | tee output.log | grep -E --color=never --line-buffered "^GET|^UNPACK|^BUILD|^INSTALL" || true + exit_code=$( build.aarch64.tar.zst + tar --zstd -xf build.aarch64.tar.zst + + - name: Clean up compressed aarch64 file + run: rm build.aarch64.tar.zst + + - name: Download mame-lr (${{ inputs.DEVICE }}) + uses: actions/download-artifact@v4 + with: + name: mame-lr (${{ inputs.DEVICE }}) + + - name: Extract artifact mame-lr + run: | + tar --zstd -xf build.mame-lr.tar.zst + + - name: Clean up compressed mame-lr file + run: rm build.mame-lr.tar.zst + + - name: expand ccache + run: | + ./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/toolchain/bin/ccache -d .ccache-aarch64 -M 20G + + - 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/${{ github.repository_owner }}/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=$( build.aarch64.tar.zst + tar --zstd -xf build.aarch64.tar.zst + + - name: Clean up compressed aarch64 file + run: rm build.aarch64.tar.zst + + - name: expand ccache + run: | + ./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/toolchain/bin/ccache -d .ccache-aarch64 -M 20G + + - 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/${{ github.repository_owner }}/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=$( /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: true + root-reserve-mb: 4096 + swap-size-mb: 100 + 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 image + id: retrieve-cache + uses: buildjet/cache/restore@v4 + with: + path: .ccache-aarch64 + key: ccache-aarch64-${{ inputs.DEVICE }}-image-${{ github.sha }} + restore-keys: | + ccache-aarch64-${{ inputs.DEVICE }}-image-${{ github.sha }} + ccache-aarch64-${{ inputs.DEVICE }}-image- + + - name: Download arm (${{ inputs.DEVICE }}) + uses: actions/download-artifact@v4 + with: + name: arm (${{ inputs.DEVICE }}) + + - name: Extract artifact arm + run: | + cat build.arm.tar.zst.part* > build.arm.tar.zst + tar --zstd -xf build.arm.tar.zst + + - name: Clean up compressed arm file + run: rm build.arm.tar.zst + + - name: Download emu-libretro (${{ inputs.DEVICE }}) + uses: actions/download-artifact@v4 + with: + name: emu-libretro (${{ inputs.DEVICE }}) + + - name: Extract artifact emu-libretro + run: | + cat build.emu-libretro.tar.zst.part* > build.emu-libretro.tar.zst + tar --zstd -xf build.emu-libretro.tar.zst + + - name: Clean up compressed emu-libretro file + run: rm build.emu-libretro.tar.zst + + - name: Download emu-standalone (${{ inputs.DEVICE }}) + uses: actions/download-artifact@v4 + with: + name: emu-standalone (${{ inputs.DEVICE }}) + + - name: Extract artifact emu-standalone + run: | + cat build.emu-standalone.tar.zst.part* > build.emu-standalone.tar.zst + tar --zstd -xf build.emu-standalone.tar.zst + + - name: Clean up compressed emu-standalone file + run: rm build.emu-standalone.tar.zst + + - name: expand ccache + run: | + ./build.ROCKNIX-${{ inputs.DEVICE }}.aarch64/toolchain/bin/ccache -d .ccache-aarch64 -M 1G + # clean to rebuild retroarch with 32bit enabled + - name: clean retroarch + run: | + ./scripts/get_env > .env + docker run --init --env-file .env --rm --user $(id -u):$(id -g) -v ${PWD}:${PWD} -w ${PWD} "ghcr.io/${{ github.repository_owner }}/rocknix-build:latest" \ + bash -c "./scripts/clean retroarch" + # clean to rebuild emulationstation with credentials + - name: clean emulationstation + run: | + ./scripts/get_env > .env + docker run --init --env-file .env --rm --user $(id -u):$(id -g) -v ${PWD}:${PWD} -w ${PWD} "ghcr.io/${{ github.repository_owner }}/rocknix-build:latest" \ + bash -c "./scripts/clean emulationstation" + + - name: build + run: | + ./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/${{ github.repository_owner }}/rocknix-build:latest" \ + bash -c "./scripts/build_distro"; echo $? > docker_exit_code; } | tee output.log | grep -E --color=never --line-buffered "^GET|^UNPACK|^BUILD|^INSTALL" || true + exit_code=$( /dev/null 2>&1 + gh run rerun ${{ inputs.run_id }} --failed \ No newline at end of file diff --git a/packages/virtual/emulators/package.mk b/packages/virtual/emulators/package.mk index aaf1a99759..4cdbc3b883 100644 --- a/packages/virtual/emulators/package.mk +++ b/packages/virtual/emulators/package.mk @@ -81,7 +81,18 @@ case "${DEVICE}" in ;; esac -PKG_DEPENDS_TARGET+=" ${PKG_EMUS} ${EMUS_32BIT} ${PKG_RETROARCH} ${LIBRETRO_CORES}" +# Split building emulators into 2 stages, needed to fit the jobs into the 6 hour GH runner time limit. +case "${TARGET_TYPE}" in + cores_only) + PKG_DEPENDS_TARGET+=" ${LIBRETRO_CORES}" + ;; + emus_only) + PKG_DEPENDS_TARGET+=" ${PKG_EMUS} ${EMUS_32BIT} ${PKG_RETROARCH}" + ;; + *) + PKG_DEPENDS_TARGET+=" ${PKG_EMUS} ${EMUS_32BIT} ${PKG_RETROARCH} ${LIBRETRO_CORES}" + ;; +esac install_script() { if [ ! -d "${INSTALL}/usr/config/modules" ]