From 4c3b902701b39d04e6217865dfe0d10213e05547 Mon Sep 17 00:00:00 2001 From: ghptc Date: Mon, 26 Oct 2026 17:19:46 -0300 Subject: [PATCH 1/3] ci(engine): require tests in hosted build and retire publication --- .github/workflows/build.yml | 103 ++++++------------------------------ 1 file changed, 16 insertions(+), 87 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c5aa71f1..f4d55dac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,8 @@ name: build +permissions: + contents: read + on: push: branches: @@ -15,60 +18,31 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: fetch-depth: 0 - name: Set up needed libs run: | sudo apt-get update - sudo apt-get install g++-multilib gcc-multilib + sudo apt-get install -y g++-multilib gcc-multilib sudo dpkg --add-architecture i386 sudo apt-get update - sudo apt-get install nasm:i386 + sudo apt-get install -y nasm - name: Build server run: make - - name: Check version difference - if: ${{ !github.head_ref }} - run: | - ver=$(grep '\#define SYS_COMMONVERSION' src/version/version.c | cut -d' ' -f3) - git checkout HEAD~1 src/version/version.c - ver_last=$(grep '\#define SYS_COMMONVERSION' src/version/version.c | cut -d' ' -f3) - if [[ $ver != $ver_last ]]; then - echo "publish_tag=${ver}" >> $GITHUB_ENV - fi - - - name: Build plugins - if: ${{ env.publish_tag }} - run: make plugins - - - name: Pack plugins - if: ${{ env.publish_tag }} - run: | - cd plugins - mkdir plugins - cp screenshotsender/nehoscreenshotuploader.so plugins/ - cp censor/censor.so plugins/ - cp cod4x_b3hide/b3hide.so plugins/ - cp simplebanlist/simplebanlist.so plugins/ - cp pchat/pchat.so plugins/ - cp sourcebansplugin/sourcebansplugin.so plugins/ - cp warn/warn.so plugins/ - cp legacybanlist/legacybanlist.so plugins/ - 7z a plugins_linux.zip plugins/* - cd ../ + - name: Engine tests + run: | + python3 -m unittest discover -s tests -p 'test_*.py' + gcc -Wall -Wextra -Werror tests/test_bot_policy.c -o /tmp/bot-policy + /tmp/bot-policy + for test in map_rotation map_voting; do + gcc -m32 -std=gnu11 -fno-pie -no-pie -ffunction-sections -fdata-sections -Wl,--gc-sections tests/test_$test.c -o /tmp/$test + /tmp/$test + done - - name: Publish release - if: ${{ env.publish_tag }} - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - tag: ${{ env.publish_tag }} - artifacts: "bin/cod4x18_dedrun,plugins/plugins_linux.zip" - token: ${{ secrets.GITHUB_TOKEN }} - windows: name: Windows runs-on: windows-latest @@ -84,7 +58,7 @@ jobs: uses: ilammy/setup-nasm@v1 - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: fetch-depth: 0 @@ -101,48 +75,3 @@ jobs: $env:Path += $path mingw32-make - - name: Check version difference - if: ${{ !github.head_ref }} - run: | - $line = Get-Content src/version/version.c | Select-String -Pattern "#define SYS_COMMONVERSION" - $ver = $line.Line.Split( ' ' )[ 2 ] - git checkout HEAD~1 src/version/version.c - $line = Get-Content src/version/version.c | Select-String -Pattern "#define SYS_COMMONVERSION" - $ver_last = $line.Line.Split( ' ' )[ 2 ] - if( $ver -ne $ver_last ) - { - echo "publish_tag=$ver" >> $env:GITHUB_ENV - } - - - name: Build plugins - if: ${{ env.publish_tag }} - run: | - $path = $env:Path - $env:Path = "C:\mingw32\bin;" - $env:Path += $path - mingw32-make plugins - - - name: Pack plugins - if: ${{ env.publish_tag }} - run: | - cd plugins - mkdir plugins - Copy-Item -Path screenshotsender/nehoscreenshotuploader.dll -Destination plugins/ - Copy-Item -Path censor/censor.dll -Destination plugins/ - Copy-Item -Path cod4x_b3hide/b3hide.dll -Destination plugins/ - Copy-Item -Path simplebanlist/simplebanlist.dll -Destination plugins/ - Copy-Item -Path pchat/pchat.dll -Destination plugins/ - Copy-Item -Path sourcebansplugin/sourcebansplugin.dll -Destination plugins/ - Copy-Item -Path warn/warn.dll -Destination plugins/ - Copy-Item -Path legacybanlist/legacybanlist.dll -Destination plugins/ - 7z a -y plugins_windows.zip plugins/* - cd ../ - - - name: Publish release - if: ${{ env.publish_tag }} - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - tag: ${{ env.publish_tag }} - artifacts: "bin/cod4x18_dedrun.exe,plugins/plugins_windows.zip" - token: ${{ secrets.GITHUB_TOKEN }} From 35347e942b7dd95d6bf14465ab2de98d1dac76ec Mon Sep 17 00:00:00 2001 From: ghptc Date: Mon, 26 Oct 2026 17:23:43 -0300 Subject: [PATCH 2/3] fix(ci): run existing linked native test harnesses --- .github/workflows/build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4d55dac..fb20bd48 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,10 +38,8 @@ jobs: python3 -m unittest discover -s tests -p 'test_*.py' gcc -Wall -Wextra -Werror tests/test_bot_policy.c -o /tmp/bot-policy /tmp/bot-policy - for test in map_rotation map_voting; do - gcc -m32 -std=gnu11 -fno-pie -no-pie -ffunction-sections -fdata-sections -Wl,--gc-sections tests/test_$test.c -o /tmp/$test - /tmp/$test - done + python3 tests/run_map_rotation.py + python3 tests/run_map_voting.py windows: name: Windows From a08696f926873221e891ca36a7495713584cd3de Mon Sep 17 00:00:00 2001 From: ghptc Date: Mon, 26 Oct 2026 17:28:38 -0300 Subject: [PATCH 3/3] fix(ci): install multilib without a redundant foreign package index --- .github/workflows/build.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb20bd48..cd2c1ea3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,11 +24,8 @@ jobs: - name: Set up needed libs run: | - sudo apt-get update - sudo apt-get install -y g++-multilib gcc-multilib - sudo dpkg --add-architecture i386 - sudo apt-get update - sudo apt-get install -y nasm + sudo apt-get -o Acquire::Retries=2 -o Acquire::http::Timeout=30 update + sudo apt-get install -y g++-multilib gcc-multilib nasm - name: Build server run: make