Skip to content

Revise natives code #127

Revise natives code

Revise natives code #127

Workflow file for this run

name: Extension builder
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-latest, windows-2019, windows-latest]
include:
- os: ubuntu-20.04
release: true
cc: clang-8
cxx: clang++-8
- os: ubuntu-latest
release: false
cc: clang
cxx: clang++
- os: windows-2019
release: true
cc: msvc
- os: windows-latest
release: false
cc: msvc
fail-fast: false
name: ${{ matrix.os }} - ${{ matrix.cc }}
runs-on: ${{ matrix.os }}
env:
# We currently only support tf2 - however when we support more sdks
# we will have to deal with the special case of our custom tf2 + AM's sdks
SDKS: '["tf2"]'
MMSOURCE_VERSION: '1.10'
SOURCEMOD_VERSION: '1.11'
CACHE_PATH: ${{ github.workspace }}/cache
steps:
- uses: actions/checkout@v2
name: Repository checkout
with:
fetch-depth: 0
path: CBaseNPC
- uses: actions/checkout@v2
name: Sourcemod checkout
with:
repository: alliedmodders/sourcemod
ref: ${{ env.SOURCEMOD_VERSION }}-dev
submodules: true
path: cache/sourcemod
- uses: actions/checkout@v2
name: Metamod-Source checkout
with:
repository: alliedmodders/metamod-source
ref: ${{ env.MMSOURCE_VERSION }}-dev
path: cache/metamod
- uses: actions/checkout@v2
name: AMBuild checkout
with:
repository: alliedmodders/ambuild
ref: master
path: cache/ambuild
- uses: actions/checkout@v2
name: Custom TF2 SDK checkout
with:
repository: TF2-DMB/hl2sdk-tf2
ref: tf2
path: cache/hl2sdk-tf2
#- uses: actions/cache@v2
# name: Setup cache
# with:
# path: ${{ env.CACHE_PATH }}
# key: ${{ runner.os }}-mms_${{ env.MMSOURCE_VERSION }}-sm_${{ env.SOURCEMOD_VERSION }}-${{ join(fromJSON(env.SDKS), '') }}
# restore-keys: |
# ${{ runner.os }}-mms_${{ env.MMSOURCE_VERSION }}-sm_${{ env.SOURCEMOD_VERSION }}-${{ join(fromJSON(env.SDKS), '') }}
- uses: actions/setup-python@v2
name: Setup Python 3.8
with:
python-version: 3.8
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Setup AMBuild
working-directory: cache
shell: bash
run: |
pip install ./ambuild
- name: Linux dependencies
if: startsWith(runner.os, 'Linux')
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
gcc-multilib g++-multilib libstdc++6 lib32stdc++6 \
libc6-dev libc6-dev-i386 linux-libc-dev \
linux-libc-dev:i386 lib32z1-dev ${{ matrix.cc }}
- name: Select clang compiler
if: startsWith(runner.os, 'Linux')
run: |
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
${{ matrix.cc }} --version
${{ matrix.cxx }} --version
- name: Build
working-directory: CBaseNPC
run: |
mkdir build
cd build
python ../configure.py --enable-auto-versioning --enable-optimize --sdks=${{ join(fromJSON(env.SDKS)) }} --mms-path=${{ env.CACHE_PATH }}/metamod --hl2sdk-root=${{ env.CACHE_PATH }} --sm-path=${{ env.CACHE_PATH }}/sourcemod
ambuild
- name: Upload artifact
if: github.event_name == 'push' && matrix.release
uses: actions/upload-artifact@v1
with:
name: cbasenpc_${{ runner.os }}
path: ${{ github.workspace }}/CBaseNPC/build/package
- name: Upload artifact
if: github.event_name == 'push' && strategy.job-index == 0
uses: actions/upload-artifact@v1
with:
name: cbasenpc_versioning_files
path: ${{ github.workspace }}/CBaseNPC/build/includes
release:
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs: build
steps:
- run: sudo apt-get install -y tree
- name: Download Linux release
uses: actions/download-artifact@v1
with:
name: cbasenpc_Linux
path: cbasenpc_linux
- name: Download Windows release
uses: actions/download-artifact@v1
with:
name: cbasenpc_Windows
path: cbasenpc_windows
- name: Download CBaseNPC verisioning files
uses: actions/download-artifact@v1
with:
name: cbasenpc_versioning_files
path: cbasenpc_versioning_files
- name: Prepare archives
run: |
cd cbasenpc_linux
tar -czf cbasenpc_linux.tar.gz *
cd ../cbasenpc_windows
zip -r cbasenpc_windows.zip .
cd ..
RELEASE="$(cat ./cbasenpc_versioning_files/git_action_release)"
echo "GITHUB_RELEASE_TAG=$RELEASE" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GITHUB_RELEASE_TAG }}
release_name: CBaseNPC ${{ env.GITHUB_RELEASE_TAG }}
body: |
${{ github.event.head_commit.message }}
draft: false
prerelease: false
- name: Upload Linux release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cbasenpc_linux/cbasenpc_linux.tar.gz
asset_name: cbasenpc${{ env.GITHUB_RELEASE_TAG }}_linux.tar.gz
asset_content_type: application/gzip
- name: Upload Windows release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./cbasenpc_windows/cbasenpc_windows.zip
asset_name: cbasenpc${{ env.GITHUB_RELEASE_TAG }}_windows.zip
asset_content_type: application/zip