From bd0dcb3184e8ceff68419618a25e8881a62d20c0 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Thu, 22 Aug 2024 11:58:47 +0200 Subject: [PATCH] GHA: Add action to build .NET assemblies --- .../build-dotnet-assemblies/action.yml | 30 +++++++++++++++++++ .github/workflows/linux.yml | 16 +++------- .github/workflows/macos.yml | 18 ++++------- .github/workflows/windows.yml | 18 +++-------- 4 files changed, 43 insertions(+), 39 deletions(-) create mode 100644 .github/actions/build-dotnet-assemblies/action.yml diff --git a/.github/actions/build-dotnet-assemblies/action.yml b/.github/actions/build-dotnet-assemblies/action.yml new file mode 100644 index 0000000..899020a --- /dev/null +++ b/.github/actions/build-dotnet-assemblies/action.yml @@ -0,0 +1,30 @@ +name: Build .NET assemblies + +inputs: + platform: + required: true + type: choice + options: + - linuxbsd + - windows + - macos + +runs: + using: "composite" + steps: + - name: Override GODOT_VERSION_STATUS for NuGet packages + shell: bash + run: | + GODOT_VERSION_STATUS=$(echo "${GODOT_VERSION_STATUS}" | sed "s|+|-|").gha + echo "GODOT_VERSION_STATUS=${GODOT_VERSION_STATUS}" >> "$GITHUB_ENV" + echo "GODOT_VERSION_STATUS: ${GODOT_VERSION_STATUS}" + + - name: Generate C# glue + shell: bash + run: | + ./bin/${BIN} --headless --generate-mono-glue ./modules/mono/glue || true + + - name: Build .NET assemblies + shell: bash + run: | + ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=${{ inputs.platform }} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 658477f..a107cc0 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -243,19 +243,11 @@ jobs: PATH=${GITHUB_WORKSPACE}/buildroot/bin:$PATH scons platform=linuxbsd target=${{matrix.opts.target}} arch=${{matrix.opts.arch}} module_mono_enabled=${{matrix.opts.dotnet}} ${{env.SCONSFLAGS}} - - name: Generate C# glue + - name: Build .NET assemblies if: matrix.opts.dotnet && matrix.opts.target == 'editor' - run: | - GODOT_VERSION_STATUS=$(echo "${GODOT_VERSION_STATUS}" | sed "s|+|-|") - echo "GODOT_VERSION_STATUS: ${GODOT_VERSION_STATUS}" - ./bin/$BIN --headless --generate-mono-glue ./modules/mono/glue || true - - - name: Build .NET solutions - if: matrix.opts.dotnet && matrix.opts.target == 'editor' - run: | - GODOT_VERSION_STATUS=$(echo "${GODOT_VERSION_STATUS}" | sed "s|+|-|") - echo "GODOT_VERSION_STATUS: ${GODOT_VERSION_STATUS}" - ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd + uses: ./modules/limboai/.github/actions/build-dotnet-assemblies + with: + platform: linuxbsd - name: Prepare artifact env: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 5e76f11..3a02129 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -183,19 +183,11 @@ jobs: run: | scons -j2 platform=macos target=${{matrix.opts.target}} arch=${{matrix.opts.arch}} module_mono_enabled=${{matrix.opts.dotnet}} ${{env.SCONSFLAGS}} - - name: Generate C# glue - if: matrix.opts.dotnet && matrix.opts.target == 'editor' && matrix.opts.arch == 'x86_64' - run: | - GODOT_VERSION_STATUS=$(echo "${GODOT_VERSION_STATUS}" | sed "s|+|-|") - echo "GODOT_VERSION_STATUS: ${GODOT_VERSION_STATUS}" - ./bin/$BIN --headless --generate-mono-glue ./modules/mono/glue || true - - - name: Build .NET solutions - if: matrix.opts.dotnet && matrix.opts.target == 'editor' && matrix.opts.arch == 'x86_64' - run: | - GODOT_VERSION_STATUS=$(echo "${GODOT_VERSION_STATUS}" | sed "s|+|-|") - echo "GODOT_VERSION_STATUS: ${GODOT_VERSION_STATUS}" - ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=macos + - name: Build .NET assemblies + if: matrix.opts.dotnet && matrix.opts.target == 'editor' + uses: ./modules/limboai/.github/actions/build-dotnet-assemblies + with: + platform: macos - name: Prepare artifact run: | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 6afcb92..83c4486 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -220,21 +220,11 @@ jobs: run: | scons -j2 platform=windows target=${{matrix.opts.target}} arch=${{matrix.opts.arch}} module_mono_enabled=${{matrix.opts.dotnet}} ${{env.SCONSFLAGS}} - - name: Generate C# glue + - name: Build .NET assemblies if: matrix.opts.dotnet && matrix.opts.target == 'editor' - shell: bash - run: | - GODOT_VERSION_STATUS=$(echo "${GODOT_VERSION_STATUS}" | sed "s|+|-|") - echo "GODOT_VERSION_STATUS: ${GODOT_VERSION_STATUS}" - ./bin/${{ env.BIN }} --headless --generate-mono-glue ./modules/mono/glue || true - - - name: Build .NET solutions - if: matrix.opts.dotnet && matrix.opts.target == 'editor' - shell: bash - run: | - GODOT_VERSION_STATUS=$(echo "${GODOT_VERSION_STATUS}" | sed "s|+|-|") - echo "GODOT_VERSION_STATUS: ${GODOT_VERSION_STATUS}" - python ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=windows + uses: ./modules/limboai/.github/actions/build-dotnet-assemblies + with: + platform: windows - name: Prepare artifact shell: bash