diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml new file mode 100644 index 0000000000..5dd9d2709c --- /dev/null +++ b/.github/workflows/build_test.yml @@ -0,0 +1,152 @@ +# Documentation: https://wiki.unvanquished.net/wiki/Continuous_integration + +name: Build and test + +on: + push: + branches: + - master + - 'for-*.*.*/sync' # Next-release branch + pull_request: + branches: + - '**' + paths: + - .github/workflows/build_test.yml + # The rest of this list should stay in sync with .appveyor.yml + - 'src/**' + - 'libs/**' + - 'cmake/**' + - CMakeLists.txt + - '**.cmake' + - .gitmodules + +jobs: + mac: + name: Mac + runs-on: macos-15-intel + steps: + - uses: actions/checkout@v7 + + - name: Check out submodules + shell: bash + env: + # For example: "master" (on pull requests only) + PR_TARGET_BRANCH: ${{ github.base_ref }} + # Target branch name, on pull requests only. Even if the branch comes from an external + # repo it is just the bare branch name, for example "new-feature". + PR_SOURCE_BRANCH: ${{ github.head_ref }} + # For example: "master" for a build of the 'master' branch + # Other formats exist for builds on pull requests + BUILD_SOURCE_BRANCH: ${{ github.ref_name }} + # "push" or "pull_request" (see 'on:') + EVENT_NAME: ${{ github.event_name }} + run: | + set -e + echo "Variables: PR_TARGET_BRANCH=${PR_TARGET_BRANCH} PR_SOURCE_BRANCH=${PR_SOURCE_BRANCH} BUILD_SOURCE_BRANCH=${BUILD_SOURCE_BRANCH}" + curl -fsSL https://gitlab.com/illwieckz/git-checkout-modules/raw/master/git-checkout-modules -o ~/git-checkout-modules + SYNC_ARGS=() + if [[ "$EVENT_NAME" == pull_request ]]; then + SYNC_ARGS=("--sub-ref=${PR_TARGET_BRANCH}:has=/sync" "--sub-ref=${PR_SOURCE_BRANCH}:has=/sync") + else # It is a branch build + SYNC_ARGS=("--sub-ref=${BUILD_SOURCE_BRANCH}:has=/sync") + fi + echo "${#SYNC_ARGS[@]} branch-name-based checkout arg(s): ${SYNC_ARGS[@]}" + bash ~/git-checkout-modules --update "${SYNC_ARGS[@]}" --print + + - name: Build + shell: bash + run: | + set -e + set -x + cmake --version + export CFLAGS='-Wno-c++14-extensions' + export CXXFLAGS='-Wno-c++14-extensions' + cmake -Wdev -Wdeprecated -DUSE_PRECOMPILED_HEADER=0 -DUSE_WERROR=1 -DBE_VERBOSE=1 -DCMAKE_BUILD_TYPE=Release -DBUILD_DUMMY_APP=1 -DBUILD_DUMMY_GAMELOGIC=1 -DBUILD_TESTS=1 -H. -Bbuild + cmake --build build -- -j`sysctl -n hw.logicalcpu` + + - name: Test + shell: bash + run: | + set -e + build/test-ttyclient -pakpath pkg -set fs_basepak daemon -set vm.cgame.type 3 + + linux: + name: Linux ${{ matrix.name }} + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + include: + - name: GCC + build_type: Release + c_compiler: gcc + cxx_compiler: g++ + extra_packages: '' + extra_installs: '' + toolchain_file: '' + - name: Clang + build_type: Release + c_compiler: clang + cxx_compiler: clang++ + extra_packages: '' + extra_installs: '' + toolchain_file: '' + - name: Mingw + build_type: Debug + c_compiler: x86_64-w64-mingw32-gcc + cxx_compiler: x86_64-w64-mingw32-g++ + extra_packages: gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 mingw-w64-x86-64-dev + extra_installs: sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix ; sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix + toolchain_file: cmake/cross-toolchain-mingw64.cmake + + steps: + - uses: actions/checkout@v7 + + - name: Check out submodules + shell: bash + env: + # For example: "master" (on pull requests only) + PR_TARGET_BRANCH: ${{ github.base_ref }} + # Target branch name, on pull requests only. Even if the branch comes from an external + # repo it is just the bare branch name, for example "new-feature". + PR_SOURCE_BRANCH: ${{ github.head_ref }} + # For example: "master" for a build of the 'master' branch + # Other formats exist for builds on pull requests + BUILD_SOURCE_BRANCH: ${{ github.ref_name }} + # "push" or "pull_request" (see 'on:') + EVENT_NAME: ${{ github.event_name }} + run: | + set -e + echo "Variables: PR_TARGET_BRANCH=${PR_TARGET_BRANCH} PR_SOURCE_BRANCH=${PR_SOURCE_BRANCH} BUILD_SOURCE_BRANCH=${BUILD_SOURCE_BRANCH}" + curl -fsSL https://gitlab.com/illwieckz/git-checkout-modules/raw/master/git-checkout-modules -o ~/git-checkout-modules + SYNC_ARGS=() + if [[ "$EVENT_NAME" == pull_request ]]; then + SYNC_ARGS=("--sub-ref=${PR_TARGET_BRANCH}:has=/sync" "--sub-ref=${PR_SOURCE_BRANCH}:has=/sync") + else # It is a branch build + SYNC_ARGS=("--sub-ref=${BUILD_SOURCE_BRANCH}:has=/sync") + fi + echo "${#SYNC_ARGS[@]} branch-name-based checkout arg(s): ${SYNC_ARGS[@]}" + bash ~/git-checkout-modules --update "${SYNC_ARGS[@]}" --print + + - name: Install deps + shell: bash + run: | + set -e + sudo apt-get update + sudo apt-get -y -q --no-install-recommends install zlib1g-dev libncursesw5-dev nettle-dev libgmp-dev libcurl4-gnutls-dev libogg-dev libvorbis-dev libopusfile-dev libwebp-dev libjpeg8-dev libpng-dev libfreetype6-dev libglew-dev libopenal-dev liblua5.2-dev ninja-build ${{ matrix.extra_packages }} + ${{ matrix.extra_installs }} + + - name: Build + shell: bash + run: | + set -e + cmake --version + cmake -G "Ninja" -Wdev -Wdeprecated -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain_file }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DUSE_PRECOMPILED_HEADER=0 -DUSE_WERROR=1 -DBE_VERBOSE=1 -DBUILD_DUMMY_APP=1 -DBUILD_DUMMY_GAMELOGIC=1 -DBUILD_TESTS=1 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -H. -Bbuild + cmake --build build -- -j`nproc` + + - name: Test + if: matrix.toolchain_file == '' + shell: bash + run: | + set -e + SDL_VIDEODRIVER=offscreen ALSOFT_DRIVERS=null build/test-client -pakpath pkg -set fs_basepak daemon -set vm.cgame.type 3 diff --git a/README.md b/README.md index 69c8cd83bb..10f26c3829 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,6 @@ Dæmon is the standalone game engine that powers the multiplayer first person sh [![Matrix](https://img.shields.io/badge/matrix-Unvanquished-9cf?logo=matrix)](https://matrix.to/#/!WnuetRiQZJNBTKwMrF:matrix.org?via=matrix.org) [![Discord](https://img.shields.io/badge/discord-Unvanquished-9cf?logo=discord)](https://discord.gg/usuDT9Pyna) -Windows|macOS|Linux --|-|- -[![AppVeyor branch](https://img.shields.io/appveyor/ci/DolceTriade/daemon/master.svg)](https://ci.appveyor.com/project/DolceTriade/daemon/history)|[![Azure branch](https://img.shields.io/azure-devops/build/UnvanquishedDevelopment/51482765-8c0b-4b28-a82c-09554ed6887e/1/master.svg)](https://dev.azure.com/UnvanquishedDevelopment/Daemon/_build?definitionId=1)| [![Azure branch](https://img.shields.io/azure-devops/build/UnvanquishedDevelopment/51482765-8c0b-4b28-a82c-09554ed6887e/1/master.svg)](https://dev.azure.com/UnvanquishedDevelopment/Daemon/_build?definitionId=1) - ℹ️ We provide ready-to-use downloads for the Unvanquished game on the [Unvanquished download page](https://unvanquished.net/download/), builds of the Dæmon engine are included. ℹ️ The Unvanquished game logic source code can be found there: [github.com/Unvanquished/Unvanquished](https://github.com/Unvanquished/Unvanquished). diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 4140a21f14..0000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,135 +0,0 @@ -# Documentation: https://wiki.unvanquished.net/wiki/Continuous_integration - -trigger: - branches: - include: - - master - - 'for-*.*.*/sync' # Next-release branch - -pr: - branches: - include: - - '*' - paths: - include: - - azure-pipelines.yml - # The rest of this list should stay in sync with .appveyor.yml - - src/ - - libs/ - - cmake/ - - CMakeLists.txt - - '*.cmake' - - .gitmodules - -jobs: - - job: Mac - pool: - vmImage: 'macOS-15' - steps: - - bash: | - set -e - echo "Variables: PR_TARGET_BRANCH=${PR_TARGET_BRANCH} PR_SOURCE_REF=${PR_SOURCE_REF} BUILD_SOURCE_BRANCH=${BUILD_SOURCE_BRANCH}" - curl -fsSL https://gitlab.com/illwieckz/git-checkout-modules/raw/master/git-checkout-modules -o ~/git-checkout-modules - if ! [[ "$PR_SOURCE_REF" == '$('* ]]; then # It is a pull request - SOURCE_BRANCH=$(sed -e 's!^refs/heads/users/[^/]*/!!' <<< "$PR_SOURCE_REF") - SYNC_ARGS=("--sub-ref=${PR_TARGET_BRANCH}:has=/sync" "--sub-ref=${SOURCE_BRANCH}:has=/sync") - elif [[ "$BUILD_SOURCE_BRANCH" == refs/heads/* ]]; then # It is a branch build - BRANCH=$(sed -e 's!^refs/heads/!!' <<< "$BUILD_SOURCE_BRANCH") - SYNC_ARGS=("--sub-ref=${BRANCH}:has=/sync") - fi - echo "${#SYNC_ARGS[@]} branch-name-based checkout arg(s): ${SYNC_ARGS[@]}" - bash ~/git-checkout-modules --update ${SYNC_ARGS[@]} --print - env: - # For example: "master" (on pull requests only) - PR_TARGET_BRANCH: $(System.PullRequest.TargetBranch) - # For example: "0.52.0/sync" (pull request from within repository) - # For example: "refs/heads/users/raisa/new-feature" (pull request from other user) - # For example: "$(System.PullRequest.TargetBranch)" (when it's not a PR-triggered build) - PR_SOURCE_REF: $(System.PullRequest.SourceBranch) - # For example: "refs/heads/master" for a build of the 'master' branch - # Other formats exist for builds on pull requests or tags - BUILD_SOURCE_BRANCH: $(Build.SourceBranch) - displayName: 'Check out submodules' - - bash: | - set -e - set -x - cmake --version - export CFLAGS='-Wno-c++14-extensions' - export CXXFLAGS='-Wno-c++14-extensions' - cmake -Wdev -Wdeprecated -DUSE_PRECOMPILED_HEADER=0 -DUSE_WERROR=1 -DBE_VERBOSE=1 -DCMAKE_BUILD_TYPE=Release -DBUILD_DUMMY_APP=1 -DBUILD_DUMMY_GAMELOGIC=1 -DBUILD_TESTS=1 -H. -Bbuild - cmake --build build -- -j`sysctl -n hw.logicalcpu` - displayName: 'Build' - - bash: | - set -e - build/test-ttyclient -pakpath pkg -set fs_basepak daemon -set vm.cgame.type 3 - displayName: 'Test' - - - job: Linux - pool: - vmImage: 'ubuntu-24.04' - strategy: - matrix: - GCC: - BUILD_TYPE: Release - C_COMPILER: gcc - CXX_COMPILER: g++ - EXTRA_PACKAGES: - EXTRA_INSTALLS: - TOOLCHAIN_FILE: - Clang: - BUILD_TYPE: Release - C_COMPILER: clang - CXX_COMPILER: clang++ - EXTRA_PACKAGES: - EXTRA_INSTALLS: - TOOLCHAIN_FILE: - Mingw: - BUILD_TYPE: Debug - C_COMPILER: x86_64-w64-mingw32-gcc - CXX_COMPILER: x86_64-w64-mingw32-g++ - EXTRA_PACKAGES: gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 mingw-w64-x86-64-dev - EXTRA_INSTALLS: sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix ; sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix - TOOLCHAIN_FILE: cmake/cross-toolchain-mingw64.cmake - - steps: - - bash: | - set -e - echo "Variables: PR_TARGET_BRANCH=${PR_TARGET_BRANCH} PR_SOURCE_REF=${PR_SOURCE_REF} BUILD_SOURCE_BRANCH=${BUILD_SOURCE_BRANCH}" - curl -fsSL https://gitlab.com/illwieckz/git-checkout-modules/raw/master/git-checkout-modules -o ~/git-checkout-modules - if ! [[ "$PR_SOURCE_REF" == '$('* ]]; then # It is a pull request - SOURCE_BRANCH=$(sed -e 's!^refs/heads/users/[^/]*/!!' <<< "$PR_SOURCE_REF") - SYNC_ARGS=("--sub-ref=${PR_TARGET_BRANCH}:has=/sync" "--sub-ref=${SOURCE_BRANCH}:has=/sync") - elif [[ "$BUILD_SOURCE_BRANCH" == refs/heads/* ]]; then # It is a branch build - BRANCH=$(sed -e 's!^refs/heads/!!' <<< "$BUILD_SOURCE_BRANCH") - SYNC_ARGS=("--sub-ref=${BRANCH}:has=/sync") - fi - echo "${#SYNC_ARGS[@]} branch-name-based checkout arg(s): ${SYNC_ARGS[@]}" - bash ~/git-checkout-modules --update ${SYNC_ARGS[@]} --print - env: - # For example: "master" (on pull requests only) - PR_TARGET_BRANCH: $(System.PullRequest.TargetBranch) - # For example: "0.52.0/sync" (pull request from within repository) - # For example: "refs/heads/users/raisa/new-feature" (pull request from other user) - # For example: "$(System.PullRequest.TargetBranch)" (when it's not a PR-triggered build) - PR_SOURCE_REF: $(System.PullRequest.SourceBranch) - # For example: "refs/heads/master" for a build of the 'master' branch - # Other formats exist for builds on pull requests or tags - BUILD_SOURCE_BRANCH: $(Build.SourceBranch) - displayName: 'Check out submodules' - - bash: | - set -e - sudo apt-get update - sudo apt-get -y -q --no-install-recommends install zlib1g-dev libncursesw5-dev nettle-dev libgmp-dev libcurl4-gnutls-dev libogg-dev libvorbis-dev libopusfile-dev libwebp-dev libjpeg8-dev libpng-dev libfreetype6-dev libglew-dev libopenal-dev liblua5.2-dev ninja-build $(EXTRA_PACKAGES) - $(EXTRA_INSTALLS) - displayName: 'Install deps' - - bash: | - set -e - cmake --version - cmake -G "Ninja" -Wdev -Wdeprecated -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) -DCMAKE_C_COMPILER=$(C_COMPILER) -DCMAKE_CXX_COMPILER=$(CXX_COMPILER) -DUSE_PRECOMPILED_HEADER=0 -DUSE_WERROR=1 -DBE_VERBOSE=1 -DBUILD_DUMMY_APP=1 -DBUILD_DUMMY_GAMELOGIC=1 -DBUILD_TESTS=1 -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -H. -Bbuild - cmake --build build -- -j`nproc` - displayName: 'Build' - - bash: | - set -e - SDL_VIDEODRIVER=offscreen ALSOFT_DRIVERS=null build/test-client -pakpath pkg -set fs_basepak daemon -set vm.cgame.type 3 - condition: "and(succeeded(), eq(variables.TOOLCHAIN_FILE, ''))" - displayName: 'Test'