-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from BastiaanOlij/add_ci
Add CI to build extension
- Loading branch information
Showing
2 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
# Workflow to automatically compile a Linux/Windows 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: | ||
- name: 🐧 Linux (GCC) | ||
os: ubuntu-20.04 | ||
platform: linux | ||
artifact-name: gdxrreference.linux | ||
artifact-path: demo/addons/godot_xr_reference/bin/libgdxrreference.linux.* | ||
|
||
- name: 🏁 Windows (x86_64, MSVC) | ||
os: windows-2019 | ||
platform: windows | ||
artifact-name: gdxrreference.windows | ||
artifact-path: demo/addons/godot_xr_reference/bin/libgdxrreference.windows.* | ||
|
||
- name: 🍎 macOS (universal) | ||
os: macos-11 | ||
platform: macos | ||
flags: arch=universal | ||
artifact-name: gdxrreference.macos | ||
artifact-path: demo/addons/godot_xr_reference/bin/libgdxrreference.macos.* | ||
|
||
- name: 🤖 Android (arm64) | ||
os: ubuntu-20.04 | ||
platform: android | ||
flags: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME arch=arm64 | ||
artifact-name: gdxrreference.android | ||
artifact-path: demo/addons/godot_xr_reference/bin/libgdxrreference.android.* | ||
|
||
- name: 🍏 iOS (arm64) | ||
os: macos-11 | ||
platform: ios | ||
flags: arch=arm64 | ||
artifact-name: gdxrreference.ios | ||
artifact-path: demo/addons/godot_xr_reference/bin/libgdxrreference.ios.* | ||
|
||
# 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@v3 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Set up Python (for SCons) | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Linux dependencies | ||
if: ${{ matrix.platform == 'linux' }} | ||
run: | | ||
sudo apt-get update -qq | ||
sudo apt-get install -qqq build-essential pkg-config | ||
- name: Install scons | ||
run: | | ||
python -m pip install scons==4.0.0 | ||
- name: Build debug build | ||
run: | | ||
scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }} | ||
- name: Build release build | ||
run: | | ||
scons platform=${{ matrix.platform }} target=template_release ${{ matrix.flags }} | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.artifact-name }} | ||
path: ${{ matrix.artifact-path }} | ||
if-no-files-found: error | ||
|
||
# This job collects the build output and assembles the final asset (artifact) | ||
asset: | ||
name: Assembling the asset (artifact) | ||
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: | ||
- name: Setup actions | ||
uses: actions/checkout@v3 | ||
with: | ||
path: source | ||
- name: Download all workflow run artifacts | ||
uses: actions/download-artifact@v3 | ||
- name: Copy files to destination | ||
run: | | ||
mkdir plugin | ||
mkdir plugin/addons | ||
cp -r source/demo/addons/godot_xr_reference plugin/addons | ||
cp gdxrreference.linux/*.so plugin/addons/godot_xr_reference/bin/ | ||
cp gdxrreference.windows/*.dll plugin/addons/godot_xr_reference/bin/ | ||
cp gdxrreference.android/*.so plugin/addons/godot_xr_reference/bin/ | ||
cp gdxrreference.ios/*.dylib plugin/addons/godot_xr_reference/bin/ | ||
cp -R gdxrreference.macos/libgdxrreference.macos.* plugin/addons/godot_xr_reference/bin/ | ||
- name: Calculate GIT short ref | ||
run: | | ||
cd source | ||
echo "GITHUB_SHA_SHORT=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV | ||
cd .. | ||
if: github.ref == 'refs/heads/master' | ||
- name: Get tag name | ||
run: | | ||
echo "GITHUB_SHA_SHORT=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV | ||
if: startsWith(github.ref, 'refs/tags') | ||
- name: Clean up extracted files | ||
run: | | ||
rm -rf gdxrreference.linux | ||
rm -rf gdxrreference.windows | ||
rm -rf gdxrreference.android | ||
rm -rf gdxrreference.macos | ||
rm -rf gdxrreference.ios | ||
rm -rf source | ||
rm -rf .git | ||
mv plugin gdxrreference_${{ env.GITHUB_SHA_SHORT }} | ||
- name: Zip asset | ||
run: | | ||
zip -qq -r gdxrreference.zip . | ||
- name: Create and upload asset | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
allowUpdates: true | ||
artifacts: "gdxrreference.zip" | ||
omitNameDuringUpdate: true | ||
omitBodyDuringUpdate: true | ||
omitPrereleaseDuringUpdate : true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
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