feat: github ci
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-20.04]
|
||||
sourcemod-version: [1.11-dev]
|
||||
libboost-version: [boost-1.82.0]
|
||||
python-version: ['3.10']
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
compiler_cc: clang
|
||||
compiler_cxx: clang++
|
||||
|
||||
steps:
|
||||
- name: Install Linux packages
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -yq --no-install-recommends g++-multilib ${{ matrix.compiler_cc }}
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: extension
|
||||
|
||||
- name: Checkout SourceMod ${{ matrix.sourcemod-version }}
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: alliedmodders/sourcemod
|
||||
ref: ${{ matrix.sourcemod-version }}
|
||||
path: sourcemod
|
||||
submodules: recursive
|
||||
|
||||
- name: Download libboost ${{ matrix.libboost-version }}
|
||||
run: |
|
||||
curl -L https://github.com/boostorg/boost/releases/download/${{ matrix.libboost-version }}/${{ matrix.libboost-version }}.tar.gz -o libboost.tar.gz
|
||||
tar -xvf libboost.tar.gz && rm libboost.tar.gz
|
||||
mv ${{ matrix.libboost-version }} libboost
|
||||
|
||||
- name: Install AMBuild
|
||||
run: |
|
||||
python -m pip install wheel
|
||||
pip install git+https://github.com/alliedmodders/ambuild
|
||||
|
||||
- name: Install sourcemod dependencies
|
||||
run: |
|
||||
bash sourcemod/tools/checkout-deps.sh -m -s ${{ matrix.sdks }}
|
||||
|
||||
- name: Select clang compiler
|
||||
if: startsWith(runner.os, 'Linux')
|
||||
run: |
|
||||
echo "CC=${{ matrix.compiler_cc }}" >> $GITHUB_ENV
|
||||
echo "CXX=${{ matrix.compiler_cxx }}" >> $GITHUB_ENV
|
||||
${{ matrix.compiler_cc }} --version
|
||||
${{ matrix.compiler_cxx }} --version
|
||||
|
||||
- name: Build libboost
|
||||
working-directory: libboost
|
||||
run: |
|
||||
./bootstrap.sh --prefix=build --with-libraries=thread,system
|
||||
./b2 -j8 cflags=-m32 cxxflags=-m32 address-model=32 threading=multi architecture=x86 instruction-set=i686 link=static runtime-link=static
|
||||
./b2 install
|
||||
|
||||
- name: Build
|
||||
working-directory: extension
|
||||
shell: bash
|
||||
env:
|
||||
BREAKPAD_SYMBOL_SERVER: ${{ secrets.BREAKPAD_SYMBOL_SERVER }}
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
python ../configure.py --enable-optimize --symbol-files
|
||||
ambuild
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ runner.os }}
|
||||
path: extension/build/package
|
||||
|
||||
release:
|
||||
name: Release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`
|
||||
ls -Rall
|
||||
if [ -d "./Linux/" ]; then
|
||||
cd ./Linux/
|
||||
tar -czf ../${{ github.event.repository.name }}-${version}-linux.tar.gz -T <(\ls -1)
|
||||
cd -
|
||||
fi
|
||||
if [ -d "./macOS/" ]; then
|
||||
cd ./macOS/
|
||||
tar -czf ../${{ github.event.repository.name }}-${version}-mac.tar.gz -T <(\ls -1)
|
||||
cd -
|
||||
fi
|
||||
if [ -d "./Windows/" ]; then
|
||||
cd ./Windows/
|
||||
tar -czf ../${{ github.event.repository.name }}-${version}-windows.tar.gz -T <(\ls -1)
|
||||
cd -
|
||||
fi
|
||||
|
||||
- name: Release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: '*.tar.gz'
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
Reference in New Issue
Block a user