Skip to content

Merge pull request #68 from patrickdown/add_logging_flag #147

Merge pull request #68 from patrickdown/add_logging_flag

Merge pull request #68 from patrickdown/add_logging_flag #147

Workflow file for this run

# 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 main 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:
# Unsupported platforms are commented out.
#- name: 🐧 Linux (GCC)
# os: ubuntu-20.04
# platform: linux
# artifact-name: gdtiltfive.linux
# artifact-path: build/bin/libgdtiltfive.linux.*
- name: 🏁 Windows (x86_64, MSVC)
os: windows-2019
platform: windows
artifact-name: gdtiltfive.windows
artifact-path: |
build/bin/libgdtiltfive.windows.template_debug.x86_64.dll
build/bin/libgdtiltfive.windows.template_release.x86_64.dll
extension/TiltFiveNDK/lib/win/x86_64/TiltFiveNative.dll
#- name: 🍎 macOS (universal)
# os: macos-11
# platform: macos
# flags: arch=universal
# artifact-name: gdtiltfive.macos
# artifact-path: build/bin/libgdtiltfive.macos.*
#- name: πŸ€– Android (arm64)
# os: ubuntu-20.04
# platform: android
# flags: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME arch=arm64
# artifact-name: gdtiltfive.android
# artifact-path: build/bin/libgdtiltfive.android.*
#- name: 🍏 iOS (arm64)
# os: macos-11
# platform: ios
# flags: arch=arm64
# artifact-name: gdtiltfive.ios
# artifact-path: build/bin/libgdtiltfive.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
permissions:
contents: write
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || 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 for gdscript
run: |
mkdir plugin
mkdir plugin/addons
cp -r source/example.gd/addons/tiltfive plugin/addons
cp source/LICENSE.txt plugin/addons/tiltfive
cp source/CONTRIBUTORS.md plugin/addons/tiltfive
cp source/CHANGES.md plugin/addons/tiltfive
mkdir plugin/addons/tiltfive/bin
# cp gdtiltfive.linux/*.so plugin/addons/tiltfive/bin/
cp gdtiltfive.windows/build/bin/*.dll plugin/addons/tiltfive/bin/
cp gdtiltfive.windows/extension/TiltFiveNDK/lib/win/x86_64/*.dll plugin/addons/tiltfive/bin/
# cp gdtiltfive.android/*.so plugin/addons/tiltfive/bin/
# cp gdtiltfive.ios/*.dylib plugin/addons/tiltfive/bin/
# cp -R gdtiltfive.macos/libgdtiltfive.macos.* plugin/addons/tiltfive/bin/
- name: Copy files to destination for csharp
run: |
mkdir plugin_cs
mkdir plugin_cs/addons
cp -r source/example.csharp/addons/tiltfive plugin_cs/addons
cp source/LICENSE.txt plugin_cs/addons/tiltfive
cp source/CONTRIBUTORS.md plugin_cs/addons/tiltfive
cp source/CHANGES.md plugin_cs/addons/tiltfive
mkdir plugin_cs/addons/tiltfive/bin
# cp gdtiltfive.linux/*.so plugin_cs/addons/tiltfive/bin/
cp gdtiltfive.windows/build/bin/*.dll plugin_cs/addons/tiltfive/bin/
cp gdtiltfive.windows/extension/TiltFiveNDK/lib/win/x86_64/*.dll plugin_cs/addons/tiltfive/bin/
# cp gdtiltfive.android/*.so plugin_cs/addons/tiltfive/bin/
# cp gdtiltfive.ios/*.dylib plugin_cs/addons/tiltfive/bin/
# cp -R gdtiltfive.macos/libgdtiltfive.macos.* plugin_cs/addons/tiltfive/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/main'
- 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 gdtiltfive.linux
rm -rf gdtiltfive.windows
# rm -rf gdtiltfive.android
# rm -rf gdtiltfive.macos
# rm -rf gdtiltfive.ios
rm -rf source
rm -rf .git
mv plugin gdtiltfive_${{ env.GITHUB_SHA_SHORT }}
mv plugin_cs gdtiltfive_cs_${{ env.GITHUB_SHA_SHORT }}
- name: Zip asset
run: |
zip -qq -r gdtiltfive_gdscript.zip gdtiltfive_${{ env.GITHUB_SHA_SHORT }}
zip -qq -r gdtiltfive_csharp.zip gdtiltfive_cs_${{ env.GITHUB_SHA_SHORT }}
- name: Create and upload asset
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "gdtiltfive_gdscript.zip, gdtiltfive_csharp.zip"
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate : true
token: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')