-
Notifications
You must be signed in to change notification settings - Fork 32
132 lines (118 loc) · 4.28 KB
/
ci.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
132
name: CI for GDCEF Godot 4.x
on:
workflow_dispatch: # Allow manual trigger
push:
branches:
- godot-4.x
tags:
- '*' # Trigger on any tag
pull_request:
branches:
- godot-4.x
jobs:
build:
strategy:
matrix:
include:
# MacOS build configuration
- os: macos-14
name: MacOS
os_name: macos
check_files: cef_artifacts/libgdcef.dylib
install_system_packages: brew install ninja
# Linux build configuration
- os: ubuntu-20.04
name: Linux
os_name: linux
check_files: cef_artifacts/gdCefRenderProcess cef_artifacts/libgdcef.so cef_artifacts/libcef.so
install_system_packages: sudo apt-get update
# Windows build configuration
- os: windows-2022
name: Windows
os_name: windows
check_files: \a\gdcef\gdcef\cef_artifacts\gdCefRenderProcess.exe \a\gdcef\gdcef\cef_artifacts\libgdcef.dll \a\gdcef\gdcef\cef_artifacts\libcef.dll
shell: powershell
name: Build on ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
# Needed because Godot editor and godot-cpp can find cl.exe while our
# godot native modules cannot find it without this extra path
- name: Setup MSVC (Windows only)
if: matrix.os == 'windows-2022'
uses: ilammy/msvc-dev-cmd@v1.10.0
# Git checkout the gdCEF repository
- name: Checkout GDCEF
uses: actions/checkout@v4
with:
ref: godot-4.x
submodules: true
# Read the gdCEF version from the VERSION file, and set the name of the
# archive to upload on GitHub
- name: Get CI environment variables
id: archive
run: |
echo "tarball_name=gdcef-artifacts-$(cat VERSION)-godot_4-${{ matrix.os_name }}_${{ runner.arch }}.tar.gz" >> $GITHUB_OUTPUT
# Install system packages if any are specified and install python packages
- name: Install system packages
shell: bash
run: |
if [ -n "${{ matrix.install_system_packages }}" ]; then
${{ matrix.install_system_packages }}
fi
# Install python packages inside a virtual environment
- name: Install python packages
uses: getsentry/action-setup-venv@v2.1.0
with:
python-version: 3.10.7
cache-dependency-path: addons/gdcef/requirements.txt
install-cmd: pip install -r addons/gdcef/requirements.txt
# Compile GDCEF: download CEF and godot-cpp, them, compile GDCEF
- name: Compile GDCEF
shell: bash
run: |
cd addons/gdcef
python3 build.py
# Check the build: list the files and create an archive
- name: Check build (Linux/MacOS)
if: runner.os != 'Windows'
shell: bash
run: |
ls ${{ matrix.check_files }}
cd cef_artifacts
tar -czvf ../${{ steps.archive.outputs.tarball_name }} .
# Check the build: check if important gdcef artifacts exist and create an archive
- name: Check build (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
cd cef_artifacts
foreach ($file in "${{ matrix.check_files }}".Split(" ")) {
if (!(Test-Path -Path $file)) { exit 1 }
}
tar -czvf ../${{ steps.archive.outputs.tarball_name }} .
# Upload the archive to GitHub for making a release artifact
- name: Upload artifact
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: artifacts
path: ${{ steps.archive.outputs.tarball_name }}
# Create a GitHub release with the artifacts
release:
needs: build
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
# Download all artifacts
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
path: artifacts
# Create a GitHub release with the artifacts
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "artifacts/*"
allowUpdates: true
makeLatest: true