Bump actions/checkout from 3 to 4 (#11) #50
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: 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] | |
protobuf-version: [v2.5.0] | |
# Before Counter strike 2 changes | |
protobuf-valve-version: [02c5c94089d46fb14d8d94a4791e8cad7eef2d63] | |
include: | |
- os: ubuntu-20.04 | |
target-archs: x86,x86_64 | |
sdks: css,csgo | |
steps: | |
- name: Install Linux packages | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt update | |
sudo apt install -yq --no-install-recommends g++-multilib | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: extension | |
- name: Checkout SourceMod | |
uses: actions/checkout@v4 | |
with: | |
repository: alliedmodders/sourcemod | |
ref: ${{ matrix.sourcemod-version }} | |
path: sourcemod | |
submodules: recursive | |
- name: Checkout AMBuild | |
uses: actions/checkout@v4 | |
with: | |
repository: alliedmodders/ambuild | |
path: ambuild | |
- name: Checkout sm-ext-common | |
uses: actions/checkout@v4 | |
with: | |
repository: srcdslab/sm-ext-common | |
path: sourcemod/extensions/sm-ext-common | |
- name: Checkout valve protobuf | |
uses: actions/checkout@v4 | |
with: | |
repository: SteamDatabase/Protobufs | |
ref: ${{ matrix.protobuf-valve-version }} | |
path: protobuf-valve | |
submodules: recursive | |
- name: Checkout protobuf | |
uses: actions/checkout@v4 | |
with: | |
repository: protocolbuffers/protobuf | |
ref: ${{ matrix.protobuf-version }} | |
path: protobuf | |
submodules: recursive | |
- name: Install AMBuild | |
run: | | |
pip install --user ./ambuild | |
- name: Install sourcemod dependencies | |
run: | | |
bash sourcemod/tools/checkout-deps.sh -m -s ${{ matrix.sdks }} | |
- name: Install protobuf | |
shell: bash | |
run: | | |
export EXTENSION_ROOT_DIR=$(pwd) | |
cd protobuf | |
# sh autogen.sh | |
# Fix because autogen in protobuf 2.5.0 doesnt work anymore | |
autoreconf -f -i -Wall,no-obsolete | |
rm -rf autom4te.cache config.h.in~ | |
# Make sure to compile for 32bit with old ABI for std::string compatibility | |
./configure --prefix=$EXTENSION_ROOT_DIR/protobuf --build=i686-pc-linux-gnu "CFLAGS=-m32 -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14" "CXXFLAGS=-m32 -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14" "LDFLAGS=-m32 -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14" --disable-shared --enable-static | |
make -j 8 | |
make install | |
# Compile .proto files to c++ | |
cd ../protobuf-valve | |
# Counter strike 2 ? | |
# ../protobuf/bin/protoc -I=$PWD -I=$PWD/csgo $PWD/csgo/networksystem_protomessages.proto --cpp_out=$PWD | |
# ../protobuf/bin/protoc -I=$PWD -I=$PWD/csgo $PWD/csgo/network_connection.proto --cpp_out=$PWD | |
# ../protobuf/bin/protoc -I=$PWD -I=$PWD/csgo $PWD/csgo/networkbasetypes.proto --cpp_out=$PWD | |
# CSGO | |
../protobuf/bin/protoc -I=$PWD $PWD/google/protobuf/descriptor.proto --cpp_out=$PWD | |
../protobuf/bin/protoc -I=$PWD -I=$PWD/csgo $PWD/csgo/netmessages.proto --cpp_out=$PWD | |
ls -all | |
- 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 --targets=${{ matrix.target-archs }} --sdks=${{ matrix.sdks }} | |
ambuild | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
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@v4 | |
- 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 |