diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c5aa71f1..cd2c1ea3 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,26 @@ 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 dpkg --add-architecture i386 - sudo apt-get update - sudo apt-get install nasm:i386 + 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 - - 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 + python3 tests/run_map_rotation.py + python3 tests/run_map_voting.py - - 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 +53,7 @@ jobs: uses: ilammy/setup-nasm@v1 - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: fetch-depth: 0 @@ -101,48 +70,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 }}