builds godot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Build godot
description: Builds godot with a certain version and certain flags

inputs:
  url:
    description: Godot git url
    default: https://github.com/godotengine/godot
    required: true
  platform:
    description: Platform to build for
    required: true
  flags:
    description: Flags to pass to the build script
    required: false
  target:
    description: Target (template_release, template_debug, editor)
    required: true

runs:
  using: "composite"
  steps:
    - name: Setup
      uses: bend-n/godot-builds/.github/actions/setup@main
      with:
        ref: ${{ env.ref }}

    - name: Install linux dependencies
      if: inputs.platform == 'linuxbsd'
      run: |
        echo ::group::Dependencies
        sudo apt-get update -q
        sudo apt-get install -qqq \
          build-essential pkg-config libx11-dev libxcursor-dev \
          libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev \
          libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm \
          libspeechd-dev speech-dispatcher \
          tree
        echo ::endgroup::
      shell: bash

    - name: Setup scons
      run: pip install scons
      shell: bash

    - name: Download more ram
      if: runner.os == 'Linux'
      uses: pierotofy/set-swap-space@master
      with:
        swap-size-gb: 10

    - name: Build Godot
      run: |
        echo ::group::Compilation
        cd godot
        scons_flags=${{ env.flags }}
        cores=$(nproc) || cores=$(sysctl -n hw.ncpu)
        [[ ${{ inputs.platform }} == "web" ]] && cores=1
        [[ -n "${{ inputs.flags }}" ]] && scons_flags="${{ inputs.flags }}"
        [[ ${{ inputs.target }} == "editor" ]] && scons_flags="${scons_flags//disable_3d=yes/}" # remove disable_3d=yes if editor
        scons -j$((cores+2)) p=${{ inputs.platform }} target=${{ inputs.target }} use_lto=yes udev=yes $scons_flags
        strip bin/* || true
        ls bin
        echo ::endgroup::
      shell: bash