Skip to content

Commit 66cf368

Browse files
committed
Added Github Actions
1 parent 962c764 commit 66cf368

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed

.github/workflows/build.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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: ${{ (github.ref_type != 'branch' || github.ref_name == 'main') && 'Release' || 'Debug' }}
20+
21+
jobs:
22+
windows:
23+
runs-on: windows-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
with:
27+
submodules: 'recursive'
28+
29+
# - name: '[x32] Download garrysmod_common'
30+
# uses: actions/checkout@v3
31+
# with:
32+
# repository: 'dankmolot/garrysmod_common'
33+
# ref: 'master-cmake'
34+
# submodules: 'recursive'
35+
# path: 'third-party/garrysmod_common'
36+
37+
# - name: '[x32] Configure project (Serverside)'
38+
# run: |
39+
# cmake -B build -S . -A Win32 `
40+
# -DGARRYSMOD_COMMON_PATH="third-party/garrysmod_common" `
41+
# -DAUTOINSTALL="." `
42+
# -DBUILD_SHARED_LIBS=OFF `
43+
# -DGIT_BRANCH="$env:GIT_BRANCH"
44+
45+
# - name: '[x32] Build project (Serverside)'
46+
# run: cmake --build build --config $env:BUILD_TYPE -j -t pgsqloo
47+
48+
- name: '[x64] Download garrysmod_common'
49+
uses: actions/checkout@v3
50+
with:
51+
repository: 'dankmolot/garrysmod_common'
52+
ref: 'x86-64-cmake'
53+
submodules: 'recursive'
54+
path: 'third-party/garrysmod_common64'
55+
56+
- name: '[x64] Configure project (Serverside)'
57+
run: |
58+
cmake -B build64 -S . -A x64 `
59+
-DGARRYSMOD_COMMON_PATH="third-party/garrysmod_common64" `
60+
-DAUTOINSTALL="." `
61+
-DBUILD_SHARED_LIBS=OFF `
62+
-DGIT_BRANCH="$env:GIT_BRANCH"
63+
64+
- name: '[x64] Build project (Serverside)'
65+
run: cmake --build build64 --config $env:BUILD_TYPE -j -t pgsqloo
66+
67+
- name: "Upload artifacts"
68+
uses: actions/upload-artifact@v3
69+
with:
70+
name: Windows
71+
path: |
72+
./*.dll
73+
if-no-files-found: error
74+
75+
- name: "Upload debug artifacts"
76+
uses: actions/upload-artifact@v3
77+
if: ${{ env.BUILD_TYPE == 'Debug' }}
78+
with:
79+
name: Windows
80+
path: |
81+
./*.pdb
82+
83+
linux:
84+
runs-on: ubuntu-20.04 # Using ubuntu 20.04 since we want to use old gcc version to ensure compatibility
85+
steps:
86+
- uses: actions/checkout@v3
87+
with:
88+
submodules: 'recursive'
89+
90+
- name: Install dependencies
91+
run: |
92+
sudo apt install gcc-multilib g++-multilib libpq-dev libpq-dev:i386
93+
94+
- name: '[x32] Download garrysmod_common'
95+
uses: actions/checkout@v3
96+
with:
97+
repository: 'dankmolot/garrysmod_common'
98+
ref: 'master-cmake'
99+
submodules: 'recursive'
100+
path: 'third-party/garrysmod_common'
101+
102+
- name: '[x32] Configure project (Serverside)'
103+
run: |
104+
cmake -B build -S . \
105+
-DGARRYSMOD_COMMON_PATH="third-party/garrysmod_common" \
106+
-DAUTOINSTALL="." \
107+
-DBUILD_SHARED_LIBS=OFF \
108+
-DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" \
109+
-DGIT_BRANCH="$GIT_BRANCH" \
110+
-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
111+
112+
- name: '[x32] Build project (Serverside)'
113+
run: cmake --build build -j -t pgsqloo
114+
115+
- name: '[x64] Download garrysmod_common'
116+
uses: actions/checkout@v3
117+
with:
118+
repository: 'dankmolot/garrysmod_common'
119+
ref: 'x86-64-cmake'
120+
submodules: 'recursive'
121+
path: 'third-party/garrysmod_common64'
122+
123+
- name: '[x64] Configure project (Serverside)'
124+
run: |
125+
cmake -B build64 -S . \
126+
-DGARRYSMOD_COMMON_PATH="third-party/garrysmod_common64" \
127+
-DAUTOINSTALL="." \
128+
-DBUILD_SHARED_LIBS=OFF \
129+
-DGIT_BRANCH="$GIT_BRANCH" \
130+
-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
131+
132+
- name: '[x64] Build project (Serverside)'
133+
run: cmake --build build64 -j -t pgsqloo
134+
135+
- name: "Upload artifacts"
136+
uses: actions/upload-artifact@v3
137+
with:
138+
name: Linux
139+
path: |
140+
./*.dll
141+
if-no-files-found: error

0 commit comments

Comments
 (0)