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
65
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 (release, release_debug, debug)
    required: true

runs:
  using: "composite"
  steps:
    - name: Checkout
      run: |
        [[ -d godot ]] && exit 0 # already checked out
        git clone --depth 1 "${{ inputs.url }}" -b "${{ env.branch }}" godot
        cd godot
        curl 'https://raw.githubusercontent.com/bend-n/godot-2d-builds/main/.github/custom.py' --output custom.py || wget -nv 'https://raw.githubusercontent.com/bend-n/godot-2d-builds/main/.github/custom.py' -O custom.py
      shell: bash

    - name: Install linux dependencies
      if: ${{ inputs.platform }} == "x11"
      run: |
        [[ ${{ inputs.platform }} != "x11" ]] && exit 0
        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 tree
      shell: bash

    - name: Setup Python
      uses: actions/setup-python@v2
      with:
        python-version: "3.9.1"

    - name: Setup SCons
      run: |
        python -c "import sys; print(sys.version)"
        python -m pip install scons
        python --version
        scons --version
      shell: bash

    - name: Build Godot
      run: |
        cd godot
        scons_flags=$flags
        cores=$(nproc) || cores=$(sysctl -n hw.ncpu)
        [[ -n "${{ inputs.flags }}" ]] && scons_flags="${{ inputs.flags }}"
        command="scons -j$((cores+2)) p=${{ inputs.platform }} tools=$tools target=${{ inputs.target }} use_lto=yes udev=yes $scons_flags"
        echo "running scons: $command"
        $command
        strip bin/* || true
        ls bin
      shell: bash