|
| 1 | +# Adapted from https://github.com/nathanfranke/gdextension/blob/main/.github/workflows/build.yml |
| 2 | +name: Builds |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master", "godot_4.2" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "master", "godot_4.2" ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ${{ matrix.runner }} |
| 12 | + name: ${{ matrix.name }} |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + include: |
| 17 | + - identifier: linux-debug |
| 18 | + name: Linux Debug |
| 19 | + runner: ubuntu-20.04 |
| 20 | + target: template_debug |
| 21 | + platform: linux |
| 22 | + arch: x86_64 |
| 23 | + - identifier: linux-release |
| 24 | + name: Linux Release |
| 25 | + runner: ubuntu-20.04 |
| 26 | + target: template_release |
| 27 | + platform: linux |
| 28 | + arch: x86_64 |
| 29 | + - identifier: windows-debug |
| 30 | + name: Windows Debug |
| 31 | + runner: ubuntu-20.04 |
| 32 | + target: template_debug |
| 33 | + platform: windows |
| 34 | + arch: x86_64 |
| 35 | + - identifier: windows-release |
| 36 | + name: Windows Release |
| 37 | + runner: ubuntu-20.04 |
| 38 | + target: template_release |
| 39 | + platform: windows |
| 40 | + arch: x86_64 |
| 41 | + - identifier: android-release |
| 42 | + name: Android Release |
| 43 | + runner: ubuntu-20.04 |
| 44 | + target: template_release |
| 45 | + platform: android |
| 46 | + arch: arm64 |
| 47 | + # Untested |
| 48 | + - identifier: macos-debug |
| 49 | + name: MacOS Debug |
| 50 | + runner: macos-latest |
| 51 | + target: template_debug |
| 52 | + platform: macos |
| 53 | + arch: x86_64 |
| 54 | + - identifier: macos-release |
| 55 | + name: MacOS Release |
| 56 | + runner: macos-latest |
| 57 | + target: template_release |
| 58 | + platform: macos |
| 59 | + arch: x86_64 |
| 60 | + |
| 61 | + steps: |
| 62 | + - name: (Windows) Install mingw64 |
| 63 | + if: ${{ startsWith(matrix.identifier, 'windows-') }} |
| 64 | + shell: sh |
| 65 | + run: | |
| 66 | + sudo apt-get install mingw-w64 |
| 67 | + sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix |
| 68 | + sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix |
| 69 | +
|
| 70 | + - name: (Android) Set up Java 11 |
| 71 | + if: ${{ startsWith(matrix.identifier, 'android-') }} |
| 72 | + uses: actions/setup-java@v1 |
| 73 | + with: |
| 74 | + java-version: 11 |
| 75 | + |
| 76 | + - name: (Android) Set up Android SDK |
| 77 | + if: ${{ startsWith(matrix.identifier, 'android-') }} |
| 78 | + uses: android-actions/setup-android@v2 |
| 79 | + |
| 80 | + - name: (Android) Install Android Tools |
| 81 | + if: ${{ startsWith(matrix.identifier, 'android-') }} |
| 82 | + shell: sh |
| 83 | + run: | |
| 84 | + "$ANDROID_SDK_ROOT"/cmdline-tools/latest/bin/sdkmanager --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" "build-tools;30.0.3" "platforms;android-29" "cmdline-tools;latest" "cmake;3.10.2.4988404" "ndk;21.4.7075529" |
| 85 | +
|
| 86 | + - name: Set up Python |
| 87 | + uses: actions/setup-python@v2 |
| 88 | + |
| 89 | + - name: Set up SCons |
| 90 | + shell: bash |
| 91 | + run: | |
| 92 | + python -c "import sys; print(sys.version)" |
| 93 | + python -m pip install scons |
| 94 | + scons --version |
| 95 | +
|
| 96 | + - name: Checkout project |
| 97 | + uses: actions/checkout@v2 |
| 98 | + with: |
| 99 | + submodules: recursive |
| 100 | + |
| 101 | +# TODO: Cache doesn't work yet. SCons rebuilds the objects even if they already exist. Could be caused by modification dates or extension_api.json. |
| 102 | +# fetch-depth: 0 May be needed for cache. See: <https://github.com/actions/checkout/issues/468>. |
| 103 | +# - name: Set up SCons cache |
| 104 | +# uses: actions/cache@v3 |
| 105 | +# with: |
| 106 | +# path: | |
| 107 | +# ${{ github.workspace }}/.scons-cache/ |
| 108 | +# ${{ github.workspace }}/**/.sconsign.dblite |
| 109 | +# ${{ github.workspace }}/godot-cpp/gen/ |
| 110 | +# key: ${{ matrix.identifier }}-${{ github.ref }}-${{ github.sha }} |
| 111 | +# restore-keys: | |
| 112 | +# ${{ matrix.identifier }}-${{ github.ref }}-${{ github.sha }} |
| 113 | +# ${{ matrix.identifier }}-${{ github.ref }} |
| 114 | +# ${{ matrix.identifier }} |
| 115 | + |
| 116 | + - name: Compile extension |
| 117 | + shell: sh |
| 118 | +# env: |
| 119 | +# SCONS_CACHE: '${{ github.workspace }}/.scons-cache/' |
| 120 | +# SCONS_CACHE_LIMIT: 8192 |
| 121 | + run: | |
| 122 | + scons target='${{ matrix.target }}' platform='${{ matrix.platform }}' arch='${{ matrix.arch }}' -j2 |
| 123 | + ls -l demo/addons/*/bin/ |
| 124 | +
|
| 125 | + - name: Copy extra files to addon |
| 126 | + shell: sh |
| 127 | + run: | |
| 128 | + for addon in ${{ github.workspace }}/demo/addons/*/; do |
| 129 | + cp -n '${{ github.workspace }}/README.md' '${{ github.workspace }}/LICENSE' "$addon" |
| 130 | + done |
| 131 | +
|
| 132 | + - name: Upload artifact |
| 133 | + uses: actions/upload-artifact@v2 |
| 134 | + with: |
| 135 | + name: ${{ github.event.repository.name }} |
| 136 | + path: | |
| 137 | + ${{ github.workspace }}/demo/ |
0 commit comments