Skip to content

Update build.yml

Update build.yml #79

Workflow file for this run

name: Build
on: [push]
jobs:
create_release:
runs-on: ubuntu-latest
steps:
- name: Create release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
id: create_release
build_windows:
needs: [create_release]
runs-on: windows-latest
strategy:
matrix:
triplet: [x86-windows, x64-windows]
gmod_side: [sv, cl]
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
GMOD_SIDE: ${{ matrix.gmod_side }}
steps:
- uses: actions/checkout@v4
- uses: lukka/[email protected]
- uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: a34c873a9717a888f58dc05268dea15592c2f0ff
- uses: lukka/run-cmake@v10
with:
configurePreset: ninja-multi-vcpkg
buildPreset: ninja-multi-vcpkg
buildPresetAdditionalArgs: "['--config Release']"
- name: Upload release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
tag_name: ${{ needs.create_release.outputs.tag-name }}
fail_on_unmatched_files: true
files: "builds/ninja-multi-vcpkg/bin/release/*.dll"
build_linux:
needs: [create_release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: |
set -ex
mkdir out
sudo apt-get update
sudo apt-get -y install gcc-multilib g++-multilib cmake
runbuild() {
mkdir build
pushd build
cmake ..
make -j$(nproc)
mv module/*.dll ../out
popd
rm -rf build
}
runbuild_clsv() {
export GMOD_SIDE="cl"
runbuild
export GMOD_SIDE="sv"
runbuild
}
export CFLAGS_BASE="-fPIC -s -flto -O2"
export CFLAGS="${CFLAGS_BASE}"
export CXXFLAGS="${CFLAGS}"
export LDFLAGS="${CFLAGS}"
runbuild_clsv
export CFLAGS="${CFLAGS_BASE} -m32"
export CXXFLAGS="${CFLAGS}"
export LDFLAGS="${CFLAGS}"
runbuild_clsv
- name: Upload release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
tag_name: ${{ needs.create_release.outputs.tag-name }}
fail_on_unmatched_files: true
files: "out/*.dll"
build_macos:
needs: [create_release]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: |
set -ex
mkdir out
runbuild() {
mkdir build
pushd build
cmake ..
make -j$(sysctl -n hw.logicalcpu)
mv module/*.dll ../out
popd
rm -rf build
}
runbuild_clsv() {
export GMOD_SIDE="cl"
runbuild
export GMOD_SIDE="sv"
runbuild
}
export CFLAGS="-fPIC -flto -O2"
export CXXFLAGS="${CFLAGS}"
export LDFLAGS="${CFLAGS}"
runbuild_clsv
- name: Upload release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
tag_name: ${{ needs.create_release.outputs.tag-name }}
fail_on_unmatched_files: true
files: "out/*.dll"