Skip to content

Commit

Permalink
Update github workflow
Browse files Browse the repository at this point in the history
- Update scons to 4.x
- Bump github action versions to eliminate node 12 deprecation warning.
  v4 of the asset actions contains breaking changes, so I stopped at v3
  for now.
- Combine build steps to be platform-agnostic where possible.
- Remove dead macOS config
- Add TODOs for outstanding tech debt
  • Loading branch information
vilhalmer committed Apr 24, 2024
1 parent af07c5f commit 71dc283
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 62 deletions.
86 changes: 25 additions & 61 deletions .github/workflows/build-on-push.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@

# Workflow to automatically compile a Linux/Windows/OSX library on commit/push
name: Build on push

# TODO: Update asset actions from v3 to v4. There are breaking changes, need to verify that our config will still work.
# TODO: Add mingw to matrix

# 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]
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.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -21,81 +19,47 @@ jobs:
platform: linux
- os: windows-latest
platform: windows
# - os: macOS-latest
# platform: osx

# 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
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
submodules: 'recursive'

- name: Install scons (Ubuntu)
run: |
sudo apt install scons
if: matrix.os == 'ubuntu-20.04'
- name: Set up Python (for SCons)
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install scons (Windows)
- name: Install scons
run: |
pip install scons
if: matrix.os == 'windows-latest'

# - name: Install scons (macOS)
# run: |
# brew install scons
# if: matrix.os == 'macos-latest'
python -m pip install scons~=4.0
- name: Run the build for godot-cpp
run: |
cd $GITHUB_WORKSPACE/godot-cpp
scons platform=${{ matrix.platform }} -j2 target=release generate_bindings=yes bits=64
if: matrix.os != 'windows-latest'
scons -C godot-cpp platform=${{ matrix.platform }} -j2 target=release generate_bindings=yes bits=64
- name: Run the build for godot_openvr
run: |
cd $GITHUB_WORKSPACE
scons platform=${{ matrix.platform }} -j2 target=release bits=64
if: matrix.os != 'windows-latest'

- name: Run the build for godot-cpp (Windows)
run: |
cd ${env:GITHUB_WORKSPACE}/godot-cpp
scons platform=${{ matrix.platform }} -j2 target=release generate_bindings=yes bits=64
if: matrix.os == 'windows-latest'

- name: Run the build for godot_openvr (Windows)
run: |
cd ${env:GITHUB_WORKSPACE}
scons platform=${{ matrix.platform }} -j2 target=release bits=64
if: matrix.os == 'windows-latest'
- name: Upload build files (artifacts) (Linux)
uses: actions/upload-artifact@v2
- name: Upload build files (artifacts) (Linux)
uses: actions/upload-artifact@v3
with:
name: build-files-linux
path: |
demo/addons/godot-openvr/bin/x11/libgodot_openvr.so
openvr/bin/linux64/libopenvr_api.so
if: matrix.os == 'ubuntu-20.04'

# - name: Upload build files (artifacts) (macOS)
# uses: actions/upload-artifact@v2
# with:
# name: build-files-macos
# path: |
# demo/addons/godot-openvr/bin/osx/libgodot_openvr.dylib
# openvr/bin/osx32/OpenVR.framework
# if: matrix.os == 'macos-latest'

- name: Upload build files (artifacts) (Windows)
uses: actions/upload-artifact@v2
- name: Upload build files (artifacts) (Windows)
uses: actions/upload-artifact@v3
with:
name: build-files-windows
path: |
demo/addons/godot-openvr/bin/win64/libgodot_openvr.dll
openvr/bin/win64/openvr_api.dll
if: matrix.os == 'windows-latest'

# This job collects the build output and assembles the final asset (artifact)
asset:
name: Assembling the asset (artifact)
Expand All @@ -105,21 +69,19 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: 'GodotVR/godot_openvr'
path: godot_openvr
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
- name: Copy files to destination
run: |
mkdir godot_openvr_plugin
mkdir godot_openvr_plugin/addons
cp -r godot_openvr/demo/addons/godot-openvr godot_openvr_plugin/addons
cp build-files-linux/demo/addons/godot-openvr/bin/x11/libgodot_openvr.so godot_openvr_plugin/addons/godot-openvr/bin/x11/libgodot_openvr.so
cp build-files-linux/openvr/bin/linux64/libopenvr_api.so godot_openvr_plugin/addons/godot-openvr/bin/x11/libopenvr_api.so
# cp build-files-macos/demo/addons/godot-openvr/bin/osx/libgodot_openvr.dylib godot_openvr_plugin/addons/godot-openvr/bin/osx/libgodot_openvr.dylib
# cp -r build-files-macos/openvr/bin/osx32/OpenVR.framework godot_openvr_plugin/addons/godot-openvr/bin/osx/OpenVR.framework
cp build-files-windows/demo/addons/godot-openvr/bin/win64/libgodot_openvr.dll godot_openvr_plugin/addons/godot-openvr/bin/win64/libgodot_openvr.dll
cp build-files-windows/openvr/bin/win64/openvr_api.dll godot_openvr_plugin/addons/godot-openvr/bin/win64/openvr_api.dll
- name: Calculate GIT short ref
Expand All @@ -135,7 +97,6 @@ jobs:
- name: Clean up extracted files
run: |
rm -rf build-files-linux
#rm -rf build-files-macos
rm -rf build-files-windows
rm -rf godot_openvr
mv godot_openvr_plugin godot_openvr_${{ env.GITHUB_SHA_SHORT }}
Expand All @@ -151,6 +112,9 @@ jobs:
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
if: startsWith(github.ref, 'refs/tags')

# TODO: Both create-release and upload-release-asset are abandonded, need to port to maintained replacements. Both suggest replacements in their README.

- name: Create release for asset
id: create_release
uses: actions/create-release@v1
Expand All @@ -165,12 +129,12 @@ jobs:
prerelease: true
if: github.ref == 'refs/heads/master'
- name: Upload asset
id: upload-release-asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./godot-openvr.zip
asset_name: godot-openvr.zip
asset_content_type: application/zip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install dependencies
run: |
Expand Down

0 comments on commit 71dc283

Please sign in to comment.