From 49968b62996003407e3cdbfbab0f8287eb46d097 Mon Sep 17 00:00:00 2001 From: maxime1907 <19607336+maxime1907@users.noreply.github.com> Date: Sat, 24 Sep 2022 15:50:00 +0200 Subject: [PATCH] feat: add github ci --- .github/workflows/ci.yml | 116 +++++++++++++++++++++++++++++++++++++++ AMBuildScript | 5 -- 2 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..48ea8c7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,116 @@ +name: CI + +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + name: Build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + sourcemod-version: [1.11-dev] + include: + - os: ubuntu-20.04 + target-archs: x86,x86_64 + sdks: css + + 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@v2 + + - name: Checkout + uses: actions/checkout@v2 + with: + path: extension + + - name: Checkout SourceMod + uses: actions/checkout@v2 + with: + repository: alliedmodders/sourcemod + ref: ${{ matrix.sourcemod-version }} + path: sourcemod + submodules: recursive + + - name: Checkout AMBuild + uses: actions/checkout@v2 + with: + repository: alliedmodders/ambuild + path: ambuild + + - name: Checkout sm-ext-common + uses: actions/checkout@v2 + with: + repository: srcdslab/sm-ext-common + path: sourcemod/extensions/sm-ext-common + + - name: Install sourcemod dependencies + run: | + bash sourcemod/tools/checkout-deps.sh -m -s ${{ matrix.sdks }} + + - name: Install AMBuild + uses: BSFishy/pip-action@v1 + with: + packages: ./ambuild + + - 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@v2 + 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@v2 + + - 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 diff --git a/AMBuildScript b/AMBuildScript index 5ea0b7e..ae28314 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -30,11 +30,6 @@ class SDK(object): WinOnly = ['windows'] WinLinux = ['windows', 'linux'] WinLinuxMac = ['windows', 'linux', 'mac'] -CSGO = { - 'windows': ['x86'], - 'linux': ['x86', 'x86_64'], - 'mac': ['x86_64'] -} PossibleSDKs = { 'css': SDK('HL2SDKCSS', '2.css', '6', 'CSS', WinLinuxMac, 'css'),