1-
2- # Workflow to automatically compile a Linux/Windows/OSX library on commit/push
31name : Build on push
42
3+ # TODO: Add mingw to matrix
4+
55# Controls when the action will run. Triggers the workflow on push or pull request
66# events, but only for the master branch we'll create .zip files
7- on :
8- [push, pull_request]
7+ on : [push, pull_request]
98
10- # A workflow run is made up of one or more jobs that can run sequentially or in parallel
119jobs :
12- # This job builds the plugin for our target platforms
1310 build :
1411 name : Building for ${{ matrix.os }}
1512 runs-on : ${{ matrix.os }}
@@ -21,107 +18,74 @@ jobs:
2118 platform : linux
2219 - os : windows-latest
2320 platform : windows
24- # - os: macOS-latest
25- # platform: osx
2621
27- # Steps represent a sequence of tasks that will be executed as part of the job
2822 steps :
29- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
30- - uses : actions/checkout@v2
23+ - uses : actions/checkout@v4
3124 with :
32- submodules : ' recursive'
25+ submodules : ' recursive'
3326
34- - name : Install scons (Ubuntu)
27+ - name : Install dependencies (Ubuntu)
3528 run : |
36- sudo apt install scons
37- if : matrix.os == 'ubuntu-20.04'
29+ sudo apt-get update -qq
30+ sudo apt-get install -qqq build-essential pkg-config
31+ if : matrix.platform == 'linux'
3832
39- - name : Install scons (Windows )
40- run : |
41- pip install scons
42- if : matrix.os == 'windows-latest '
33+ - name : Set up Python (for SCons )
34+ uses : actions/setup-python@v5
35+ with :
36+ python-version : ' 3.x '
4337
44- # - name: Install scons (macOS)
45- # run: |
46- # brew install scons
47- # if: matrix.os == 'macos-latest'
38+ - name : Install scons
39+ run : |
40+ python -m pip install scons~=4.0
4841
4942 - name : Run the build for godot-cpp
5043 run : |
51- cd $GITHUB_WORKSPACE/godot-cpp
52- scons platform=${{ matrix.platform }} -j2 target=release generate_bindings=yes bits=64
53- if : matrix.os != 'windows-latest'
44+ scons -C godot-cpp platform=${{ matrix.platform }} -j2 target=template_release generate_bindings=yes bits=64
5445
5546 - name : Run the build for godot_openvr
5647 run : |
57- cd $GITHUB_WORKSPACE
5848 scons platform=${{ matrix.platform }} -j2 target=release bits=64
59- if : matrix.os != 'windows-latest'
60-
61- - name : Run the build for godot-cpp (Windows)
62- run : |
63- cd ${env:GITHUB_WORKSPACE}/godot-cpp
64- scons platform=${{ matrix.platform }} -j2 target=release generate_bindings=yes bits=64
65- if : matrix.os == 'windows-latest'
6649
67- - name : Run the build for godot_openvr (Windows)
68- run : |
69- cd ${env:GITHUB_WORKSPACE}
70- scons platform=${{ matrix.platform }} -j2 target=release bits=64
71- if : matrix.os == 'windows-latest'
72-
73- - name : Upload build files (artifacts) (Linux)
74- uses : actions/upload-artifact@v2
50+ # There's no option to preserve the path structure on the upload action, so we just
51+ # treat each asset as its respective bin/ subfolder and put it in the right place in
52+ # the next job. The names are important, they become the platform names.
53+ # https://github.com/actions/upload-artifact/issues/174
54+ - name : Upload Windows build results
55+ uses : actions/upload-artifact@v4
7556 with :
76- name : build-files-linux
77- path : |
78- demo/addons/godot-openvr/bin/x11/libgodot_openvr.so
79- openvr/bin/linux64/libopenvr_api.so
80- if : matrix.os == 'ubuntu-20.04'
57+ name : x11
58+ path : demo/addons/godot-openvr/bin/x11/
59+ if : matrix.platform == 'linux'
8160
82- # - name: Upload build files (artifacts) (macOS)
83- # uses: actions/upload-artifact@v2
84- # with:
85- # name: build-files-macos
86- # path: |
87- # demo/addons/godot-openvr/bin/osx/libgodot_openvr.dylib
88- # openvr/bin/osx32/OpenVR.framework
89- # if: matrix.os == 'macos-latest'
90-
91- - name : Upload build files (artifacts) (Windows)
92- uses : actions/upload-artifact@v2
61+ - name : Upload Linux build results
62+ uses : actions/upload-artifact@v4
9363 with :
94- name : build-files-windows
95- path : |
96- demo/addons/godot-openvr/bin/win64/libgodot_openvr.dll
97- openvr/bin/win64/openvr_api.dll
98- if : matrix.os == 'windows-latest'
64+ name : win64
65+ path : demo/addons/godot-openvr/bin/win64/
66+ if : matrix.platform == 'windows'
67+
9968 # This job collects the build output and assembles the final asset (artifact)
10069 asset :
101- name : Assembling the asset (artifact)
70+ name : Assemble release bundle
10271 runs-on : ubuntu-20.04
10372 needs : build
10473 if : github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags'))
10574
10675 # Steps represent a sequence of tasks that will be executed as part of the job
10776 steps :
108- - uses : actions/checkout@v2
77+ - uses : actions/checkout@v4
10978 with :
110- repository : ' GodotVR/godot_openvr '
79+ # Giving an explicit path prevents an automatic cd into the checkout.
11180 path : godot_openvr
112- - name : Download all workflow run artifacts
113- uses : actions/download-artifact@v2
114- - name : Copy files to destination
81+ - name : Create destination and populate addon resources
11582 run : |
116- mkdir godot_openvr_plugin
117- mkdir godot_openvr_plugin/addons
118- cp -r godot_openvr/demo/addons/godot-openvr godot_openvr_plugin/addons
119- cp build-files-linux/demo/addons/godot-openvr/bin/x11/libgodot_openvr.so godot_openvr_plugin/addons/godot-openvr/bin/x11/libgodot_openvr.so
120- cp build-files-linux/openvr/bin/linux64/libopenvr_api.so godot_openvr_plugin/addons/godot-openvr/bin/x11/libopenvr_api.so
121- # cp build-files-macos/demo/addons/godot-openvr/bin/osx/libgodot_openvr.dylib godot_openvr_plugin/addons/godot-openvr/bin/osx/libgodot_openvr.dylib
122- # cp -r build-files-macos/openvr/bin/osx32/OpenVR.framework godot_openvr_plugin/addons/godot-openvr/bin/osx/OpenVR.framework
123- cp build-files-windows/demo/addons/godot-openvr/bin/win64/libgodot_openvr.dll godot_openvr_plugin/addons/godot-openvr/bin/win64/libgodot_openvr.dll
124- cp build-files-windows/openvr/bin/win64/openvr_api.dll godot_openvr_plugin/addons/godot-openvr/bin/win64/openvr_api.dll
83+ mkdir -p godot_openvr_plugin/addons
84+ cp -r godot_openvr/demo/addons/godot-openvr godot_openvr_plugin/addons/
85+ - name : Download per-platform binaries into addon
86+ uses : actions/download-artifact@v4
87+ with :
88+ path : godot_openvr_plugin/addons/godot-openvr/bin/
12589 - name : Calculate GIT short ref
12690 run : |
12791 cd godot_openvr
13498 if : startsWith(github.ref, 'refs/tags')
13599 - name : Clean up extracted files
136100 run : |
137- rm -rf build-files-linux
138- #rm -rf build-files-macos
139- rm -rf build-files-windows
140101 rm -rf godot_openvr
141102 mv godot_openvr_plugin godot_openvr_${{ env.GITHUB_SHA_SHORT }}
142103 - name : Zip asset
@@ -151,6 +112,9 @@ jobs:
151112 prerelease : false
152113 token : ${{ secrets.GITHUB_TOKEN }}
153114 if : startsWith(github.ref, 'refs/tags')
115+
116+ # TODO: Both create-release and upload-release-asset are abandonded, need to port to maintained replacements. Both suggest replacements in their README.
117+
154118 - name : Create release for asset
155119 id : create_release
156120 uses : actions/create-release@v1
@@ -165,12 +129,12 @@ jobs:
165129 prerelease : true
166130 if : github.ref == 'refs/heads/master'
167131 - name : Upload asset
168- id : upload-release-asset
132+ id : upload-release-asset
169133 uses : actions/upload-release-asset@v1
170134 env :
171135 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
172136 with :
173- 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
137+ 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
174138 asset_path : ./godot-openvr.zip
175139 asset_name : godot-openvr.zip
176140 asset_content_type : application/zip
0 commit comments