Skip to content

Fix Linux Build Again #110

Fix Linux Build Again

Fix Linux Build Again #110

Workflow file for this run

name: Build Extension
on:
push:
branches: [ '*' ]
tags: [ '*' ]
pull_request:
types: [ opened, reopened, ready_for_review ]
jobs:
build_ext:
name: Build for ${{ matrix.identifier }}
runs-on: ${{ matrix.os_version }}
strategy:
fail-fast: false
matrix:
buildjobs:
- windows-x86
- windows-x64
- linux-stable
include:
- meta_branch: "1.12-dev"
sm_branch: "1.12-dev"
sdks_to_fetch: 'tf2 dods css bms sdk2013 orangebox hl2dm'
- buildjobs: windows-x86
os_version: windows-latest
identifier: 'Windows Latest (x86)'
msvc_arch: 'x86'
package_name: 'windows-x86'
libsym_ext: 'dll'
dbgsym_ext: 'pdb'
premake5action: 'vs2022'
- buildjobs: windows-x64
os_version: windows-latest
identifier: 'Windows Latest (x86-64)'
msvc_arch: 'x64'
package_name: 'windows-x86-64'
libsym_ext: 'dll'
dbgsym_ext: 'pdb'
premake5action: 'vs2022'
- buildjobs: linux-stable
os_version: ubuntu-20.04
identifier: 'Linux'
cc: clang-9
cxx: clang++-9
package_name: 'linux-stable'
libsym_ext: 'so'
dbgsym_ext: 'dbg'
premake5action: 'gmake2'
steps:
- name: Setup Premake5
uses: abel0b/[email protected]
with:
version: "5.0.0-beta2"
- name: Setup Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install Packages (Linux)
if: runner.os == 'Linux'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y ${{ matrix.cc }} ${{ matrix.cxx }} g++-multilib
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
- name: Install MSVC for ${{ matrix.identifier }}
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: ${{ matrix.msvc_arch }}
- name: Fetch Metamod:Source ${{ matrix.meta_branch }}
uses: actions/[email protected]
with:
repository: alliedmodders/metamod-source
ref: ${{ matrix.meta_branch }}
path: mmsource
submodules: recursive
- name: Fetch SourceMod ${{ matrix.sm_branch }}
uses: actions/[email protected]
with:
repository: alliedmodders/sourcemod
ref: ${{ matrix.sm_branch }}
path: sourcemod
submodules: recursive
- name: Fetch SDKs
shell: bash
run: |
mkdir -p alliedmodders
cd alliedmodders
git clone --mirror https://github.com/alliedmodders/hl2sdk hl2sdk-proxy-repo
sdks=(${{ matrix.sdks_to_fetch }})
for sdk in "${sdks[@]}"
do
git clone hl2sdk-proxy-repo -b $sdk hl2sdk-$sdk
done
ls -lah
- name: Fetch Extension
uses: actions/[email protected]
with:
path: navbot
submodules: recursive
- name: Run Premake5 ${{ runner.os }}
run: |
cd ${{ github.workspace }}/navbot/
premake5 --hl2sdk-root="${{ github.workspace }}/alliedmodders" --mms-path="${{ github.workspace }}/mmsource" --sm-path="${{ github.workspace }}/sourcemod" ${{ matrix.premake5action }}
- name: Compile Extension (MSBuild - 32 bits)
if: runner.os == 'Windows' && matrix.msvc_arch == 'x86'
run: |
cd ${{ github.workspace }}/navbot/build/${{ matrix.premake5action }}/
msbuild navbot.sln -maxCpuCount:4 -target:NavBot-TF2,NavBot-DODS,NavBot-SDK2013,NavBot-BMS,NavBot-CSS,NavBot-HL2DM,NavBot-ORANGEBOX -property:Platform=Win32 -property:Configuration=Release
- name: Compile Extension (MSBuild - 64 bits)
if: runner.os == 'Windows' && matrix.msvc_arch == 'x64'
run: |
cd ${{ github.workspace }}/navbot/build/${{ matrix.premake5action }}/
msbuild navbot.sln -maxCpuCount:4 -target:NavBot-TF2 -property:Platform=Win64 -property:Configuration=Release
- name: Compile Extension (Linux)
if: runner.os == 'Linux'
run: |
cd ${{ github.workspace }}/navbot/build/${{ matrix.premake5action }}/
make -j 4 config=release_linux64 NavBot-TF2
make -j 4 config=release_linux32 NavBot-TF2 NavBot-DODS NavBot-SDK2013 NavBot-BMS NavBot-CSS NavBot-HL2DM NavBot-ORANGEBOX
- name: Get commit SHA
uses: benjlevesque/[email protected]
id: short-sha
- name: Run Package Script
run: |
cd ${{ github.workspace }}/navbot/
python3 package.py
- name: Upload Extension as Artifact
uses: actions/[email protected]
with:
name: navbot-${{ matrix.package_name }}-${{ steps.short-sha.outputs.sha }}
path: |
navbot/output/*
compile_plugins:
name: Compile Plugins
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sm_version: [ '1.12.x' ]
steps:
- name: Fetch Extension
uses: actions/[email protected]
with:
path: navbot
submodules: recursive
- name: Get short SHA
uses: benjlevesque/[email protected]
id: short-sha
- name: Setup SourcePawn Compiler ${{ matrix.sm_version }}
id: setup_sp
uses: rumblefrog/setup-sp@master
with:
version: ${{ matrix.sm_version }}
- name: Set environment variables
run: |
echo "SOURCEFILES_PATH=$GITHUB_WORKSPACE/sourcefiles" >> $GITHUB_ENV
echo "TPINCLUDES_PATH=$GITHUB_WORKSPACE/thirdparty/includes" >> $GITHUB_ENV
echo "NAVBOTINC_PATH=$GITHUB_WORKSPACE/navbot/scripting/include" >> $GITHUB_ENV
echo "BUILD_PATH=$GITHUB_WORKSPACE/navbot/scripting" >> $GITHUB_ENV
echo "PACKAGE_PATH=$GITHUB_WORKSPACE/build/package" >> $GITHUB_ENV
echo "CONFIGS_PATH=$GITHUB_WORKSPACE/build/package/addons/sourcemod/configs" >> $GITHUB_ENV
echo "SMDATA_PATH=$GITHUB_WORKSPACE/build/package/addons/sourcemod/data" >> $GITHUB_ENV
echo "GAMEDATA_PATH=$GITHUB_WORKSPACE/build/package/addons/sourcemod/gamedata" >> $GITHUB_ENV
echo "BINARY_PATH=$GITHUB_WORKSPACE/build/package/addons/sourcemod/plugins" >> $GITHUB_ENV
echo "LOC_PATH=$GITHUB_WORKSPACE/build/package/addons/sourcemod/translations" >> $GITHUB_ENV
- name: Create Folders
run: |
echo "Creating folders..."
mkdir -p ${{ env.TPINCLUDES_PATH }}
mkdir -p ${{ env.BUILD_PATH }}
mkdir -p ${{ env.CONFIGS_PATH }}
mkdir -p ${{ env.SMDATA_PATH }}
mkdir -p ${{ env.GAMEDATA_PATH }}
mkdir -p ${{ env.BINARY_PATH }}
mkdir -p ${{ env.LOC_PATH }}
- name: Compile Plugins
working-directory: ${{ env.BUILD_PATH }}
run: |
for file in *.sp; do
echo -e "\nCompiling $file..."
spcomp -O2 -v2 -i ${{ env.TPINCLUDES_PATH }}/ -i ${{ env.NAVBOTINC_PATH }}/ $file
done
echo "===OUT FILES==="
ls -lah *.smx
- name: Move Compiled Plugins to Package Directory
run: |
rsync -rv ${{ env.BUILD_PATH }}/*.smx ${{ env.BINARY_PATH }}/
- name: Upload Compiled Plugins Artifact
uses: actions/[email protected]
with:
name: navbot-sm-plugins-${{ steps.short-sha.outputs.sha }}
path: |
build/package/*
do_release:
name: Create GH Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [ build_ext, compile_plugins ]
steps:
- name: Create Folders
run: |
mkdir -p ${{ github.workspace }}/upload/
mkdir -p ${{ github.workspace }}/download/windows/
mkdir -p ${{ github.workspace }}/download/linux/
mkdir -p ${{ github.workspace }}/download/shared/
- name: Download Artifacts (Windows)
uses: actions/[email protected]
with:
pattern: '*windows*'
merge-multiple: true
path: ${{ github.workspace }}/download/windows/
- name: Download Artifacts (Linux)
uses: actions/[email protected]
with:
pattern: '*linux*'
merge-multiple: true
path: ${{ github.workspace }}/download/linux/
- name: Download Artifacts (Shared)
uses: actions/[email protected]
with:
pattern: '*sm-plugins*'
merge-multiple: true
path: ${{ github.workspace }}/download/shared/
- name: Create Package
run: |
cd ${{ github.workspace }}/download/windows/
rsync -rv ${{ github.workspace }}/download/shared/* ${{ github.workspace }}/download/windows/
7z a -r "navbot-windows-${{ github.ref_name }}.7z" addons
ls -lah
mv *.7z ${{ github.workspace }}/upload/
cd ${{ github.workspace }}/download/linux/
rsync -rv ${{ github.workspace }}/download/shared/* ${{ github.workspace }}/download/linux/
tar -czf "navbot-linux-${{ github.ref_name }}.tar.gz" --owner=0 --group=0 addons
ls -lah
mv *.tar.gz ${{ github.workspace }}/upload/
- name: Create Pre-release
uses: softprops/[email protected]
if: contains(github.ref_name, 'pr') == true
with:
name: "NavBot ${{ github.ref_name }}"
generate_release_notes: true
prerelease: true
files: |
upload/*.7z
upload/*.tar.gz
- name: Create Release
uses: softprops/[email protected]
if: contains(github.ref_name, 'pr') == false
with:
name: "NavBot ${{ github.ref_name }}"
generate_release_notes: true
prerelease: false
files: |
upload/*.7z
upload/*.tar.gz