Package & Upload #43
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 Extension | |
on: | |
push: | |
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: "master" | |
sm_branch: "master" | |
sdks_to_fetch: 'tf2 dods' | |
- 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: 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 -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 | |
- name: Get commit SHA | |
uses: benjlevesque/[email protected] | |
id: short-sha | |
- name: Prepare Package Directory | |
shell: bash | |
run: | | |
mkdir -p ${{ github.workspace }}/output/addons/sourcemod/configs/ | |
mkdir -p ${{ github.workspace }}/output/addons/sourcemod/gamedata/ | |
mkdir -p ${{ github.workspace }}/output/addons/sourcemod/extensions/x64/ | |
mkdir -p ${{ github.workspace }}/output/addons/sourcemod/scripting/ | |
mkdir -p ${{ github.workspace }}/output/addons/sourcemod/translations/ | |
rsync -rv ${{ github.workspace }}/navbot/configs/* ${{ github.workspace }}/output/addons/sourcemod/configs/ | |
rsync -rv ${{ github.workspace }}/navbot/gamedata/* ${{ github.workspace }}/output/addons/sourcemod/gamedata/ | |
rsync -rv ${{ github.workspace }}/navbot/scripting/* ${{ github.workspace }}/output/addons/sourcemod/scripting/ | |
rsync -rv ${{ github.workspace }}/navbot/translations/* ${{ github.workspace }}/output/addons/sourcemod/translations/ | |
rsync -rv ${{ github.workspace }}/navbot/translations/* ${{ github.workspace }}/output/addons/sourcemod/translations/ | |
cp ${{ github.workspace }}/navbot/navbot.autoload ${{ github.workspace }}/output/addons/sourcemod/extensions/ | |
rsync -rv ${{ github.workspace }}/navbot/build/bin/x86/release/*.${{ matrix.libsym_ext }} ${{ github.workspace }}/output/addons/sourcemod/extensions/ | |
rsync -rv ${{ github.workspace }}/navbot/build/bin/x86/release/*.${{ matrix.dbgsym_ext }} ${{ github.workspace }}/output/addons/sourcemod/extensions/ | |
rsync -rv ${{ github.workspace }}/navbot/build/bin/x86_64/release/*.${{ matrix.libsym_ext }} ${{ github.workspace }}/output/addons/sourcemod/extensions/x64/ | |
rsync -rv ${{ github.workspace }}/navbot/build/bin/x86_64/release/*.${{ matrix.dbgsym_ext }} ${{ github.workspace }}/output/addons/sourcemod/extensions/x64/ | |
- name: Upload a Build Artifact | |
uses: actions/[email protected] | |
with: | |
name: navbot-${{ matrix.package_name }}-${{ steps.short-sha.outputs.sha }} | |
path: | | |
output/* | |