-
-
Notifications
You must be signed in to change notification settings - Fork 83
131 lines (115 loc) · 4.22 KB
/
build.yml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: 🌈 All Builds
on:
push:
branches: [ gd-extension ]
tags:
- "v*"
# Global Settings
env:
PROJECT_FOLDER: .
TARGET_PATH: demo/addons/godot-sqlite/bin/
TARGET_NAME: libgdsqlite
VAR_PATH: .github/workflows/build_var.json
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
jobs:
matrix:
name: Generate build matrix
runs-on: ubuntu-latest
outputs:
matrix-json: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: set-matrix
shell: pwsh
# Use a small PowerShell script to generate the build matrix
run: "& .github/workflows/create-build-matrix.ps1"
build:
needs: [ matrix ]
name: ${{ matrix.name }} - ${{ matrix.target == 'template_debug' && 'Debug' || 'Release' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.matrix.outputs.matrix-json) }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
submodules: recursive
- name: Setup Godot build cache
uses: ./godot-cpp/.github/actions/godot-cache
with:
cache-name: ${{ matrix.cache-name }}-${{ matrix.target }}
continue-on-error: true
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons ${{ matrix.additional-python-packages }}
python --version
scons --version
- name: Windows Compilation
if: runner.os == 'Windows'
run: |
if(-Not (Test-Path -Path ${{ env.PROJECT_FOLDER }}\${{ env.TARGET_PATH }}))
{
mkdir ${{ env.PROJECT_FOLDER }}\${{ env.TARGET_PATH }}
}
cd ${{ env.PROJECT_FOLDER }}
scons platform=windows target=${{ matrix.target }} target_path=${{ env.TARGET_PATH }} target_name=${{ env.TARGET_NAME }} -j6 ${{ matrix.flags }}
- name: Not Windows Compilation
if: runner.os != 'Windows'
run: |
mkdir -v -p ${{ env.PROJECT_FOLDER }}/${{ env.TARGET_PATH }}
cd ${{ env.PROJECT_FOLDER }}
scons platform=${{ matrix.platform }} target=${{ matrix.target }} target_path=${{ env.TARGET_PATH }} target_name=${{ env.TARGET_NAME }} -j6 ${{ matrix.flags }}
- name: Upload Artifact
env:
ARTIFACT_FOLDER: ${{ env.PROJECT_FOLDER }}/${{ env.TARGET_PATH }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform}}
path: ${{ env.ARTIFACT_FOLDER }}*.${{ matrix.artifact-extension }}
if-no-files-found: error
release:
name: Release
runs-on: "ubuntu-20.04"
needs: [ build ]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true
submodules: recursive
- name: Download Artifacts
id: download
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Copy Artifacts to bin/-folder
run: |
mkdir -v -p ${{ env.PROJECT_FOLDER }}/${{ env.TARGET_PATH }}
cd ${{ env.PROJECT_FOLDER }}
cp -r ${{steps.download.outputs.download-path}}/**/* ${{ env.TARGET_PATH }}
zip -r demo.zip demo/
cd ${{ env.TARGET_PATH }}/..
zip -r bin.zip bin/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
body_path: ${{ env.PROJECT_FOLDER }}/.github/workflows/release_template.md
files: |
${{ env.PROJECT_FOLDER }}/demo.zip
${{ env.PROJECT_FOLDER }}/${{ env.TARGET_PATH }}/../bin.zip
draft: true
prerelease: true