Skip to content

Commit bf024d7

Browse files
committed
ci: fix release workflow - separate core/full builds to avoid ImGui API errors
1 parent cdf9b4f commit bf024d7

1 file changed

Lines changed: 66 additions & 108 deletions

File tree

.github/workflows/release.yml

Lines changed: 66 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -12,124 +12,108 @@ on:
1212
default: 'v0.0.1-beta'
1313

1414
jobs:
15-
# ── Core: Engine base sem SDL3/ImGui (Linux) ─────────────────────────────
16-
build-core:
17-
name: Build Core (Linux)
18-
runs-on: ubuntu-latest
15+
build-and-release:
16+
name: Build & Publish Release
17+
runs-on: windows-latest
18+
permissions:
19+
contents: write
1920

2021
steps:
2122
- name: Checkout
2223
uses: actions/checkout@v4
2324

24-
- name: Install GCC 13
25-
run: sudo apt-get update && sudo apt-get install -y g++-13
26-
27-
- name: Configure Core (sem SDL3)
28-
run: |
29-
cmake -S . -B build-core \
30-
-DCMAKE_BUILD_TYPE=Release \
31-
-DCMAKE_CXX_COMPILER=g++-13
32-
33-
- name: Build Core
34-
run: cmake --build build-core --target Caffeine -- -j$(nproc)
35-
36-
- name: Package Core
25+
- name: Resolve version
26+
shell: pwsh
3727
run: |
38-
TAG="${{ github.ref_name || inputs.version }}"
39-
PKG="caffeine-core-${TAG}-linux"
40-
mkdir -p "$PKG/lib" "$PKG/include"
41-
42-
# Biblioteca compilada
43-
cp build-core/libCaffeine.a "$PKG/lib/"
44-
45-
# Headers públicos (exclui editor — editor é parte da IDE)
46-
find src -name "*.hpp" | grep -v "/editor/" | while read f; do
47-
dest="$PKG/include/${f#src/}"
48-
mkdir -p "$(dirname "$dest")"
49-
cp "$f" "$dest"
50-
done
51-
52-
zip -r "${PKG}.zip" "$PKG"
53-
echo "CORE_ZIP=${PKG}.zip" >> $GITHUB_ENV
54-
55-
- name: Upload Core artifact
56-
uses: actions/upload-artifact@v4
57-
with:
58-
name: core-linux
59-
path: caffeine-core-*.zip
60-
61-
# ── IDE + Bundle: Engine completa com SDL3 + ImGui (Windows) ─────────────
62-
build-ide-bundle:
63-
name: Build IDE + Bundle (Windows)
64-
runs-on: windows-latest
65-
66-
steps:
67-
- name: Checkout
68-
uses: actions/checkout@v4
28+
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
29+
echo "VERSION=${{ inputs.version }}" | Out-File -FilePath $env:GITHUB_ENV -Append
30+
} else {
31+
echo "VERSION=${{ github.ref_name }}" | Out-File -FilePath $env:GITHUB_ENV -Append
32+
}
6933
7034
- name: Download SDL3
7135
shell: pwsh
7236
run: |
7337
$version = "3.2.14"
7438
$url = "https://github.com/libsdl-org/SDL/releases/download/release-$version/SDL3-devel-$version-VC.zip"
75-
Write-Host "Downloading SDL3 $version..."
7639
Invoke-WebRequest -Uri $url -OutFile SDL3.zip
7740
Expand-Archive SDL3.zip -DestinationPath "$env:GITHUB_WORKSPACE\SDL3"
7841
$sdl3Root = "$env:GITHUB_WORKSPACE\SDL3\SDL3-$version"
79-
echo "SDL3_CMAKE_DIR=$sdl3Root\cmake" | Out-File -FilePath $env:GITHUB_ENV -Append
80-
echo "SDL3_BIN=$sdl3Root\lib\x64" | Out-File -FilePath $env:GITHUB_ENV -Append
81-
Write-Host "SDL3_CMAKE_DIR = $sdl3Root\cmake"
42+
echo "SDL3_CMAKE_DIR=$sdl3Root\cmake" | Out-File -FilePath $env:GITHUB_ENV -Append
43+
echo "SDL3_BIN=$sdl3Root\lib\x64" | Out-File -FilePath $env:GITHUB_ENV -Append
8244
83-
- name: Configure Full (com SDL3 + ImGui)
45+
# ── core: Caffeine sem SDL3 + caf-encode ─────────────────────────────
46+
- name: Configure Core (sem SDL3)
47+
shell: pwsh
48+
run: cmake -S . -B build-core -DCMAKE_BUILD_TYPE=Release
49+
50+
- name: Build Core
51+
shell: pwsh
52+
run: cmake --build build-core --config Release
53+
54+
# ── full: apenas Caffeine.lib com SDL3 + ImGui ────────────────────────
55+
- name: Configure Full (com SDL3)
8456
shell: pwsh
8557
run: |
8658
cmake -S . -B build-full `
8759
-DCMAKE_BUILD_TYPE=Release `
8860
-DSDL3_DIR="${{ env.SDL3_CMAKE_DIR }}"
8961
90-
- name: Build Full
62+
- name: Build Full (target Caffeine only)
9163
shell: pwsh
92-
run: cmake --build build-full --config Release
64+
run: cmake --build build-full --config Release --target Caffeine
9365

94-
# ── Artifact: IDE (apenas o módulo editor + engine compilada com SDL3) ─
66+
# ── Package: core ─────────────────────────────────────────────────────
67+
- name: Package Core
68+
shell: pwsh
69+
run: |
70+
$tag = "${{ env.VERSION }}"
71+
$pkg = "caffeine-core-$tag-windows"
72+
New-Item -ItemType Directory -Force "$pkg\lib", "$pkg\include", "$pkg\bin" | Out-Null
73+
74+
Copy-Item "build-core\Release\Caffeine.lib" "$pkg\lib\"
75+
Copy-Item "build-core\Release\caf-encode.exe" "$pkg\bin\"
76+
77+
Get-ChildItem "src" -Recurse -Filter "*.hpp" | Where-Object {
78+
$_.FullName -notlike "*\editor\*"
79+
} | ForEach-Object {
80+
$rel = $_.FullName.Substring((Resolve-Path "src").Path.Length + 1)
81+
$dest = "$pkg\include\$rel"
82+
New-Item -ItemType Directory -Force (Split-Path $dest) | Out-Null
83+
Copy-Item $_.FullName $dest
84+
}
85+
86+
Compress-Archive -Path $pkg -DestinationPath "$pkg.zip"
87+
88+
# ── Package: ide ──────────────────────────────────────────────────────
9589
- name: Package IDE
9690
shell: pwsh
9791
run: |
98-
$tag = "${{ github.ref_name || inputs.version }}"
92+
$tag = "${{ env.VERSION }}"
9993
$pkg = "caffeine-ide-$tag-windows"
10094
New-Item -ItemType Directory -Force "$pkg\lib", "$pkg\include\editor", "$pkg\bin" | Out-Null
10195
102-
# Biblioteca com SDL3 + ImGui
10396
Copy-Item "build-full\Release\Caffeine.lib" "$pkg\lib\"
97+
Copy-Item "${{ env.SDL3_BIN }}\SDL3.dll" "$pkg\bin\"
10498
105-
# Apenas os headers do módulo editor
10699
Get-ChildItem "src\editor" -Filter "*.hpp" | ForEach-Object {
107100
Copy-Item $_.FullName "$pkg\include\editor\"
108101
}
109102
110-
# Runtime SDL3
111-
Copy-Item "${{ env.SDL3_BIN }}\SDL3.dll" "$pkg\bin\"
112-
113103
Compress-Archive -Path $pkg -DestinationPath "$pkg.zip"
114104
115-
# ── Artifact: Bundle (IDE + Engine core + todas as ferramentas) ────────
105+
# ── Package: bundle ───────────────────────────────────────────────────
116106
- name: Package Bundle
117107
shell: pwsh
118108
run: |
119-
$tag = "${{ github.ref_name || inputs.version }}"
109+
$tag = "${{ env.VERSION }}"
120110
$pkg = "caffeine-bundle-$tag-windows"
121111
New-Item -ItemType Directory -Force "$pkg\lib", "$pkg\include", "$pkg\bin" | Out-Null
122112
123-
# Biblioteca completa
124113
Copy-Item "build-full\Release\Caffeine.lib" "$pkg\lib\"
125-
126-
# Ferramenta caf-encode
127-
Copy-Item "build-full\Release\caf-encode.exe" "$pkg\bin\"
128-
129-
# Runtime SDL3
114+
Copy-Item "build-core\Release\caf-encode.exe" "$pkg\bin\"
130115
Copy-Item "${{ env.SDL3_BIN }}\SDL3.dll" "$pkg\bin\"
131116
132-
# Todos os headers (core + editor)
133117
Get-ChildItem "src" -Recurse -Filter "*.hpp" | ForEach-Object {
134118
$rel = $_.FullName.Substring((Resolve-Path "src").Path.Length + 1)
135119
$dest = "$pkg\include\$rel"
@@ -139,62 +123,36 @@ jobs:
139123
140124
Compress-Archive -Path $pkg -DestinationPath "$pkg.zip"
141125
142-
- name: Upload IDE + Bundle artifacts
143-
uses: actions/upload-artifact@v4
144-
with:
145-
name: ide-bundle-windows
146-
path: |
147-
caffeine-ide-*.zip
148-
caffeine-bundle-*.zip
149-
150-
# ── Publicar Release no GitHub ───────────────────────────────────────────
151-
release:
152-
name: Publish GitHub Release
153-
runs-on: ubuntu-latest
154-
needs: [build-core, build-ide-bundle]
155-
permissions:
156-
contents: write
157-
158-
steps:
159-
- name: Download all artifacts
160-
uses: actions/download-artifact@v4
161-
with:
162-
merge-multiple: true
163-
126+
# ── GitHub Release ────────────────────────────────────────────────────
164127
- name: Create Release
165128
uses: softprops/action-gh-release@v2
166129
with:
167-
tag_name: ${{ github.ref_name || inputs.version }}
168-
name: "☕ Caffeine Engine ${{ github.ref_name || inputs.version }}"
130+
tag_name: ${{ env.VERSION }}
131+
name: "☕ Caffeine Engine ${{ env.VERSION }}"
169132
prerelease: true
170133
body: |
171-
## ☕ Caffeine Engine ${{ github.ref_name || inputs.version }}
134+
## ☕ Caffeine Engine ${{ env.VERSION }}
172135
173136
Primeira release pública da **Caffeine Engine** — uma game engine de alta performance construída em C++20 sobre SDL3.
174137
175138
---
176139
177140
### 📦 Artifacts
178141
179-
| Arquivo | Plataforma | Descrição |
180-
|---------|-----------|-----------|
181-
| `caffeine-core-*-linux.zip` | Linux | Engine base sem SDL3/ImGui — apenas a biblioteca estática |
182-
| `caffeine-ide-*-windows.zip` | Windows | Módulo IDE: engine compilada com SDL3 + ImGui + headers do editor |
183-
| `caffeine-bundle-*-windows.zip` | Windows | Bundle completa: IDE + Core + caf-encode + SDL3.dll |
142+
| Arquivo | Descrição |
143+
|---------|-----------|
144+
| `caffeine-core-*-windows.zip` | Engine base: `Caffeine.lib` (sem SDL3/ImGui) + `caf-encode.exe` + headers públicos |
145+
| `caffeine-ide-*-windows.zip` | Módulo IDE: `Caffeine.lib` (com SDL3 + ImGui) + headers do editor + `SDL3.dll` |
146+
| `caffeine-bundle-*-windows.zip` | Bundle completa: IDE + Core + todas as ferramentas + todos os headers |
184147
185148
---
186149
187150
### 📋 Requisitos
188151
189-
**Core (Linux)**
190-
- GCC 13+ ou Clang 16+
191-
- CMake 3.20+
192-
- C++20
193-
194-
**IDE / Bundle (Windows)**
195152
- Windows 10/11 (x64)
196153
- Visual C++ Redistributable 2022
197-
- SDL3.dll incluído no pacote
154+
- CMake 3.20+ (para integrar como dependência)
155+
- `SDL3.dll` incluído nos pacotes IDE e Bundle
198156
199157
---
200158

0 commit comments

Comments
 (0)