Skip to content

Commit 705532e

Browse files
committed
Updated github actions
1 parent c250f45 commit 705532e

File tree

3 files changed

+54
-155
lines changed

3 files changed

+54
-155
lines changed

.github/workflows/build.yml

Lines changed: 51 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- main
6+
- dev
67
paths:
78
- '**.hpp'
89
- '**.h'
@@ -12,175 +13,76 @@ on:
1213
- '**.txt'
1314
- '.github/workflows/build.yml'
1415
workflow_dispatch:
15-
pull_request:
1616

17-
jobs:
18-
windows:
19-
runs-on: windows-latest
20-
steps:
21-
- uses: actions/checkout@v3
22-
with:
23-
submodules: 'recursive'
24-
25-
- name: '[x32] Download garrysmod_common'
26-
uses: actions/checkout@v3
27-
with:
28-
repository: 'dankmolot/garrysmod_common'
29-
ref: 'master-cmake'
30-
submodules: 'recursive'
31-
path: 'third-party/garrysmod_common'
17+
env:
18+
GIT_BRANCH: ${{ github.ref_type == 'branch' && github.ref_name || 'release' }}
19+
BUILD_TYPE: RelWithDebInfo
20+
BUILD_TARGET: asyncio
3221

33-
- name: '[x32] Configure project (Serverside)'
34-
run: |
35-
cmake -B build -S . -A Win32 `
36-
-DGARRYSMOD_COMMON_PATH="third-party/garrysmod_common" `
37-
-DAUTOINSTALL="." `
38-
-DBUILD_SHARED_LIBS=OFF
39-
40-
- name: '[x32] Build project (Serverside)'
41-
run: cmake --build build --config Release -j -t asyncio
42-
43-
- name: '[x32] Configure project (Clientside)'
44-
run: cmake -B build -S . -DCLIENT_DLL=ON
45-
46-
- name: '[x32] Build project (Clientside)'
47-
run: cmake --build build --config Release -j -t asyncio
48-
49-
- name: '[x64] Download garrysmod_common'
50-
uses: actions/checkout@v3
51-
with:
52-
repository: 'dankmolot/garrysmod_common'
53-
ref: 'x86-64-cmake'
54-
submodules: 'recursive'
55-
path: 'third-party/garrysmod_common64'
56-
57-
- name: '[x64] Configure project (Serverside)'
58-
run: |
59-
cmake -B build64 -S . -A x64 `
60-
-DGARRYSMOD_COMMON_PATH="third-party/garrysmod_common64" `
61-
-DAUTOINSTALL="." `
62-
-DBUILD_SHARED_LIBS=OFF
63-
64-
- name: '[x64] Build project (Serverside)'
65-
run: cmake --build build64 --config Release -j -t asyncio
66-
67-
- name: '[x64] Configure project (Clientside)'
68-
run: cmake -B build64 -S . -DCLIENT_DLL=ON
69-
70-
- name: '[x64] Build project (Clientside)'
71-
run: cmake --build build64 --config Release -j -t asyncio
72-
73-
- name: "Upload artifacts"
74-
uses: actions/upload-artifact@v3
75-
with:
76-
name: Windows
77-
path: |
78-
./*.dll
79-
if-no-files-found: error
22+
jobs:
23+
build:
24+
strategy:
25+
matrix:
26+
os: [windows-latest, ubuntu-20.04]
27+
arch: [x64, x86]
28+
include:
29+
- os: windows-latest
30+
arch: x64
31+
CMAKE_ARCH_FLAG: -A x64
32+
- os: windows-latest
33+
arch: x86
34+
CMAKE_ARCH_FLAG: -A Win32
35+
- os: ubuntu-20.04
36+
arch: x86
37+
CMAKE_ARCH_FLAG: -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32"
38+
- os: macos-latest
39+
arch: x64
40+
41+
runs-on: ${{ matrix.os }}
8042

81-
linux:
82-
runs-on: ubuntu-20.04 # Using ubuntu 20.04 since we want to use old gcc version to ensure compatibility
8343
steps:
84-
- uses: actions/checkout@v3
44+
- uses: actions/checkout@v4
8545
with:
8646
submodules: 'recursive'
8747

88-
- name: Install dependencies
48+
- name: Install dependencies Ubuntu x86
49+
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.arch == 'x86' }}
8950
run: |
51+
sudo apt update
9052
sudo apt install gcc-multilib g++-multilib
9153
92-
- name: '[x32] Download garrysmod_common'
93-
uses: actions/checkout@v3
54+
- name: Download garrysmod_common
55+
uses: actions/checkout@v4
9456
with:
95-
repository: 'dankmolot/garrysmod_common'
96-
ref: 'master-cmake'
97-
submodules: 'recursive'
98-
path: 'third-party/garrysmod_common'
57+
repository: dankmolot/garrysmod_common
58+
ref: ${{ matrix.arch == 'x64' && 'x86-64-cmake' || 'master-cmake' }}
59+
submodules: recursive
60+
path: third-party/garrysmod_common
9961

100-
- name: '[x32] Configure project (Serverside)'
101-
run: |
102-
cmake -B build -S . \
103-
-DGARRYSMOD_COMMON_PATH="third-party/garrysmod_common" \
104-
-DAUTOINSTALL="." \
105-
-DBUILD_SHARED_LIBS=OFF \
106-
-DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32"
62+
- name: Configure project
63+
run: cmake -B build -S . ${{matrix.CMAKE_ARCH_FLAG}} -DGARRYSMOD_COMMON_PATH="third-party/garrysmod_common" -DAUTOINSTALL="." -DBUILD_SHARED_LIBS=OFF -DGIT_BRANCH="${{env.GIT_BRANCH}}" -DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}"
10764

108-
- name: '[x32] Build project (Serverside)'
109-
run: cmake --build build --config Release -j -t asyncio
65+
- name: Build project
66+
run: cmake --build build -j -t ${{env.BUILD_TARGET}} --config ${{env.BUILD_TYPE}}
11067

111-
- name: '[x32] Configure project (Clientside)'
68+
- name: Configure project (Clientside)
11269
run: cmake -B build -S . -DCLIENT_DLL=ON
70+
71+
- name: Build project (Clientside)
72+
run: cmake --build build -j -t ${{env.BUILD_TARGET}} --config ${{env.BUILD_TYPE}}
11373

114-
- name: '[x32] Build project (Clientside)'
115-
run: cmake --build build --config Release -j -t asyncio
116-
117-
- name: '[x64] Download garrysmod_common'
118-
uses: actions/checkout@v3
119-
with:
120-
repository: 'dankmolot/garrysmod_common'
121-
ref: 'x86-64-cmake'
122-
submodules: 'recursive'
123-
path: 'third-party/garrysmod_common64'
124-
125-
- name: '[x64] Configure project (Serverside)'
74+
- name: Strip debug information from binaries and keep them outside (Ubuntu)
75+
if: ${{ matrix.os == 'ubuntu-20.04' }}
12676
run: |
127-
cmake -B build64 -S . \
128-
-DGARRYSMOD_COMMON_PATH="third-party/garrysmod_common64" \
129-
-DAUTOINSTALL="." \
130-
-DBUILD_SHARED_LIBS=OFF
131-
132-
- name: '[x64] Build project (Serverside)'
133-
run: cmake --build build64 --config Release -j -t asyncio
134-
135-
- name: '[x64] Configure project (Clientside)'
136-
run: cmake -B build64 -S . -DCLIENT_DLL=ON
137-
138-
- name: '[x64] Build project (Clientside)'
139-
run: cmake --build build64 --config Release -j -t asyncio
140-
141-
- name: "Upload artifacts"
142-
uses: actions/upload-artifact@v3
143-
with:
144-
name: Linux
145-
path: |
146-
./*.dll
147-
if-no-files-found: error
148-
149-
macos:
150-
runs-on: macos-latest
151-
steps:
152-
- uses: actions/checkout@v3
153-
with:
154-
submodules: 'recursive'
155-
156-
- name: '[x64] Download garrysmod_common'
157-
uses: actions/checkout@v3
158-
with:
159-
repository: 'dankmolot/garrysmod_common'
160-
ref: 'x86-64-cmake'
161-
submodules: 'recursive'
162-
path: 'third-party/garrysmod_common64'
163-
164-
- name: '[x64] Configure project (Serverside)'
165-
run: |
166-
cmake -B build64 -S . \
167-
-DGARRYSMOD_COMMON_PATH="third-party/garrysmod_common64" \
168-
-DAUTOINSTALL="." \
169-
-DBUILD_SHARED_LIBS=OFF
170-
171-
- name: '[x64] Build project (Serverside)'
172-
run: cmake --build build64 --config Release -j -t asyncio
173-
174-
- name: '[x64] Configure project (Clientside)'
175-
run: cmake -B build64 -S . -DCLIENT_DLL=ON
176-
177-
- name: '[x64] Build project (Clientside)'
178-
run: cmake --build build64 --config Release -j -t asyncio
77+
find *.dll -exec objcopy --only-keep-debug {} {}.pdb \;
78+
find *.dll -exec objcopy --strip-debug {} \;
79+
find *.dll -exec objcopy --add-gnu-debuglink {}.pdb {} \;
17980
18081
- name: "Upload artifacts"
181-
uses: actions/upload-artifact@v3
82+
uses: actions/upload-artifact@v4
18283
with:
183-
name: MacOS
84+
name: ${{matrix.os}}-${{matrix.arch}}-${{env.BUILD_TYPE}}
18485
path: |
18586
./*.dll
87+
# ./*.pdb
18688
if-no-files-found: error

CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
cmake_minimum_required(VERSION 3.22)
2+
enable_language(CXX C)
23

34
# Require C++ 17
45
set(CMAKE_CXX_STANDARD 17)
@@ -20,11 +21,6 @@ if(APPLE)
2021
)
2122
endif()
2223

23-
# Enable multithreaded compilation on Windows
24-
if(MSVC)
25-
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" "/MP")
26-
endif()
27-
2824
# Include extensions
2925
add_subdirectory(cmake)
3026

cmake/find_garrysmod_common.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
function(find_garrysmod_common)
22
message(STATUS "Looking for garrysmod_common...")
33
set(GARRYSMOD_COMMON_PATH "GARRYSMOD_COMMON_NOT_FOUND" CACHE PATH "Path to garrysmod_common (https://github.com/dankmolot/garrysmod_common/tree/master-cmake)")
4+
cmake_path(ABSOLUTE_PATH GARRYSMOD_COMMON_PATH NORMALIZE)
45

56
if(NOT IS_DIRECTORY ${GARRYSMOD_COMMON_PATH} OR NOT EXISTS ${GARRYSMOD_COMMON_PATH}/CMakeLists.txt OR ${GARRYSMOD_COMMON_PATH} STREQUAL ${CMAKE_CURRENT_LIST_DIR})
67
message(FATAL_ERROR "Invalid path to garrysmod_common. Please set valid GARRYSMOD_COMMON_PATH")
78
endif()
89

910
add_subdirectory(${GARRYSMOD_COMMON_PATH} ${CMAKE_BINARY_DIR}/garrysmod_common)
10-
endfunction()
11+
endfunction()

0 commit comments

Comments
 (0)