Merge pull request #20 from Pika-Software/dev #128
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
paths: | |
- '**.hpp' | |
- '**.h' | |
- '**.cpp' | |
- '**.c' | |
- '**.cmake' | |
- '**.txt' | |
- '.github/workflows/build.yml' | |
workflow_dispatch: | |
env: | |
GIT_BRANCH: ${{ github.ref_type == 'branch' && github.ref_name || 'release' }} | |
BUILD_TYPE: RelWithDebInfo | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-20.04] | |
arch: [x64, x86] | |
include: | |
- os: windows-latest | |
arch: x64 | |
CMAKE_ARCH_FLAG: -A x64 | |
- os: windows-latest | |
arch: x86 | |
CMAKE_ARCH_FLAG: -A Win32 | |
- os: ubuntu-20.04 | |
arch: x86 | |
CMAKE_ARCH_FLAG: -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" | |
- os: macos-latest | |
arch: x64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Install dependencies Ubuntu x86 | |
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.arch == 'x86' }} | |
run: | | |
sudo apt update | |
sudo apt install gcc-multilib g++-multilib | |
- name: Download garrysmod_common | |
uses: actions/checkout@v4 | |
with: | |
repository: dankmolot/garrysmod_common | |
ref: ${{ matrix.arch == 'x64' && 'x86-64-cmake' || 'master-cmake' }} | |
submodules: recursive | |
path: third-party/garrysmod_common | |
- name: Configure project | |
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}}" | |
- name: Build project | |
run: cmake --build build -j -t moonloader --config ${{env.BUILD_TYPE}} | |
- name: Configure project (Clientside) | |
run: cmake -B build -S . -DCLIENT_DLL=ON | |
- name: Build project (Clientside) | |
run: cmake --build build -j -t moonloader --config ${{env.BUILD_TYPE}} | |
- name: Strip debug information from binaries and keep them outside (Ubuntu) | |
if: ${{ matrix.os == 'ubuntu-20.04' }} | |
run: | | |
find *.dll -exec objcopy --only-keep-debug {} {}.pdb \; | |
find *.dll -exec objcopy --strip-debug {} \; | |
find *.dll -exec objcopy --add-gnu-debuglink {}.pdb {} \; | |
- name: "Upload artifacts" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{matrix.os}}-${{matrix.arch}}-${{env.BUILD_TYPE}} | |
path: | | |
./*.dll | |
# ./*.pdb | |
if-no-files-found: error |