-
Notifications
You must be signed in to change notification settings - Fork 60
/
azure-pipelines.yml
134 lines (129 loc) · 6.07 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# 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-14'
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
cmake --version
cmake -Wdev -Wdeprecated -DUSE_PRECOMPILED_HEADER=0 -DUSE_WERROR=1 -DBE_VERBOSE=1 -DCMAKE_BUILD_TYPE=Release -DBUILD_DUMMY_APP=1 -DBUILD_TESTS=1 -H. -Bbuild
cmake --build build -- -j`sysctl -n hw.logicalcpu`
displayName: 'Build'
- bash: |
set -e
# Use dummyapp so we don't need dpk's
build/test-dummyapp -pakpath pkg
displayName: 'Test'
- job: Linux
pool:
vmImage: 'ubuntu-20.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 libgeoip-dev nettle-dev libgmp-dev libcurl4-gnutls-dev libsdl2-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_TESTS=1 -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -H. -Bbuild
cmake --build build -- -j`nproc`
displayName: 'Build'
- bash: |
set -e
# Use dummyapp so we don't need dpk's
build/test-dummyapp -pakpath pkg
condition: "and(succeeded(), eq(variables.TOOLCHAIN_FILE, ''))"
displayName: 'Test'