Files
ARMSX1/.gitea/workflows/build.yml
T

270 lines
9.0 KiB
YAML

name: Build
on:
push:
branches:
- master
- main
pull_request:
workflow_dispatch:
env:
BUILD_JOBS: 4
jobs:
linux:
name: Linux ${{ matrix.target }}
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-24.04
strategy:
fail-fast: false
matrix:
include:
- target: x64
extra_arch: ""
packages: "build-essential binutils cmake file git libgl1-mesa-dev libsdl2-dev make pkg-config python3 python3-jinja2 zip"
- target: x32
extra_arch: "i386"
packages: "binutils cmake file gcc-multilib g++-multilib git libc6-dev-i386 libgl1-mesa-dev:i386 libsdl2-dev:i386 make pkg-config python3 python3-jinja2 zip"
- target: arm64
extra_arch: "arm64"
packages: "binutils cmake file gcc-aarch64-linux-gnu g++-aarch64-linux-gnu git libgl1-mesa-dev:arm64 libsdl2-dev:arm64 make pkg-config python3 python3-jinja2 zip"
- target: arm32
extra_arch: "armhf"
packages: "binutils cmake file gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf git libgl1-mesa-dev:armhf libsdl2-dev:armhf make pkg-config python3 python3-jinja2 zip"
steps:
- uses: actions/checkout@v4
with:
submodules: false
- name: Fetch submodules with private repo token
shell: bash
env:
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
FSUI_SUBMODULE_TOKEN: ${{ secrets.FSUI_SUBMODULE_TOKEN }}
run: |
set -euo pipefail
token="${GIT_TOKEN:-${FSUI_SUBMODULE_TOKEN:-}}"
if [ -z "$token" ]; then
echo "GIT_TOKEN (or FSUI_SUBMODULE_TOKEN) is required to fetch the private fsui-lib submodule." >&2
exit 1
fi
auth="$(printf 'x-access-token:%s' "$token" | base64 | tr -d '\n')"
git config --global http.https://git.nanodata.cloud/.extraheader "AUTHORIZATION: basic $auth"
git submodule sync --recursive
git submodule update --init --recursive --depth=1
- name: Install Linux dependencies
shell: bash
run: |
set -euo pipefail
if [ -n "${{ matrix.extra_arch }}" ]; then
dpkg --add-architecture "${{ matrix.extra_arch }}"
fi
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y ${{ matrix.packages }}
- name: Build Linux package
shell: bash
run: ./scripts/ci/build-linux-target.sh "${{ matrix.target }}"
- uses: actions/upload-artifact@v4
with:
name: armsx-linux-${{ matrix.target }}
path: artifacts/linux/${{ matrix.target }}/armsx-linux-${{ matrix.target }}.zip
windows:
name: Windows ${{ matrix.target }}
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-24.04
strategy:
fail-fast: false
matrix:
target: [x64, x32]
steps:
- uses: actions/checkout@v4
with:
submodules: false
- name: Fetch submodules with private repo token
shell: bash
env:
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
FSUI_SUBMODULE_TOKEN: ${{ secrets.FSUI_SUBMODULE_TOKEN }}
run: |
set -euo pipefail
token="${GIT_TOKEN:-${FSUI_SUBMODULE_TOKEN:-}}"
if [ -z "$token" ]; then
echo "GIT_TOKEN (or FSUI_SUBMODULE_TOKEN) is required to fetch the private fsui-lib submodule." >&2
exit 1
fi
auth="$(printf 'x-access-token:%s' "$token" | base64 | tr -d '\n')"
git config --global http.https://git.nanodata.cloud/.extraheader "AUTHORIZATION: basic $auth"
git submodule sync --recursive
git submodule update --init --recursive --depth=1
- name: Install MinGW toolchains
shell: bash
run: |
set -euo pipefail
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
binutils-mingw-w64 \
cmake \
git \
gcc-mingw-w64 \
g++-mingw-w64 \
make \
python3 \
python3-jinja2 \
zip
- name: Build Windows package
shell: bash
run: ./scripts/ci/build-windows-cross.sh "${{ matrix.target }}"
- uses: actions/upload-artifact@v4
with:
name: armsx-windows-${{ matrix.target }}
path: artifacts/windows/${{ matrix.target }}/armsx-windows-${{ matrix.target }}.zip
android:
name: Android Debug APK
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: false
- name: Fetch submodules with private repo token
shell: bash
env:
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
FSUI_SUBMODULE_TOKEN: ${{ secrets.FSUI_SUBMODULE_TOKEN }}
run: |
set -euo pipefail
token="${GIT_TOKEN:-${FSUI_SUBMODULE_TOKEN:-}}"
if [ -z "$token" ]; then
echo "GIT_TOKEN (or FSUI_SUBMODULE_TOKEN) is required to fetch the private fsui-lib submodule." >&2
exit 1
fi
auth="$(printf 'x-access-token:%s' "$token" | base64 | tr -d '\n')"
git config --global http.https://git.nanodata.cloud/.extraheader "AUTHORIZATION: basic $auth"
git submodule sync --recursive
git submodule update --init --recursive --depth=1
- name: Install Android build dependencies
shell: bash
run: |
set -euo pipefail
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
cmake \
curl \
git \
make \
ninja-build \
openjdk-17-jdk \
pkg-config \
python3 \
python3-jinja2 \
unzip \
zip
- name: Build Android APK
shell: bash
run: |
set -euo pipefail
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
export PATH="$JAVA_HOME/bin:$PATH"
export ANDROID_HOME="$PWD/.android-sdk"
export ANDROID_SDK_ROOT="$ANDROID_HOME"
mkdir -p "$ANDROID_HOME/cmdline-tools"
curl -fsSL https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -o /tmp/android-cmdline-tools.zip
unzip -q /tmp/android-cmdline-tools.zip -d "$ANDROID_HOME/cmdline-tools"
mv "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest"
export PATH="$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH"
yes | sdkmanager --sdk_root="$ANDROID_HOME" --licenses >/dev/null
sdkmanager --sdk_root="$ANDROID_HOME" \
"build-tools;34.0.0" \
"ndk;27.1.12297006" \
"platform-tools" \
"platforms;android-34"
export ANDROID_NDK_ROOT="$ANDROID_HOME/ndk/27.1.12297006"
export ANDROID_NDK_HOME="$ANDROID_NDK_ROOT"
export NDK_HOME="$ANDROID_NDK_ROOT"
export GRADLE_USER_HOME="$PWD/.gradle-home"
curl -fsSL https://services.gradle.org/distributions/gradle-8.14.3-bin.zip -o /tmp/gradle.zip
unzip -q /tmp/gradle.zip -d "$PWD/.gradle-dist"
export GRADLE_BIN="$PWD/.gradle-dist/gradle-8.14.3/bin/gradle"
./scripts/ci/build-android-all.sh
- uses: actions/upload-artifact@v4
with:
name: armsx-android-debug
path: android/app/build/outputs/apk/debug/app-debug.apk
wasm:
name: WASM
runs-on: ubuntu-latest
container:
image: emscripten/emsdk:3.1.72
steps:
- uses: actions/checkout@v4
with:
submodules: false
- name: Fetch submodules with private repo token
shell: bash
env:
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
FSUI_SUBMODULE_TOKEN: ${{ secrets.FSUI_SUBMODULE_TOKEN }}
run: |
set -euo pipefail
token="${GIT_TOKEN:-${FSUI_SUBMODULE_TOKEN:-}}"
if [ -z "$token" ]; then
echo "GIT_TOKEN (or FSUI_SUBMODULE_TOKEN) is required to fetch the private fsui-lib submodule." >&2
exit 1
fi
auth="$(printf 'x-access-token:%s' "$token" | base64 | tr -d '\n')"
git config --global http.https://git.nanodata.cloud/.extraheader "AUTHORIZATION: basic $auth"
git submodule sync --recursive
git submodule update --init --recursive --depth=1
- name: Install WASM packaging tools
shell: bash
run: |
set -euo pipefail
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-jinja2 zip
- name: Build WebAssembly package
shell: bash
run: |
set -euo pipefail
./build.sh wasm
mkdir -p artifacts/wasm
(
cd bin
zip -r ../artifacts/wasm/armsx-wasm.zip wasm
)
- uses: actions/upload-artifact@v4
with:
name: armsx-wasm
path: artifacts/wasm/armsx-wasm.zip