|
3 | 3 | push:
|
4 | 4 | branches:
|
5 | 5 | - main
|
| 6 | + - dev |
6 | 7 | paths:
|
7 | 8 | - '**.hpp'
|
8 | 9 | - '**.h'
|
|
12 | 13 | - '**.txt'
|
13 | 14 | - '.github/workflows/build.yml'
|
14 | 15 | workflow_dispatch:
|
15 |
| - pull_request: |
16 | 16 |
|
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 |
32 | 21 |
|
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 }} |
80 | 42 |
|
81 |
| - linux: |
82 |
| - runs-on: ubuntu-20.04 # Using ubuntu 20.04 since we want to use old gcc version to ensure compatibility |
83 | 43 | steps:
|
84 |
| - - uses: actions/checkout@v3 |
| 44 | + - uses: actions/checkout@v4 |
85 | 45 | with:
|
86 | 46 | submodules: 'recursive'
|
87 | 47 |
|
88 |
| - - name: Install dependencies |
| 48 | + - name: Install dependencies Ubuntu x86 |
| 49 | + if: ${{ matrix.os == 'ubuntu-20.04' && matrix.arch == 'x86' }} |
89 | 50 | run: |
|
| 51 | + sudo apt update |
90 | 52 | sudo apt install gcc-multilib g++-multilib
|
91 | 53 |
|
92 |
| - - name: '[x32] Download garrysmod_common' |
93 |
| - uses: actions/checkout@v3 |
| 54 | + - name: Download garrysmod_common |
| 55 | + uses: actions/checkout@v4 |
94 | 56 | 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 |
99 | 61 |
|
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}}" |
107 | 64 |
|
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}} |
110 | 67 |
|
111 |
| - - name: '[x32] Configure project (Clientside)' |
| 68 | + - name: Configure project (Clientside) |
112 | 69 | 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}} |
113 | 73 |
|
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' }} |
126 | 76 | 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 {} \; |
179 | 80 |
|
180 | 81 | - name: "Upload artifacts"
|
181 |
| - uses: actions/upload-artifact@v3 |
| 82 | + uses: actions/upload-artifact@v4 |
182 | 83 | with:
|
183 |
| - name: MacOS |
| 84 | + name: ${{matrix.os}}-${{matrix.arch}}-${{env.BUILD_TYPE}} |
184 | 85 | path: |
|
185 | 86 | ./*.dll
|
| 87 | + # ./*.pdb |
186 | 88 | if-no-files-found: error
|
0 commit comments