Skip to content

Update build.yml

Update build.yml #11

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: ${{ (github.ref_type != 'branch' || github.ref_name == 'main') && 'Release' || 'Debug' }}
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"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install dependencies Ubuntu x64
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.arch == 'x64' }}
run: |
sudo apt install libpq-dev
- name: Install dependencies Ubuntu x86
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.arch == 'x86' }}
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install gcc-multilib g++-multilib libpq-dev:i386
- name: Download garrysmod_common
uses: actions/checkout@v3
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 pgsqloo --config ${{env.BUILD_TYPE}}
- name: "Upload artifacts"
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os == 'windows-latest' && 'Windows' || 'Linux' }}
path: |
./*.dll
./*.pdb
if-no-files-found: error