[ANDROID] Second try to fix build #633
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Auto build Box86 and release its binary with Github Action | |
name: Build and Release Box86 | |
on: | |
workflow_dispatch: | |
release: | |
push: | |
paths: | |
- "**/*.c" | |
- "**/*.h" | |
- "**/*.S" | |
- "**/*.py" | |
- "CMakeLists.txt" | |
- "**/*.yml" | |
pull_request: | |
types: [assigned, opened, synchronize, reopened] | |
paths: | |
- "**/*.c" | |
- "**/*.h" | |
- "**/*.S" | |
- "**/*.py" | |
- "CMakeLists.txt" | |
- "**/*.yml" | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [I386, OTHER_ARM, PANDORA, PYRA, GAMESHELL, RPI4, RPI4ARM64, ODROID, RK3399, RK3288, A64, SD845, SD888, ADLINK, PHYTIUM, ANDROID] | |
type: [Release, Trace] | |
os: [ubuntu-latest] | |
include: | |
- platform: TEGRAX1 | |
type: Release | |
os: ubuntu-20.04 | |
- platform: TEGRAX1 | |
type: Trace | |
os: ubuntu-20.04 | |
- platform: TEGRAX1ARM32 | |
type: Release | |
os: ubuntu-20.04 | |
- platform: TEGRAX1ARM32 | |
type: Trace | |
os: ubuntu-20.04 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: "Checkout Box86 Repository" | |
uses: actions/checkout@v3 | |
- name: "Environment preparation" | |
run: | | |
sudo apt-get update | |
if [[ ${{ matrix.platform }} != 'I386' && ${{ matrix.platform }} != 'OTHER_ARM' ]]; then | |
sudo apt-get -y install git cmake make python3 | |
if [[ ${{ matrix.platform }} == 'ANDROID' ]]; then | |
wget https://dl.google.com/android/repository/android-ndk-r23b-linux.zip | |
unzip android-ndk-r23b-linux.zip | |
echo "BOX86_COMPILER=$PWD/android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi31-clang" >> $GITHUB_ENV | |
echo "BOX86_PLATFORM_MARCRO=-DANDROID=1 -DARM_DYNAREC=ON -DNOLOADADDR=1" >> $GITHUB_ENV | |
else | |
sudo apt-get -y install gcc-arm-linux-gnueabihf | |
echo "BOX86_COMPILER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV | |
echo "BOX86_PLATFORM_MARCRO=-D${{ matrix.platform }}=1" >> $GITHUB_ENV | |
fi | |
else | |
if [[ ${{ matrix.platform }} == 'I386' ]]; then | |
echo "BOX86_PLATFORM_MARCRO=-DLD80BITS=1 -DNOALIGN=1" >> $GITHUB_ENV | |
echo "BOX86_COMPILER=/bin/i686-linux-gnu-gcc-10" >> $GITHUB_ENV | |
sudo apt-get -y install git libc6-dev-i386-amd64-cross gcc-10-i686-linux-gnu cmake make python3 | |
else | |
echo BOX86_PLATFORM_MARCRO="-DARM_DYNAREC=ON -DCMAKE_C_FLAGS=-marm" >> $GITHUB_ENV | |
echo "BOX86_COMPILER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV | |
sudo apt-get -y install git gcc-arm-linux-gnueabihf cmake make python3 | |
fi | |
fi | |
if [[ ${{ matrix.type }} == 'Release' ]]; then | |
echo BOX86_BUILD_TYPE=Release >> $GITHUB_ENV | |
echo BOX86_HAVE_TRACE=0 >> $GITHUB_ENV | |
else | |
echo BOX86_BUILD_TYPE=RelWithDebInfo >> $GITHUB_ENV | |
echo BOX86_HAVE_TRACE=1 >> $GITHUB_ENV | |
fi | |
- name: "Display Build info" | |
run: | | |
echo "CMake Platform Macro: ${{ env.BOX86_PLATFORM_MARCRO }}" | |
echo "CMake C Compiler: ${{ env.BOX86_COMPILER }}" | |
echo "Build type: ${{ env.BOX86_BUILD_TYPE }}" | |
echo "Trace Enabled: ${{ env.BOX86_HAVE_TRACE }}" | |
- name: "Build Box86" | |
run: | | |
mkdir build | |
cd build | |
cmake .. -DCMAKE_C_COMPILER=${{ env.BOX86_COMPILER }}\ | |
${{ env.BOX86_PLATFORM_MARCRO }}\ | |
-DCMAKE_BUILD_TYPE=${{ env.BOX86_BUILD_TYPE }}\ | |
-DHAVE_TRACE=${{ env.BOX86_HAVE_TRACE }}\ | |
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON | |
make -j$(nproc) VERBOSE=1 | |
- name: "Test Box86" | |
if: ${{ matrix.platform == 'I386' }} | |
run: | | |
cd build | |
ctest -j$(nproc) | |
- name: "Upload Artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: box86-${{ matrix.platform }}-${{ matrix.type }} | |
path: build/box86 | |