Skip to content

Support two macOS GitHub Actions runner images #74

Support two macOS GitHub Actions runner images

Support two macOS GitHub Actions runner images #74

Workflow file for this run

name: 'Android'
env:
LIBRARIES_BRANCH: libraries-OS-COMPILER
NCINE_SOURCE_BRANCH: BRANCH_NAME
DEPLOY_MESSAGE:
"Push artifact from GitHub Actions build ${{ github.run_number }} with id ${{ github.run_id }}
- PROJECT_NAME artifact from branch 'BRANCH_NAME' with commit id ${{ github.sha }}"
on: [push, workflow_dispatch]
jobs:
Android:
strategy:
fail-fast: false
matrix:
ARCH: [armeabi-v7a, arm64-v8a, x86_64]
BuildType: [Debug, Release]
runs-on: 'ubuntu-22.04'
steps:
- name: 'Checkout Code'
uses: actions/checkout@v4
- name: 'Install nCine Build Dependencies'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev
- name: 'Unshallow Git Repository for Versioning'
run: |
git fetch --unshallow || true
- name: 'Download nCine-libraries and project data'
run: |
export OS=linux
export CC=gcc
export BRANCH_NAME=$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)
export LIBRARIES_BRANCH=`echo $LIBRARIES_BRANCH | sed 's/OS/'"$OS"'/'`
export LIBRARIES_BRANCH=`echo $LIBRARIES_BRANCH | sed 's/COMPILER/'"$CC"'/'`
cd ..
git clone https://github.com/nCine/nCine-libraries-artifacts.git
cd nCine-libraries-artifacts
git checkout $LIBRARIES_BRANCH
LIBRARIES_FILE=$(ls -t | head -n 1) && tar xpzf $LIBRARIES_FILE
mv nCine-external ..
git checkout android-libraries-armeabi-v7a
LIBRARIES_FILE=$(ls -t | head -n 1) && tar xpzf $LIBRARIES_FILE
git checkout android-libraries-arm64-v8a
LIBRARIES_FILE=$(ls -t | head -n 1) && tar xpzf $LIBRARIES_FILE
git checkout android-libraries-x86_64
LIBRARIES_FILE=$(ls -t | head -n 1) && tar xpzf $LIBRARIES_FILE
mv nCine-android-external ..
cd ..
rm -rf nCine-libraries-artifacts
git clone https://github.com/$GITHUB_REPOSITORY-data.git
- name: 'Download nCine source and data'
run: |
export BRANCH_NAME=$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)
export NCINE_SOURCE_BRANCH=`echo $NCINE_SOURCE_BRANCH | sed 's/BRANCH_NAME/'"$BRANCH_NAME"'/'`
cd ..
git clone https://github.com/nCine/nCine-data.git
git clone https://github.com/nCine/nCine.git --branch $NCINE_SOURCE_BRANCH
- name: 'CMake Configuration and Make of nCine as a static library'
run: |
cd ../nCine
export CMAKE_ARGS=" -B ../nCine-build-${{ matrix.BuildType }} -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }} -D NCINE_DYNAMIC_LIBRARY=OFF -D IMGUI_VERSION_TAG=docking -D NCINE_WITH_THREADS=OFF -D NCINE_WITH_WEBP=OFF -D NCINE_WITH_AUDIO=OFF -D NCINE_WITH_SCRIPTING_API=OFF -D NCINE_BUILD_TESTS=OFF -D NCINE_BUILD_ANDROID=ON -D NCINE_NDK_ARCHITECTURES=${{ matrix.ARCH }} -D CMAKE_PREFIX_PATH=$(pwd)/../nCine-external"
cmake $CMAKE_ARGS
cd ..
make -j2 -C nCine-build-${{ matrix.BuildType }}
- name: 'CMake Configuration'
run: |
export PROJECT_NAME=${GITHUB_REPOSITORY##*/}
cmake -B ../$PROJECT_NAME-build-${{ matrix.BuildType }} -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }} -D NCPROJECT_NDK_ARCHITECTURES=${{ matrix.ARCH }} -D NCPROJECT_BUILD_ANDROID=ON -D NCPROJECT_ASSEMBLE_APK=ON -D nCine_DIR=$(pwd)/../nCine-build-${{ matrix.BuildType }} -D CMAKE_PREFIX_PATH=$(pwd)/../nCine-external
- name: 'Gradle Assemble'
run: |
export JAVA_HOME=$JAVA_HOME_17_X64
export PROJECT_NAME=${GITHUB_REPOSITORY##*/}
cd ../$PROJECT_NAME-build-${{ matrix.BuildType }}/android
gradle assemble${{ matrix.BuildType }}
- name: 'Push Artifacts'
env:
PUBLIC_REPO_TOKEN: ${{ secrets.PUBLIC_REPO_TOKEN }}
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
export PROJECT_NAME=${GITHUB_REPOSITORY##*/}
export BRANCH_NAME=$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)
export DEPLOY_MESSAGE=`sed 's/PROJECT_NAME/'"$PROJECT_NAME"'/' <<< "$DEPLOY_MESSAGE"`
export DEPLOY_MESSAGE=`sed 's/BRANCH_NAME/'"$BRANCH_NAME"'/' <<< "$DEPLOY_MESSAGE"`
cd ..
export DEPLOY_BRANCH=$PROJECT_NAME-$BRANCH_NAME-android-${{ matrix.ARCH }}-${{ matrix.BuildType }}
git clone https://$PUBLIC_REPO_TOKEN@github.com/$GITHUB_REPOSITORY-artifacts.git >/dev/null 2>&1
cd $PROJECT_NAME-artifacts
git checkout $DEPLOY_BRANCH || git checkout --orphan $DEPLOY_BRANCH
git reset
git clean -f
git rm * || true
mv -f ../$PROJECT_NAME-build-${{ matrix.BuildType }}/android/app/build/outputs/apk/*/*.apk .
git add *.apk
git commit --amend -m "$DEPLOY_MESSAGE" || git commit -m "$DEPLOY_MESSAGE"
git push --force || git push --set-upstream origin $DEPLOY_BRANCH