Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
79 changes: 37 additions & 42 deletions .github/workflows/build-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
required: true
cxx:
type: string
sourcemod-branch:
type: string
required: true
upload:
type: boolean
required: false
Expand All @@ -22,81 +25,73 @@ on:
type: boolean
required: false
default: false
cache-key:
type: string
required: true
cache-dir:
Comment on lines -25 to -28

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the cache being removed ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion the cache didn't really add much. A shallow checkout is already quite fast and with build-containers, AMBuild is now preinstalled, so one less checkout on Linux.

One pinned revision couldn't have built 1.12 and 1.13 at once anyway. If desired, I can pin the SourceMod checkout to a fixed commit (that doesn't need the cache back), but I fear it will drift too far again like the 2023 one did. After all, isn't it (part of) the CI's purpose to report breakage due to dependency updates?

That said, this is probably the most opinionated change and I can restore the cache if needed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI's purpose to report breakage due to dependency updates

That is true if we did build against dev SM, but since we were not. Cache here did make sense.
For the newly introduced 1.13 builds by the PR, you can omit the cache. But I would like to retain the cache for stable SM.

container:
type: string
required: true
required: false

jobs:
build:
name: Accelerator Extension ${{ inputs.os }}-${{ inputs.cc }}
name: ${{ inputs.os }}-${{ inputs.cc }}
runs-on: ${{ inputs.os }}
container: ${{ inputs.container }}

env:
SOURCEMOD: ${{ github.workspace }}/${{ inputs.cache-dir }}/sourcemod
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
fetch-depth: 0
submodules: true
submodules: recursive

- name: Retrieve the cache
id: cache
uses: actions/cache@v4
- name: SourceMod checkout
uses: actions/checkout@v7
with:
path: ${{ inputs.cache-dir }}
key: ${{ inputs.cache-key }}
fail-on-cache-miss: true
enableCrossOsArchive: true

repository: alliedmodders/sourcemod
ref: ${{ inputs.sourcemod-branch }}
submodules: recursive
path: sourcemod
fetch-depth: 1

- name: Resolve SourceMod path
shell: bash
run: echo "SOURCEMOD=$GITHUB_WORKSPACE/sourcemod" >> $GITHUB_ENV

- name: Linux dependencies
if: startsWith(runner.os, 'Linux')
shell: bash
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
dpkg --add-architecture i386
apt-get update
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 \
zlib1g-dev:i386 zlib1g-dev ${{ inputs.cc }}
zlib1g-dev:i386 zlib1g-dev

- name: Select clang compiler
- name: Select compiler
if: startsWith(runner.os, 'Linux')
shell: bash
run: |
echo "CC=${{ inputs.cc }}" >> $GITHUB_ENV
echo "CXX=${{ inputs.cxx }}" >> $GITHUB_ENV
${{ inputs.cc }} --version
${{ inputs.cxx }} --version

- uses: actions/setup-python@v5
name: Setup Python 3.10
with:
python-version: '3.10'

- name: Install AMBuild
if: ${{ inputs.container == '' }}
shell: bash
run: |
python -m pip install --upgrade pip setuptools wheel
pip install ./${{ inputs.cache-dir }}/ambuild

- name: Build (Debug)
if: ${{ inputs.debug }}
run: |
mkdir -p build && cd build
python ../configure.py --enable-debug
ambuild
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install git+https://github.com/alliedmodders/ambuild

- name: Build (Release)
if: not ${{ inputs.debug }}
- name: Build
shell: bash
run: |
mkdir -p build && cd build
python ../configure.py --enable-optimize
python3 ../configure.py ${{ inputs.debug && '--enable-debug' || '--enable-optimize' }}
ambuild

- name: Upload package
if: ${{ inputs.upload }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ inputs.upload-artifact-name }}
path: build/package
path: build/package
57 changes: 0 additions & 57 deletions .github/workflows/cache.yml

This file was deleted.

79 changes: 45 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,56 @@ name: CI
on:
workflow_dispatch:
workflow_call:
inputs:
release:
type: boolean
required: true
default: false

jobs:
cache:
uses: ./.github/workflows/cache.yml

build-options:
runs-on: ubuntu-latest
outputs:
exclude: ${{ steps.set.outputs.exclude }}
steps:
- id: set
run: |
echo "exclude=[${{ inputs.release && '{"runners": { "upload": false } }' || '' }}]" >> $GITHUB_OUTPUT

build:
name: Build
needs: [ cache, build-options ]
sm112:
name: SM 1.12
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cc: clang-22
cxx: clang++-22
container: 'ghcr.io/alliedmodders/build-containers/debian11-clang22:latest'
artifact: accelerator_sm112_linux
- os: windows-latest
cc: msvc
cxx: msvc
container: ''
artifact: accelerator_sm112_windows
uses: ./.github/workflows/build-extension.yml
with:
os: ${{ matrix.os }}
cc: ${{ matrix.cc }}
cxx: ${{ matrix.cxx }}
container: ${{ matrix.container }}
sourcemod-branch: '1.12-dev'
upload: true
upload-artifact-name: ${{ matrix.artifact }}

sm113:
name: SM 1.13
strategy:
fail-fast: false
matrix:
runners: [
{ os: ubuntu-22.04, cc: clang, cxx: clang++, upload: true, upload-artifact-name: accelerator_linux },
{ os: ubuntu-latest, cc: clang, cxx: clang++, upload: false },
{ os: windows-latest, cc: msvc, cxx: msvc, upload: true, upload-artifact-name: accelerator_windows }
]
exclude: ${{ fromJson(needs.build-options.outputs.exclude) }}

include:
- os: ubuntu-latest
cc: clang-22
cxx: clang++-22
container: 'ghcr.io/alliedmodders/build-containers/debian11-clang22:latest'
artifact: accelerator_sm113_linux
- os: windows-latest
cc: msvc
cxx: msvc
container: ''
artifact: accelerator_sm113_windows
uses: ./.github/workflows/build-extension.yml
with:
os: ${{ matrix.runners.os }}
cc: ${{ matrix.runners.cc }}
cxx: ${{ matrix.runners.cxx }}
upload: ${{ matrix.runners.upload }}
upload-artifact-name: ${{ matrix.runners.upload-artifact-name }}
cache-key: ${{ needs.cache.outputs.key }}
cache-dir: ${{ needs.cache.outputs.dir }}
os: ${{ matrix.os }}
cc: ${{ matrix.cc }}
cxx: ${{ matrix.cxx }}
container: ${{ matrix.container }}
sourcemod-branch: 'master'
upload: true
upload-artifact-name: ${{ matrix.artifact }}
2 changes: 0 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ on:
jobs:
main-ci:
uses: ./.github/workflows/ci.yml
with:
release: false
Comment thread
Kenzzer marked this conversation as resolved.
35 changes: 23 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,33 @@ on:
jobs:
main-ci:
uses: ./.github/workflows/ci.yml
with:
release: true
Comment thread
Kenzzer marked this conversation as resolved.

release:
permissions: write-all
permissions:
contents: read
runs-on: ubuntu-latest
needs: [ main-ci ]

env:
PROJECT: 'accelerator'
UPLOAD_PASSWORD: ${{ secrets.UPLOAD_PASSWORD }}
steps:
- run: sudo apt-get install -y tree

- uses: actions/checkout@v4
- uses: actions/checkout@v7
name: Repository checkout
with:
fetch-depth: 0
path: repository

- name: Download Linux release
uses: actions/download-artifact@v5
uses: actions/download-artifact@v8
with:
name: accelerator_linux
name: accelerator_sm112_linux
Comment thread
Mikusch marked this conversation as resolved.
Outdated
path: linux

- name: Download Windows release
uses: actions/download-artifact@v5
uses: actions/download-artifact@v8
with:
name: accelerator_windows
name: accelerator_sm112_windows
Comment thread
Mikusch marked this conversation as resolved.
Outdated
path: windows

- name: Zip release again
Expand All @@ -55,10 +53,11 @@ jobs:
echo "LINUX_ZIP=${LINUX_ZIP}" >> $GITHUB_ENV

- name: Upload release
if: env.UPLOAD_PASSWORD != ''
Comment thread
Kenzzer marked this conversation as resolved.
shell: bash
run: |
echo "Begin upload for branch (${{ github.ref_name }})"
AUTHORIZATION="$(echo -n 'builds:${{ secrets.UPLOAD_PASSWORD }}' | base64)"
AUTHORIZATION="$(echo -n "builds:${UPLOAD_PASSWORD}" | base64)"
Comment thread
Kenzzer marked this conversation as resolved.
echo "::add-mask::${AUTHORIZATION}"

echo "Uploading ${{ env.WINDOWS_ZIP }}"
Expand All @@ -74,3 +73,15 @@ jobs:
exit 1
fi
echo "Upload successful!"

- name: Upload Windows artifact
uses: actions/upload-artifact@v7
with:
path: ${{ env.WINDOWS_ZIP }}
archive: false

- name: Upload Linux artifact
uses: actions/upload-artifact@v7
with:
path: ${{ env.LINUX_ZIP }}
archive: false
7 changes: 4 additions & 3 deletions AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class AcceleratorConfig(object):
]

cxx.cxxflags += [
'-std=c++17',
'-std=c++20',
'-fno-threadsafe-statics',
'-Wno-non-virtual-dtor',
'-Wno-overloaded-virtual',
Expand All @@ -128,7 +128,7 @@ class AcceleratorConfig(object):

cxx.cxxflags += [
'/EHsc',
'/std:c++17'
'/std:c++20'
]

return
Expand Down Expand Up @@ -158,7 +158,8 @@ class AcceleratorConfig(object):
os.path.join(self.sm_root, 'public', 'extensions'),
os.path.join(self.sm_root, 'public', 'amtl', 'amtl'),
os.path.join(self.sm_root, 'public', 'amtl'),
os.path.join(self.sm_root, 'sourcepawn', 'include')
os.path.join(self.sm_root, 'sourcepawn', 'include'),
os.path.join(self.sm_root, 'sourcepawn', 'vm')
]

def link_libz(self, compiler, context):
Expand Down
Loading