switch to github actions

This commit is contained in:
Kyle
2022-10-30 17:22:23 +08:00
parent 234a1316ac
commit 57b01040e5
4 changed files with 114 additions and 140 deletions
+114
View File
@@ -0,0 +1,114 @@
name: Build
on:
push:
branches: [ master ]
jobs:
build:
name: Build on ${{ matrix.os_short }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-18.04
- windows-latest
include:
- os: ubuntu-18.04
os_short: linux
- os: windows-latest
os_short: windows
steps:
- name: Setup Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install AMBuild
run: |
python -m pip install --upgrade pip setuptools wheel
pip install git+https://github.com/alliedmodders/ambuild
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib llvm-10 clang-10
- name: Select clang compiler (Linux)
if: runner.os == 'Linux'
run: |
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
clang --version
clang++ --version
- name: Find Visual C++ compilers and make all environment variables global (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
:: See https://github.com/microsoft/vswhere/wiki/Find-VC
for /f "usebackq delims=*" %%i in (`vswhere -latest -property installationPath`) do (
call "%%i"\Common7\Tools\vsdevcmd.bat -arch=x86 -host_arch=x64
)
:: Loop over all environment variables and make them global.
for /f "delims== tokens=1,2" %%a in ('set') do (
echo>>"%GITHUB_ENV%" %%a=%%b
)
- name: Checkout MetaMod
uses: actions/checkout@v2
with:
repository: alliedmodders/metamod-source
path: metamod-source
submodules: recursive
- name: Checkout SourceMod
uses: actions/checkout@v2
with:
repository: alliedmodders/sourcemod
ref: 1.11-dev
path: sourcemod
submodules: recursive
- name: Checkout hl2sdk-csgo
uses: actions/checkout@v2
with:
repository: alliedmodders/hl2sdk
ref: csgo
path: hl2sdk-csgo
- name: Checkout hl2sdk-insurgency
uses: actions/checkout@v2
with:
repository: alliedmodders/hl2sdk
ref: insurgency
path: hl2sdk-insurgency
- name: Checkout Project
uses: actions/checkout@v2
with:
fetch-depth: 99999
path: extension
- name: Build
working-directory: extension
shell: bash
run: |
python -c "import os; print(os.environ['GITCOMMIT'])"
mkdir build && cd build
python ../configure.py --enable-optimize --sdks=csgo
ambuild
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}
path: extension/build/package
-53
View File
@@ -1,53 +0,0 @@
language: cpp
branches:
only:
- master
except:
- /^(?i:release)-.*$/
jobs:
include:
- name: Windows
os: windows
python: 3.7
before_install:
- choco install python --version=3.8.2
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
env:
- SMBRANCH=1.10-dev
- MMBRANCH=1.11-dev
before_script:
- choco install -y visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
script:
- ./build.bat
- name: Linux
dist: bionic
python: 3.7
env:
- SMBRANCH=1.10-dev
- MMBRANCH=1.11-dev
before_script:
- chmod +x ./build.sh
script:
- ./build.sh
before_deploy:
- git config --local user.name "Kxnrl"
- git config --local user.email "[email protected]"
- export TRAVIS_TAG=release-$TRAVIS_OS_NAME-$TRAVIS_BUILD_NUMBER
- git tag $TRAVIS_TAG
deploy:
provider: releases
api_key: $token
file:
- build/package/addons/sourcemod/extensions/TransmitManager.ext.2.csgo.dll
- build/package/addons/sourcemod/extensions/TransmitManager.ext.2.csgo.so
- build/package/addons/sourcemod/extensions/TransmitManager.ext.2.insurgency.dll
- build/package/addons/sourcemod/extensions/TransmitManager.ext.2.insurgency.so
- build/package/addons/sourcemod/scripting/include/TransmitManager.inc
on:
repo: Kxnrl/sm-ext-TransmitManager
skip_cleanup: true
-57
View File
@@ -1,57 +0,0 @@
echo "Set environment"
set EXT_DIR=%cd%
set DEP_DIR=%EXT_DIR%\build-windows
set VCVARSALL="C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
mkdir "%DEP_DIR%"
cd %DEP_DIR%
if "%VSCMD_VER%"=="" (
set MAKE=
set CC=
set CXX=
call %VCVARSALL% x86
)
:: Install ambuild
echo "Install ambuild"
git clone https://github.com/alliedmodders/ambuild
pushd ambuild
python setup.py install
popd
:: Getting sourcemod
echo "Download sourcemod"
git clone https://github.com/alliedmodders/sourcemod --recursive --branch %SMBRANCH% --single-branch sourcemod
pushd sourcemod
set SOURCEMOD=%cd%
popd
:: Getting metamod
echo "Download metamod"
git clone https://github.com/alliedmodders/metamod-source --recursive --branch %MMBRANCH% --single-branch metamod
pushd metamod
set METAMOD=%cd%
popd
:: Getting hl2sdk
echo "Download hl2sdk-csgo"
git clone https://github.com/alliedmodders/hl2sdk --recursive --branch csgo --single-branch hl2sdk-csgo
echo "Download hl2sdk-insurgency"
git clone https://github.com/alliedmodders/hl2sdk --recursive --branch insurgency --single-branch hl2sdk-insurgency
:: Start build
echo "Build"
cd %EXT_DIR%
mkdir build
pushd build
python "%EXT_DIR%/configure.py" --enable-optimize --sm-path "%SOURCEMOD%" --mms-path "%METAMOD%" --hl2sdk-root "%DEP_DIR%" --sdks=csgo,insurgency
ambuild || exit /b %errorlevel%
popd
-30
View File
@@ -1,30 +0,0 @@
#!/bin/bash
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
set -e
EXT_DIR=$(pwd)
#clone ambuild
echo "Installing ambuild ..."
git clone https://github.com/alliedmodders/ambuild $HOME/ambuild
pushd $HOME/ambuild
sudo python setup.py install
popd
#clone sourcemod / metamod / hl2sdk
echo "Installing Sourcemod/Metamod/HL2SDK ..."
git clone https://github.com/alliedmodders/sourcemod --recursive --branch $SMBRANCH --single-branch "$EXT_DIR/sourcemod"
git clone https://github.com/alliedmodders/metamod-source --recursive --branch $MMBRANCH --single-branch "$EXT_DIR/metamod"
git clone https://github.com/alliedmodders/hl2sdk --recursive --branch csgo --single-branch "$EXT_DIR/hl2sdk-csgo"
git clone https://github.com/alliedmodders/hl2sdk --recursive --branch insurgency --single-branch "$EXT_DIR/hl2sdk-insurgency"
#build
mkdir -p "$EXT_DIR/build"
pushd "$EXT_DIR/build"
#CC=clang CXX=clang++
python "$EXT_DIR/configure.py" --enable-optimize --sm-path "$EXT_DIR/sourcemod" --mms-path "$EXT_DIR/metamod" --hl2sdk-root "$EXT_DIR" --sdks=csgo,insurgency
ambuild
popd