diff --git a/.github/actions/export-godot-project/action.yml b/.github/actions/export-godot-project/action.yml new file mode 100644 index 0000000..009a143 --- /dev/null +++ b/.github/actions/export-godot-project/action.yml @@ -0,0 +1,29 @@ +name: Export Godot project +description: Export a project for the target platform. + +inputs: + platform: + required: true + arch: + required: true + preset: + required: true + output: + required: true + +outputs: + path: + value: ${{ steps.export-project-step.outputs.export-path }} + +runs: + using: "composite" + steps: + - name: Export project (${{ inputs.preset }}) + id: export-project-step + shell: bash + env: + EXPORT_OUTPUT_PATH: ./example/export/${{ inputs.platform }}/${{ inputs.arch }} + run: | + godot --headless --path ./example --editor --quit + godot --headless --path ./example --export-release "${{ inputs.preset }}" ${{ env.EXPORT_OUTPUT_PATH }}/${{ inputs.output }} + echo "export-path=${{ env.EXPORT_OUTPUT_PATH }}" >> "$GITHUB_OUTPUT" diff --git a/.github/actions/install-deps/action.yml b/.github/actions/install-deps/action.yml index 7f62a6d..0ddc641 100644 --- a/.github/actions/install-deps/action.yml +++ b/.github/actions/install-deps/action.yml @@ -1,41 +1,49 @@ name: Install build dependencies -description: Set up python, install the pip version of scons. +description: Install Python and SCons, platform-specific dependencies. + +env: + PYTHON_VERSION: "3.x" + SCONS_VERSION: "4.4.0" + JAVA_DISTRIBUTION: "temurin" + JAVA_VERSION: "17" + ANDROID_NDK_VERSION: "r23c" + EMSCRIPTEN_VERSION: "3.1.39" runs: using: "composite" steps: - - name: Set up Python 3.x + - name: Install Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v5 with: # Semantic version range syntax or exact version of a Python version - python-version: "3.x" + python-version: ${{ env.PYTHON_VERSION }} - - name: Install scons + - name: Install SCons ${{ env.SCONS_VERSION }} shell: bash run: | python -c "import sys; print(sys.version)" - python -m pip install scons==4.4.0 + python -m pip install scons==${{ env.SCONS_VERSION }} scons --version - - name: "Android: Install Java 17" + - name: "Android: Install Java ${{ env.JAVA_VERSION }}" if: ${{ env.SCONS_PLATFORM == 'android' }} uses: actions/setup-java@v4 with: - distribution: temurin - java-version: 17 + distribution: ${{ env.JAVA_DISTRIBUTION }} + java-version: ${{ env.JAVA_VERSION }} - - name: "Android: Install NDK" + - name: "Android: Install NDK ${{ env.ANDROID_NDK_VERSION }}" uses: nttld/setup-ndk@v1 if: ${{ env.SCONS_PLATFORM == 'android' }} with: - ndk-version: r23c + ndk-version: ${{ env.ANDROID_NDK_VERSION }} link-to-sdk: true - - name: "Web: Install Emscripten" + - name: "Web: Install Emscripten ${{ env.EMSCRIPTEN_VERSION }}" if: ${{ env.SCONS_PLATFORM == 'web' }} uses: mymindstorm/setup-emsdk@v14 with: - version: 3.1.39 + version: ${{ env.EMSCRIPTEN_VERSION }} actions-cache-folder: emsdk-cache cache-key: emsdk-${{ env.SCONS_PLATFORM }}-main diff --git a/.github/workflows/build-unstable.yml b/.github/workflows/build-unstable.yml index 3044d7d..6bd4712 100644 --- a/.github/workflows/build-unstable.yml +++ b/.github/workflows/build-unstable.yml @@ -15,23 +15,23 @@ jobs: # First, build the extension and upload the artifacts. build-linux: - name: Compile and publish Linux version + name: Compile and upload Linux version uses: ./.github/workflows/extension-build-linux.yml build-macos: - name: Compile and publish macOS version + name: Compile and upload macOS version uses: ./.github/workflows/extension-build-macos.yml build-windows: - name: Compile and publish Windows version + name: Compile and upload Windows version uses: ./.github/workflows/extension-build-windows.yml build-web: - name: Compile and publish Web version + name: Compile and upload Web version uses: ./.github/workflows/extension-build-web.yml build-android: - name: Compile and publish Android version + name: Compile and upload Android version uses: ./.github/workflows/extension-build-android.yml # Then, use the artifacts to prepare the example project and publish the build. @@ -41,7 +41,12 @@ jobs: needs: [ build-linux, build-macos, build-windows, build-web, build-android ] uses: ./.github/workflows/extension-publish-all.yml - build-example-project: - name: Export and publish the example project + export-example-project: + name: Export the example project for target platforms needs: [ build-linux, build-macos, build-windows, build-web, build-android ] - uses: ./.github/workflows/example-build-project.yml + uses: ./.github/workflows/example-export-project.yml + + publish-example-project: + name: Package and publish the example project + needs: [ export-example-project ] + uses: ./.github/workflows/example-publish-project.yml diff --git a/.github/workflows/example-export-project.yml b/.github/workflows/example-export-project.yml new file mode 100644 index 0000000..e00cee2 --- /dev/null +++ b/.github/workflows/example-export-project.yml @@ -0,0 +1,82 @@ +name: Export Example Project + +on: + workflow_call: + +# Make sure jobs cannot overlap. +concurrency: + group: export-unstable-example-project + cancel-in-progress: true + +env: + GODOT_VERSION: "4.3.0-dev5" + +jobs: + export-publish: + strategy: + fail-fast: false + matrix: + include: + - platform: linux + arch: x86_64 + preset: "Linux - x86_64" + output: "gdsion-example.x86_64" + runs-on: ubuntu-latest + + - platform: macos + arch: universal + preset: "macOS - Universal" + output: "gdsion-example.zip" + runs-on: macos-latest + + - platform: windows + arch: x86_64 + preset: "Windows - x86_64" + output: "gdsion-example.exe" + runs-on: windows-latest + + - platform: windows + arch: x86_32 + preset: "Windows - x86_32" + output: "gdsion-example.exe" + runs-on: windows-latest + + name: Export the example project (${{ matrix.preset }}) + runs-on: ${{ matrix.runs-on }} + steps: + - uses: actions/checkout@v4 + + - name: Install Godot ${{ env.GODOT_VERSION }} + uses: chickensoft-games/setup-godot@v1 + with: + version: ${{ env.GODOT_VERSION }} + use-dotnet: false + include-templates: true + + - name: Verify Godot + shell: bash + run: | + godot --version + + - name: Download GDSiON artifacts + uses: actions/download-artifact@v4 + with: + path: example/bin + pattern: libgdsion-* + merge-multiple: true + + - name: Export the example project + id: export-project-step + uses: ./.github/actions/export-godot-project + with: + platform: ${{ matrix.platform }} + arch: ${{ matrix.arch }} + preset: ${{ matrix.preset }} + output: ${{ matrix.output }} + + - name: Upload the example project + uses: actions/upload-artifact@v4 + with: + name: example-project-${{ matrix.platform }}-${{ matrix.arch }} + path: "${{ steps.export-project-step.outputs.export-path }}/*" + retention-days: 14 diff --git a/.github/workflows/example-build-project.yml b/.github/workflows/example-publish-project.yml similarity index 66% rename from .github/workflows/example-build-project.yml rename to .github/workflows/example-publish-project.yml index 7e02ce5..c12de0e 100644 --- a/.github/workflows/example-build-project.yml +++ b/.github/workflows/example-publish-project.yml @@ -1,16 +1,16 @@ -name: Build Example Project +name: Publish Example Project on: workflow_call: # Make sure jobs cannot overlap. concurrency: - group: build-unstable-example-project + group: publish-unstable-example-project cancel-in-progress: true jobs: - export-publish: - name: Export and publish the example project + publish: + name: Package and publish the example project runs-on: ubuntu-latest steps: @@ -20,20 +20,21 @@ jobs: uses: actions/download-artifact@v4 with: path: example/bin + pattern: libgdsion-* merge-multiple: true - - name: Archive the example project + - name: Archive example project sources uses: thedoctor0/zip-release@0.7.5 with: type: zip directory: example - filename: libgdsion-example-project.zip + filename: example-project-source.zip - name: Update the rolling release with the example project shell: bash env: GH_TOKEN: ${{ github.token }} run: | - gh release upload latest-unstable example/libgdsion-example-project.zip --clobber + gh release upload latest-unstable example/example-project-source.zip --clobber gh release edit latest-unstable --target $(git log --format="%H" -n 1)