Skip to content

Commit 9d0b5ad

Browse files
committed
Github Actions
1 parent 63edbf0 commit 9d0b5ad

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

.github/workflow/build.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- dev
7+
paths:
8+
- '**.hpp'
9+
- '**.h'
10+
- '**.cpp'
11+
- '**.c'
12+
- '**.cmake'
13+
- '**.txt'
14+
- '.github/workflows/build.yml'
15+
workflow_dispatch:
16+
17+
env:
18+
GIT_BRANCH: ${{ github.ref_type == 'branch' && github.ref_name || 'release' }}
19+
BUILD_TYPE: RelWithDebInfo
20+
21+
jobs:
22+
build:
23+
strategy:
24+
matrix:
25+
os: [windows-latest, ubuntu-20.04]
26+
arch: [x64, x86]
27+
include:
28+
- os: windows-latest
29+
arch: x64
30+
CMAKE_ARCH_FLAG: -A x64
31+
- os: windows-latest
32+
arch: x86
33+
CMAKE_ARCH_FLAG: -A Win32
34+
- os: ubuntu-20.04
35+
arch: x86
36+
CMAKE_ARCH_FLAG: -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32"
37+
- os: macos-latest
38+
arch: x64
39+
40+
runs-on: ${{ matrix.os }}
41+
42+
steps:
43+
- uses: actions/checkout@v4
44+
with:
45+
submodules: 'recursive'
46+
47+
- name: Install dependencies Ubuntu x86
48+
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.arch == 'x86' }}
49+
run: |
50+
sudo apt update
51+
sudo apt install gcc-multilib g++-multilib
52+
53+
- name: Download garrysmod_common
54+
uses: actions/checkout@v4
55+
with:
56+
repository: dankmolot/garrysmod_common
57+
ref: ${{ matrix.arch == 'x64' && 'x86-64-cmake' || 'master-cmake' }}
58+
submodules: recursive
59+
path: third-party/garrysmod_common
60+
61+
- name: Configure project
62+
run: cmake --preset=vcpkg -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}}"
63+
64+
- name: Build project
65+
run: cmake --build build -j -t async_postgres --config ${{env.BUILD_TYPE}}
66+
67+
- name: Configure project (Clientside)
68+
run: cmake --preset=vcpkg -B build -S . -DCLIENT_DLL=ON
69+
70+
- name: Build project (Clientside)
71+
run: cmake --build build -j -t async_postgres --config ${{env.BUILD_TYPE}}
72+
73+
- name: Strip debug information from binaries and keep them outside (Ubuntu)
74+
if: ${{ matrix.os == 'ubuntu-20.04' }}
75+
run: |
76+
find *.dll -exec objcopy --only-keep-debug {} {}.pdb \;
77+
find *.dll -exec objcopy --strip-debug {} \;
78+
find *.dll -exec objcopy --add-gnu-debuglink {}.pdb {} \;
79+
80+
- name: "Upload artifacts"
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: ${{matrix.os}}-${{matrix.arch}}-${{env.BUILD_TYPE}}
84+
path: |
85+
./*.dll
86+
# ./*.pdb
87+
if-no-files-found: error

0 commit comments

Comments
 (0)