Skip to content

Commit c8a82f4

Browse files
committed
Simplify build workflow
1 parent c6a76f4 commit c8a82f4

File tree

1 file changed

+22
-78
lines changed

1 file changed

+22
-78
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -14,107 +14,58 @@ jobs:
1414
matrix:
1515
include:
1616
- os: ubuntu-latest
17-
platform: linux
18-
exe_extension: ""
1917
artifact_name: qun-linux
20-
vcpkg_triplet: x64-linux
18+
executable: qun
2119
- os: windows-latest
22-
platform: windows
23-
exe_extension: ".exe"
2420
artifact_name: qun-windows
25-
vcpkg_triplet: x64-windows-static
21+
executable: qun.exe
2622

2723
steps:
2824
- name: Checkout repository
2925
uses: actions/checkout@v4
30-
with:
31-
submodules: recursive
3226

3327
- name: Setup vcpkg
3428
uses: lukka/run-vcpkg@v11
35-
with:
36-
vcpkgGitCommitId: '5a2324f6667233aeb903d3117f6fd259a2be6f8b'
3729

3830
- name: Setup MSVC (Windows)
3931
if: matrix.os == 'windows-latest'
4032
uses: ilammy/msvc-dev-cmd@v1
41-
with:
42-
arch: x64
4333

44-
- name: Install Linux dependencies
34+
- name: Install Linux system dependencies
4535
if: matrix.os == 'ubuntu-latest'
4636
run: |
47-
sudo apt-get update
48-
# Add the Ubuntu Toolchain PPA for newer GCC versions
49-
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
5037
sudo apt-get update
5138
sudo apt-get install -y \
52-
gcc-14 \
53-
g++-14 \
5439
build-essential \
5540
cmake \
5641
ninja-build \
42+
pkg-config \
5743
libgl1-mesa-dev \
58-
libglu1-mesa-dev \
5944
libxrandr-dev \
6045
libxinerama-dev \
6146
libxcursor-dev \
62-
libxi-dev \
63-
libxext-dev \
64-
libwayland-dev \
65-
libxkbcommon-dev \
66-
xorg-dev \
67-
pkg-config
68-
# Set GCC-14 as the default compiler
69-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
70-
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
71-
72-
- name: Install vcpkg packages
73-
run: |
74-
vcpkg install glfw3:${{ matrix.vcpkg_triplet }}
75-
vcpkg install glm:${{ matrix.vcpkg_triplet }}
76-
vcpkg integrate install
47+
libxi-dev
7748
78-
- name: Install OpenGL for Linux
79-
if: matrix.os == 'ubuntu-latest'
80-
run: |
81-
vcpkg install opengl:${{ matrix.vcpkg_triplet }}
82-
83-
- name: Configure CMake (Linux)
84-
if: matrix.os == 'ubuntu-latest'
85-
env:
86-
CC: gcc-14
87-
CXX: g++-14
88-
run: |
89-
cmake --preset release \
90-
-DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \
91-
-DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }}
92-
93-
- name: Configure CMake (Windows)
94-
if: matrix.os == 'windows-latest'
95-
run: |
96-
cmake --preset release `
97-
-DCMAKE_TOOLCHAIN_FILE="${env:RUNVCPKG_VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" `
98-
-DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} `
99-
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
100-
101-
- name: Build project
102-
run: cmake --build release --config Release
49+
- name: Configure and build
50+
uses: lukka/run-cmake@v10
51+
with:
52+
configurePreset: 'release'
53+
buildPreset: 'release'
10354

104-
- name: Copy resources and assets (Linux)
55+
- name: Package artifacts (Linux)
10556
if: matrix.os == 'ubuntu-latest'
10657
run: |
107-
mkdir -p artifact
108-
cp release/qun artifact/
109-
cp -r release/resources artifact/ || true
110-
cp -r release/shaders artifact/ || true
58+
mkdir artifact
59+
cp release/${{ matrix.executable }} artifact/
60+
cp -r release/resources artifact/ 2>/dev/null || true
61+
cp -r release/shaders artifact/ 2>/dev/null || true
11162
chmod +x artifact/qun
11263
113-
- name: Copy resources and assets (Windows)
64+
- name: Package artifacts (Windows)
11465
if: matrix.os == 'windows-latest'
11566
run: |
11667
New-Item -ItemType Directory -Force -Path artifact
117-
Copy-Item release/qun.exe artifact/
68+
Copy-Item release/${{ matrix.executable }} artifact/
11869
if (Test-Path release/resources) { Copy-Item -Recurse release/resources artifact/ }
11970
if (Test-Path release/shaders) { Copy-Item -Recurse release/shaders artifact/ }
12071
@@ -128,25 +79,18 @@ jobs:
12879
release:
12980
needs: build
13081
runs-on: ubuntu-latest
131-
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
82+
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
13283

13384
steps:
134-
- name: Download Linux artifact
135-
uses: actions/download-artifact@v4
136-
with:
137-
name: qun-linux
138-
path: qun-linux/
139-
140-
- name: Download Windows artifact
85+
- name: Download artifacts
14186
uses: actions/download-artifact@v4
14287
with:
143-
name: qun-windows
144-
path: qun-windows/
88+
path: artifacts/
14589

14690
- name: Create release archives
14791
run: |
148-
cd qun-linux && tar -czf ../qun-linux.tar.gz * && cd ..
149-
cd qun-windows && zip -r ../qun-windows.zip * && cd ..
92+
cd artifacts/qun-linux && tar -czf ../../qun-linux.tar.gz * && cd ../..
93+
cd artifacts/qun-windows && zip -r ../../qun-windows.zip * && cd ../..
15094
15195
- name: Upload release archives
15296
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)