Skip to content

Commit

Permalink
adapts path; uploading artifact still errors
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaJunge committed Sep 4, 2024
1 parent 7af5cfd commit 621e1e0
Showing 1 changed file with 94 additions and 70 deletions.
164 changes: 94 additions & 70 deletions .github/workflows/build-on-push.yml
Original file line number Diff line number Diff line change
@@ -1,124 +1,149 @@
# Workflow to automatically build and release an Android Plugin with GDExtension capabilities
name: Build ARCore Plugin
on: [push, pull_request]

# Workflow to automatically compile a Android library on commit/push
name: Build on push

# Controls when the action will run. Triggers the workflow on push or pull request
# events, but only for the master branch we'll create .zip files
on:
[push, pull_request]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This job builds the plugin for our target platforms
build:
name: Building for ${{ matrix.platform }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
# I don't think this matrix is needed anymore...
- os: ubuntu-20.04
platform: android
name: Building for Android (Ubuntu 20.04)
runs-on: ubuntu-20.04

# Note, to satisfy the asset library we need to make sure our zip files have a root folder
# this is why we checkout into repo and build into asset

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Setup actions
uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Setup java
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'adopt'
- name: Checkout repository
uses: actions/checkout@v2
with:
path: repo
submodules: "recursive"

#- name: Setup Godot build cache
# uses: ./repo/godot-cpp/.github/actions/godot-cache-restore # TODO: CREATE THIS
# with:
# cache-name: godot-cpp-cache
# continue-on-error: true

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: "adopt"

- name: Setup Android NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r23c
link-to-sdk: true

- name: Install SCons
run: |
python -m pip install scons==4.0.0
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.8 #install the python needed

# for android, run generate bindings python script
- name: Generate bindings (Android)
run: |
cd $GITHUB_WORKSPACE/godot-cpp
scons platform=android target=template_debug
scons platform=android target=template_release
if: matrix.platform == 'android'

- name: Run the build for godot_arcore
run: |
cd $GITHUB_WORKSPACE
./gradlew :assemble
- name: tree
run: tree -L 2 && ls -alh $GITHUB_WORKSPACE/repo/plugin/

- name: Create libgodot-cpp Android templates
run: |
cd $GITHUB_WORKSPACE/repo/godot-cpp
scons platform=android target=template_debug arch=arm64
scons platform=android target=template_release arch=arm64
cd $GITHUB_WORKSPACE
- name: Assemble the plugin
run: |
cd $GITHUB_WORKSPACE/repo
./gradlew assemble
- name: List files for debugging
run: ls -alh $GITHUB_WORKSPACE/repo/plugin/build/outputs/aar

- name: Upload build files
uses: actions/upload-artifact@v4
with:
name: arcore-build
path: $GITHUB_WORKSPACE/repo/plugin/build/outputs/aar/ARCorePlugin*.aar

# This job collects the build output and assembles the final asset (artifact)
asset:
name: Assembling the asset (artifact)
release:
if: github.event.name == 'push' && (github.ref == 'refs/head/master' || startsWith(github.ref, 'refs/tags'))
name: Assembling the asset
runs-on: ubuntu-20.04
needs: build
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags'))

# Steps represent a sequence of tasks that will be executed as part of the job

steps:
- uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2
with:
repository: 'GodotVR/godot_arcore'
repository: "GodotVR/godot_arcore"
path: godot_arcore

- name: Download all workflow run artifacts
uses: actions/download-artifact@v2

#- name: Copy files to destination
# run: |
# mkdir godot_arcore_plugin
# mkdir godot_arcore_plugin/addons
# mkdir godot_arcore_plugin/android
# mkdir godot_arcore_plugin/android/plugins
# cp -r godot_arcore/demo/addons/godot_arcore godot_arcore_plugin/addons
# cp build-files-arcore/*.aar godot_arcore_plugin/android/plugins/
# cp build-files-arcore/gdarcore.gdap godot_arcore_plugin/android/plugins/godot_openxr.gdap
# cp -r godot_arcore/demo/addons/ARCorePlugin godot_arcore_plugin/addons
# cp arcore-build/*.aar godot_arcore_plugin/android/plugins/

- name: Calculate GIT short ref
if: github.ref == 'refs/heads/master'
run: |
cd godot_arcore
cd $GITHUB_WORKSPACE/repo/godot_arcore
echo "GITHUB_SHA_SHORT=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
cd ..
if: github.ref == 'refs/heads/master'
cd $GITHUB_WORKSPACE
- name: Get tag name
if: startsWith(github.ref, 'refs/tags')
run: |
echo "GITHUB_SHA_SHORT=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags')
- name: Clean up extracted files
- name: Clean up extracted files # TODO: Check what to clean here
run: |
rm -rf build-files-arcore
rm -rf arcore-build
rm -rf godot_arcore
rm -rf .git
mv godot_arcore_plugin godot_arcore_${{ env.GITHUB_SHA_SHORT }}
- name: Zip asset
run: |
zip -qq -r godot_arcore.zip .
- name: Create and upload asset
if: startsWith(github.ref, 'refs/tags')
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "godot_arcore.zip"
body: "New release!"
body: "Godot ARCore has a new release!"
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
if: startsWith(github.ref, 'refs/tags')

- name: Create release for asset
if: github.ref == 'refs/heads/master'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GITHUB_SHA_SHORT }}
release_name: Automatic build for changeset ${{ env.GITHUB_SHA_SHORT }}
body: |
This is an automated build for changeset ${{ env.GITHUB_SHA_SHORT }}
body: "This is an automated build for changeset ${{ env.GITHUB_SHA_SHORT }}"
draft: false
prerelease: true
if: github.ref == 'refs/heads/master'
- name: Upload asset
if: github.ref == 'refs/heads/master'
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
Expand All @@ -128,4 +153,3 @@ jobs:
asset_path: ./godot_arcore.zip
asset_name: godot_arcore.zip
asset_content_type: application/zip
if: github.ref == 'refs/heads/master'

0 comments on commit 621e1e0

Please sign in to comment.