LICENSE.md -> LICENSE #49
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: C/C++ CI | |
on: | |
push: | |
branches: [master] | |
paths-ignore: | |
- '**.md' | |
- '.github/**' | |
pull_request: | |
types: [opened, reopened, synchronize] | |
release: | |
types: [published] | |
jobs: | |
windows: | |
name: 'Windows' | |
runs-on: windows-2019 | |
env: | |
solution: 'msvc/metamod.sln' | |
buildPlatform: 'Win32' | |
buildRelease: 'Release' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v2 | |
- name: Build | |
run: | | |
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v142 | |
- name: Move files | |
run: | | |
mkdir publish\debug | |
mkdir publish\addons\metamod | |
move msvc\${{ env.buildRelease }}\metamod.dll publish\addons\metamod\metamod.dll | |
move msvc\${{ env.buildRelease }}\metamod.pdb publish\debug\metamod.pdb | |
- name: Deploy artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: win32 | |
path: publish/* | |
linux: | |
name: 'Linux' | |
runs-on: ubuntu-latest | |
container: debian:11-slim | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: | | |
dpkg --add-architecture i386 | |
apt-get update | |
apt-get install -y \ | |
gcc-multilib g++-multilib \ | |
build-essential \ | |
libc6-dev libc6-dev-i386 \ | |
git cmake rsync \ | |
g++ gcc | |
- name: Build using Intel GCC Compiler | |
run: | | |
rm -rf build && cmake -DCMAKE_BUILD_TYPE=COMPAT_GLIBC -B build && cmake --build build -j8 | |
- name: Prepare SDK | |
run: | | |
mkdir -p publish/sdk | |
mkdir -p publish/addons/metamod | |
rsync -a \ | |
--include=dllapi.h \ | |
--include=engine_api.h \ | |
--include=enginecallbacks.h \ | |
--include=h_export.h \ | |
--include=meta_api.h \ | |
--include=mutil.h \ | |
--include=plinfo.h \ | |
--exclude='*' metamod/src/ publish/sdk | |
rsync metamod/extra/config.ini publish/addons/metamod | |
rsync -a metamod/extra/example/ publish/example_plugin | |
rsync -a publish/sdk/ publish/example_plugin/include/metamod | |
- name: Move files | |
run: | | |
mv build/metamod/metamod_i386.so publish/addons/metamod/metamod_i386.so | |
mv metamod/version/appversion.h publish/appversion.h | |
- name: Run GLIBC/ABI version compat test | |
run: | | |
binaries=( | |
"publish/addons/metamod/metamod_i386.so" | |
) | |
bash ./metamod/version/glibc_test.sh ${binaries[@]} | |
if [[ $? -ne 0 ]]; then | |
exit 1 # Assertion failed | |
fi | |
shell: bash | |
- name: Deploy artifacts | |
uses: actions/upload-artifact@v4 | |
id: upload-job | |
with: | |
name: linux32 | |
path: publish/* | |
publish: | |
name: 'Publish' | |
runs-on: ubuntu-latest | |
needs: [windows, linux] | |
steps: | |
- name: Deploying linux artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: linux32 | |
- name: Deploying windows artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: win32 | |
- name: Reading appversion.h | |
run: | | |
if [ -e appversion.h ]; then | |
APP_VERSION=$(cat appversion.h | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g') | |
if [ $? -ne 0 ]; then | |
APP_VERSION="" | |
else | |
# Remove quotes | |
APP_VERSION=$(echo $APP_VERSION | xargs) | |
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV | |
fi | |
fi | |
rm -f appversion.h | |
- name: Packaging binaries | |
id: packaging-job | |
if: | | |
github.event_name == 'release' && | |
github.event.action == 'published' && | |
startsWith(github.ref, 'refs/tags/') | |
run: | | |
7z a -tzip metamod-bin-${{ env.APP_VERSION }}.zip addons/ example_plugin/ sdk/ | |
- name: Publish artifacts | |
uses: softprops/action-gh-release@v2 | |
id: publish-job | |
if: | | |
startsWith(github.ref, 'refs/tags/') && | |
steps.packaging-job.outcome == 'success' | |
with: | |
files: | | |
*.zip |