Skip to content

Update build.yml

Update build.yml #26

Workflow file for this run

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: --preset=x64-windows
- os: windows-latest
arch: x86
CMAKE_ARCH_FLAG: --preset=x86-windows
- os: ubuntu-20.04
arch: x64
CMAKE_ARCH_FLAG: --preset=unix
- os: ubuntu-20.04
arch: x86
CMAKE_ARCH_FLAG: --preset=unix -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" -DVCPKG_TARGET_TRIPLET=x86-linux
- os: macos-13
arch: x64
CMAKE_ARCH_FLAG: --preset=unix
runs-on: ${{ matrix.os }}
steps:
- uses: lukka/get-cmake@latest
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: lukka/run-vcpkg@v11
- 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="." -DGIT_BRANCH="${{env.GIT_BRANCH}}" -DCMAKE_BUILD_TYPE="${{env.BUILD_TYPE}}"
- name: Build project
run: cmake --build build -j -t async_postgres --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