1
- name : Build Drogon
1
+ name : Build & Test
2
2
3
3
on :
4
4
push :
5
- branches : [ master ]
5
+ branches : [master]
6
6
pull_request :
7
7
workflow_dispatch :
8
8
9
+ concurrency :
10
+ group : ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress : ${{ github.event_name == 'pull_request' }}
12
+
9
13
env :
10
14
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11
15
BUILD_TYPE : Release
@@ -17,10 +21,10 @@ jobs:
17
21
strategy :
18
22
fail-fast : false
19
23
matrix :
20
- link : [ ' STATIC', ' SHARED' ]
24
+ link : [" STATIC", " SHARED" ]
21
25
steps :
22
26
- name : Checkout Drogon source code
23
- uses : actions/checkout@v2
27
+ uses : actions/checkout@v4
24
28
with :
25
29
submodules : true
26
30
fetch-depth : 0
@@ -60,149 +64,123 @@ jobs:
60
64
shell : bash
61
65
run : ./test.sh -w
62
66
63
- unix :
67
+ macos :
68
+ name : macos/clang
69
+ runs-on : macos-latest
70
+ steps :
71
+ - name : Checkout Drogon source code
72
+ uses : actions/checkout@v4
73
+ with :
74
+ submodules : true
75
+ fetch-depth : 0
76
+
77
+ - name : Install dependencies
78
+ # Already installed: brotli, zlib, postgresql@14, lz4, sqlite3
79
+ run : brew install ninja jsoncpp mariadb hiredis redis
80
+
81
+ - name : Create Build Environment & Configure Cmake
82
+ # Some projects don't allow in-source building, so create a separate build directory
83
+ # We'll use this as our working directory for all subsequent commands
84
+ run : |
85
+ cmake -B build -G Ninja \
86
+ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
87
+ -DBUILD_TESTING=on \
88
+ -DBUILD_SHARED_LIBS=OFF
89
+
90
+ - name : Build
91
+ working-directory : ./build
92
+ # Execute the build. You can specify a specific target with "--target <NAME>"
93
+ run : ninja && sudo ninja install
94
+
95
+ - name : Prepare for testing
96
+ run : |
97
+ brew tap homebrew/services
98
+ brew services restart postgresql@14
99
+ brew services start mariadb
100
+ brew services start redis
101
+ sleep 4
102
+ mariadb -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('')"
103
+ mariadb -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost'"
104
+ mariadb -e "FLUSH PRIVILEGES"
105
+ brew services restart mariadb
106
+ sleep 4
107
+ psql -c 'create user postgres superuser;' postgres
108
+
109
+ - name : Test
110
+ # Execute tests defined by the CMake configuration.
111
+ # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
112
+ run : ./test.sh -t
113
+
114
+ ubuntu :
64
115
name : ${{ matrix.buildname }}
65
- runs-on : ${{ matrix.os }}
116
+ runs-on : ubuntu-22.04
66
117
strategy :
67
118
fail-fast : false
68
119
matrix :
69
120
include :
70
- - os : ubuntu-20.04
71
- buildname : ' ubuntu-20.04/gcc'
121
+ - buildname : " ubuntu-22.04/gcc"
72
122
link : SHARED
73
- triplet : x64-linux
74
- compiler : gcc_64
75
- - os : ubuntu-20.04
76
- buildname : ' ubuntu-20.04/gcc'
77
- link : STATIC
78
- triplet : x64-linux
79
- compiler : gcc_64
80
- - os : ubuntu-20.04
81
- buildname : ' ubuntu-20.04/gcc-10'
123
+ - buildname : " ubuntu-22.04/gcc"
82
124
link : STATIC
83
- triplet : x64-linux
84
- - os : ubuntu-20.04
85
- buildname : ' ubuntu-20.04/c++14'
125
+ - buildname : " ubuntu-22.04/coroutines"
86
126
link : STATIC
87
- triplet : x64-linux
88
- compiler : gcc_64
89
- - os : macos-latest
90
- buildname : ' macos/clang'
91
- link : STATIC
92
- triplet : x64-osx
93
- compiler : clang_64
94
127
steps :
95
- - name : Checkout Drogon source code
96
- uses : actions/checkout@v2
97
- with :
98
- submodules : true
99
- fetch-depth : 0
100
-
101
- - name : (macOS) Install dependencies
102
- if : runner.os == 'macOS'
103
- run : |
104
- brew install jsoncpp brotli zlib
105
- brew install lz4 mariadb sqlite3 postgresql hiredis
106
- brew install redis
107
-
108
- - name : (Linux) Install dependencies
109
- if : runner.os == 'Linux'
110
- run : |
111
- # Installing packages might fail as the github image becomes outdated
112
- sudo apt update
113
- # These aren't available or don't work well in vcpkg
114
- sudo apt-get install -y libjsoncpp-dev uuid-dev libssl-dev zlib1g-dev libsqlite3-dev
115
- sudo apt-get install -y libbrotli-dev
116
- - name : (Linux) Install gcc-10
117
- if : matrix.buildname == 'ubuntu-20.04/gcc-10'
118
- run : sudo apt-get install -y gcc-10 g++-10
119
- - name : (Linux) Install boost
120
- if : matrix.buildname == 'ubuntu-20.04/c++14'
121
- run : |
122
- sudo apt-get update
123
- sudo apt-get -y install libboost-all-dev
124
-
125
- - name : (Linux) Install postgresql
126
- if : matrix.os == 'ubuntu-20.04'
127
- run : sudo apt-get -y install postgresql-all
128
-
129
- - name : Export `shared`
130
- run : |
131
- [[ ${{ matrix.link }} == "SHARED" ]] && shared="ON" || shared="OFF"
132
- echo "shared=$shared" >> $GITHUB_ENV
133
-
134
- - name : Create Build Environment & Configure Cmake
135
- # Some projects don't allow in-source building, so create a separate build directory
136
- # We'll use this as our working directory for all subsequent commands
137
- if : matrix.buildname != 'ubuntu-20.04/gcc-10' && matrix.buildname != 'ubuntu-20.04/c++14'
138
- run : |
139
- cmake -B build \
140
- -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
141
- -DBUILD_TESTING=on \
142
- -DBUILD_SHARED_LIBS=$shared
143
-
144
- - name : Create Build Environment & Configure Cmake (gcc-10)
145
- # Some projects don't allow in-source building, so create a separate build directory
146
- # We'll use this as our working directory for all subsequent commands
147
- if : matrix.buildname == 'ubuntu-20.04/gcc-10'
148
- run : |
149
- cmake -B build \
150
- -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
151
- -DBUILD_TESTING=on \
152
- -DCMAKE_CXX_FLAGS="-fcoroutines" \
153
- -DBUILD_SHARED_LIBS=$shared
154
- env :
155
- CC : gcc-10
156
- CXX : g++-10
157
-
158
- - name : Create Build Environment & Configure Cmake (C++14)
159
- # Some projects don't allow in-source building, so create a separate build directory
160
- # We'll use this as our working directory for all subsequent commands
161
- if : matrix.buildname == 'ubuntu-20.04/C++14'
162
- run : |
163
- cmake -B build \
164
- -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
165
- -DBUILD_TESTING=on \
166
- -DCMAKE_CXX_STANDARD=14 \
167
- -DBUILD_SHARED_LIBS=$shared
168
-
169
- - name : Build
170
- working-directory : ./build
171
- # Execute the build. You can specify a specific target with "--target <NAME>"
172
- run : make -j $(nproc) && sudo make install
173
-
174
- - name : (macOS) Prepare for testing
175
- if : runner.os == 'macOS'
176
- run : |
177
- cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-services
178
- git reset --hard 5f2fe01
179
- cd ~
180
- brew tap homebrew/services
181
- brew services restart postgresql
182
- brew services start mariadb
183
- brew services start redis
184
- sleep 4
185
- mariadb -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('')"
186
- mariadb -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost'"
187
- mariadb -e "FLUSH PRIVILEGES"
188
- brew services restart mariadb
189
- sleep 4
190
- psql -c 'create user postgres superuser;' postgres
191
-
192
- - name : (Linux) Prepare for testing
193
- if : runner.os == 'Linux'
194
- run : |
195
- sudo systemctl start postgresql
196
- sleep 1
197
- sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '12345'" postgres
198
-
199
- - name : Test
200
- # Execute tests defined by the CMake configuration.
201
- # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
202
- run : ./test.sh -t
203
-
204
- - name : Lint
205
- if : matrix.os == 'ubuntu-20.04'
206
- run : |
207
- sudo apt install -y dos2unix
208
- ./format.sh && git diff --exit-code
128
+ - name : Checkout Drogon source code
129
+ uses : actions/checkout@v4
130
+ with :
131
+ submodules : true
132
+ fetch-depth : 0
133
+
134
+ - name : Install dependencies
135
+ run : |
136
+ # Installing packages might fail as the github image becomes outdated
137
+ sudo apt update
138
+ # These aren't available or don't work well in vcpkg
139
+ sudo apt-get install -y libjsoncpp-dev uuid-dev libssl-dev zlib1g-dev libsqlite3-dev
140
+ sudo apt-get install -y ninja-build libbrotli-dev
141
+
142
+ - name : Install postgresql
143
+ run : |
144
+ sudo apt-get --purge remove postgresql postgresql-doc postgresql-common postgresql-client-common
145
+ sudo apt-get -y install postgresql-all
146
+
147
+ - name : Export `shared`
148
+ run : |
149
+ [[ ${{ matrix.link }} == "SHARED" ]] && shared="ON" || shared="OFF"
150
+ echo "shared=$shared" >> $GITHUB_ENV
151
+
152
+ - name : Create Build Environment & Configure Cmake
153
+ # Some projects don't allow in-source building, so create a separate build directory
154
+ # We'll use this as our working directory for all subsequent commands
155
+ if : matrix.buildname != 'ubuntu-22.04/coroutines'
156
+ run : |
157
+ cmake -B build -G Ninja \
158
+ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
159
+ -DBUILD_TESTING=on \
160
+ -DBUILD_SHARED_LIBS=$shared
161
+ - name : Create Build Environment & Configure Cmake (coroutines)
162
+ # Some projects don't allow in-source building, so create a separate build directory
163
+ # We'll use this as our working directory for all subsequent commands
164
+ if : matrix.buildname == 'ubuntu-22.04/coroutines'
165
+ run : |
166
+ cmake -B build -G Ninja \
167
+ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
168
+ -DBUILD_TESTING=on \
169
+ -DCMAKE_CXX_FLAGS="-fcoroutines" \
170
+ -DBUILD_SHARED_LIBS=$shared
171
+
172
+ - name : Build
173
+ working-directory : ./build
174
+ # Execute the build. You can specify a specific target with "--target <NAME>"
175
+ run : ninja && sudo ninja install
176
+
177
+ - name : Prepare for testing
178
+ run : |
179
+ sudo systemctl start postgresql
180
+ sleep 1
181
+ sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '12345'" postgres
182
+
183
+ - name : Test
184
+ # Execute tests defined by the CMake configuration.
185
+ # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
186
+ run : ./test.sh -t
0 commit comments