forked from nanodbc/nanodbc
-
Notifications
You must be signed in to change notification settings - Fork 0
281 lines (263 loc) · 11.3 KB
/
ci-linux.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
---
# GitHub Actions multi-job workflow for Linux to:
# - build using matrix of GCC and clang versions
# - build using latest defaults and run tests against number of databases
name: "CI Linux"
on:
push:
branches:
- main
- ml/*
paths:
- '**.cpp'
- '**.h'
- '**/CMakeLists.txt'
- '.github/workflows/ci-linux.yml'
pull_request:
paths:
- '**.cpp'
- '**.h'
- '**/CMakeLists.txt'
- '.github/workflows/ci-linux.yml'
jobs:
check-format:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
path:
- check: 'nanodbc'
ignore: ''
- check: 'test'
ignore: 'catch'
- check: 'example'
ignore: ''
steps:
- uses: actions/checkout@v3
- uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: '15'
check-path: ${{ matrix.path['check'] }}
exclude-regex: ${{ matrix.path['ignore'] }}
build-gcc:
needs: [check-format]
strategy:
fail-fast: false
matrix:
include:
# TODO: Compilation with GCC 12 fails with errors related to char8_t conversions
#- { cxxstd: '20', cxx: g++-12, cc: gcc-12, os: ubuntu-22.04 }
#- { cxxstd: '17', cxx: g++-12, cc: gcc-12, os: ubuntu-22.04 }
#- { cxxstd: '14', cxx: g++-12, cc: gcc-12, os: ubuntu-22.04 }
#- { cxxstd: '17', cxx: g++-11, cc: gcc-11, os: ubuntu-22.04 }
- { cxxstd: '14', cxx: g++-11, cc: gcc-11, os: ubuntu-22.04 }
- { cxxstd: '17', cxx: g++-10, cc: gcc-10, os: ubuntu-22.04 }
- { cxxstd: '14', cxx: g++-10, cc: gcc-10, os: ubuntu-22.04 }
- { cxxstd: '17', cxx: g++-9, cc: gcc-9, os: ubuntu-20.04 }
- { cxxstd: '14', cxx: g++-9, cc: gcc-9, os: ubuntu-20.04 }
- { cxxstd: '17', cxx: g++-8, cc: gcc-8, os: ubuntu-20.04 }
- { cxxstd: '14', cxx: g++-8, cc: gcc-8, os: ubuntu-20.04 }
- { cxxstd: '17', cxx: g++-7, cc: gcc-7, os: ubuntu-latest, container: "ubuntu:18.04" }
- { cxxstd: '14', cxx: g++-7, cc: gcc-7, os: ubuntu-latest, container: "ubuntu:18.04" }
- { cxxstd: '14', cxx: g++-6, cc: gcc-6, os: ubuntu-latest, container: "ubuntu:18.04" }
- { cxxstd: '14', cxx: g++-5, cc: gcc-5, os: ubuntu-latest, container: "ubuntu:18.04" }
name: build-${{ matrix.cc }}-std-${{ matrix.cxxstd }}
runs-on: ${{ matrix.os }}
container: ${{matrix.container}}
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
steps:
- uses: actions/checkout@v3
- name: Setup container
if: matrix.container
run: |
apt-get update
apt-get install -y g++ git python sudo unixodbc-dev
- name: Install
run: |
sudo apt-get update
sudo apt-get install -y curl make ${{ matrix.cxx }}
- name: Install CMake
run: |
curl -OL https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.tar.gz
tar -xf cmake-3.27.1-linux-x86_64.tar.gz
echo "${PWD}/cmake-3.27.1-linux-x86_64/bin" >> $GITHUB_PATH
- name: Check
run: |
echo && type g++ && which g++ && g++ --version
echo CC=${CC} && echo CXX=${CXX} && type ${CXX} && which ${CXX} && ${CXX} --version
echo && type cmake && which cmake && cmake --version
- name: Configure
run: |
cmake -S ${GITHUB_WORKSPACE} -B ${GITHUB_WORKSPACE}/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=${{matrix.cxxstd}}
- name: Build
run: |
cmake --build ${GITHUB_WORKSPACE}/build
build-clang:
needs: [check-format]
strategy:
fail-fast: false
matrix:
include:
- { cxxstd: '20', cxx: clang++-14, cc: clang-14, os: ubuntu-22.04, pkg: 'libc++-14-dev libc++abi-14-dev' }
- { cxxstd: '17', cxx: clang++-14, cc: clang-14, os: ubuntu-22.04, pkg: 'libc++-14-dev libc++abi-14-dev' }
- { cxxstd: '14', cxx: clang++-14, cc: clang-14, os: ubuntu-22.04, pkg: 'libc++-14-dev libc++abi-14-dev' }
- { cxxstd: '20', cxx: clang++-13, cc: clang-13, os: ubuntu-22.04, pkg: 'libc++-13-dev libc++abi-13-dev' }
- { cxxstd: '17', cxx: clang++-13, cc: clang-13, os: ubuntu-22.04, pkg: 'libc++-13-dev libc++abi-13-dev' }
- { cxxstd: '14', cxx: clang++-13, cc: clang-13, os: ubuntu-22.04, pkg: 'libc++-13-dev libc++abi-13-dev' }
- { cxxstd: '17', cxx: clang++-12, cc: clang-12, os: ubuntu-20.04, pkg: 'libc++-12-dev libc++abi-12-dev' }
- { cxxstd: '14', cxx: clang++-12, cc: clang-12, os: ubuntu-20.04, pkg: 'libc++-12-dev libc++abi-12-dev' }
- { cxxstd: '17', cxx: clang++-11, cc: clang-11, os: ubuntu-20.04, pkg: 'libc++-11-dev libc++abi-11-dev' }
- { cxxstd: '14', cxx: clang++-11, cc: clang-11, os: ubuntu-20.04, pkg: 'libc++-11-dev libc++abi-11-dev' }
- { cxxstd: '17', cxx: clang++-10, cc: clang-10, os: ubuntu-20.04, pkg: 'libc++-10-dev libc++abi-10-dev' }
- { cxxstd: '14', cxx: clang++-10, cc: clang-10, os: ubuntu-20.04, pkg: 'libc++-10-dev libc++abi-10-dev' }
- { cxxstd: '17', cxx: clang++-9, cc: clang-9, os: ubuntu-20.04, pkg: 'libc++-9-dev libc++abi-9-dev' }
- { cxxstd: '14', cxx: clang++-9, cc: clang-9, os: ubuntu-20.04, pkg: 'libc++-9-dev libc++abi-9-dev' }
- { cxxstd: '17', cxx: clang++-8, cc: clang-8, os: ubuntu-20.04, pkg: 'libc++-8-dev libc++abi-8-dev' }
- { cxxstd: '14', cxx: clang++-8, cc: clang-8, os: ubuntu-20.04, pkg: 'libc++-8-dev libc++abi-8-dev' }
- { cxxstd: '17', cxx: clang++-7, cc: clang-7, os: ubuntu-20.04, pkg: 'libc++-7-dev libc++abi-7-dev' }
- { cxxstd: '14', cxx: clang++-7, cc: clang-7, os: ubuntu-20.04, pkg: 'libc++-7-dev libc++abi-7-dev' }
- { cxxstd: '17', cxx: clang++-6.0, cc: clang-6.0, os: ubuntu-latest, container: "ubuntu:18.04", pkg: 'libc++-dev libc++abi-dev' }
- { cxxstd: '14', cxx: clang++-6.0, cc: clang-6.0, os: ubuntu-latest, container: "ubuntu:18.04", pkg: 'libc++-dev libc++abi-dev' }
- { cxxstd: '14', cxx: clang++-5.0, cc: clang-5.0, os: ubuntu-latest, container: "ubuntu:18.04", pkg: 'libc++-dev libc++abi-dev' }
- { cxxstd: '14', cxx: clang++-4.0, cc: clang-4.0, os: ubuntu-latest, container: "ubuntu:18.04", pkg: 'libc++-dev libc++abi-dev' }
- { cxxstd: '14', cxx: clang++-3.9, cc: clang-3.9, os: ubuntu-latest, container: "ubuntu:18.04", pkg: 'libc++-dev libc++abi-dev' }
name: build-${{ matrix.cc }}-std-${{ matrix.cxxstd }}
runs-on: ${{ matrix.os }}
container: ${{matrix.container}}
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
steps:
- uses: actions/checkout@v3
- name: Setup container
if: matrix.container
run: |
apt-get update
apt-get install -y git python sudo unixodbc-dev
- name: Install
run: |
sudo apt-get update
sudo apt-get purge libc++-dev libc++abi-dev
sudo apt-get autoremove
sudo apt-get install -y curl make ${{ matrix.cc }} ${{ matrix.pkg }}
- name: Install CMake
run: |
curl -OL https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.tar.gz
tar -xf cmake-3.27.1-linux-x86_64.tar.gz
echo "${PWD}/cmake-3.27.1-linux-x86_64/bin" >> $GITHUB_PATH
- name: Check
run: |
echo && type clang++ && which clang++ && clang++ --version
echo CC=${CC} && echo CXX=${CXX} && type ${CXX} && which ${CXX} && ${CXX} --version
echo && type cmake && which cmake && cmake --version
- name: Configure
run: |
cmake -S ${GITHUB_WORKSPACE} -B ${GITHUB_WORKSPACE}/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=${{matrix.cxxstd}}
- name: Build
run: |
cmake --build ${GITHUB_WORKSPACE}/build
test-utility:
needs: [build-gcc, build-clang]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure
run: |
cmake -S ${GITHUB_WORKSPACE} -B ${GITHUB_WORKSPACE}/build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: |
cmake --build ${GITHUB_WORKSPACE}/build --target utility_tests
- name: Test
run: |
ctest --test-dir ${GITHUB_WORKSPACE}/build --output-on-failure --no-tests=error -R utility_tests
test-postgresql:
needs: [test-utility]
runs-on: ubuntu-latest
services:
postgresql:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: nanodbc
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Install
run: |
sudo apt-get install -y unixodbc-dev odbc-postgresql
- name: Configure
run: |
cmake -S ${GITHUB_WORKSPACE} -B ${GITHUB_WORKSPACE}/build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: |
cmake --build ${GITHUB_WORKSPACE}/build --target postgresql_tests
- name: Test
run: |
export NANODBC_TEST_CONNSTR_PGSQL="Driver={PostgreSQL ANSI};Server=localhost;Port=5432;Database=nanodbc;UID=postgres;PWD=postgres"
ctest --test-dir ${GITHUB_WORKSPACE}/build --output-on-failure --no-tests=error -R postgresql_tests
test-mssql:
needs: [test-utility]
runs-on: ubuntu-latest
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
ports:
- 1433:1433
env:
ACCEPT_EULA: Y
SA_PASSWORD: Password!123
steps:
- uses: actions/checkout@v3
- name: Install
run: |
apt-get update
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list
ACCEPT_EULA=Y apt-get install -y unixodbc-dev msodbcsql17
shell: sudo bash {0}
- name: Configure
run: |
cmake -S ${GITHUB_WORKSPACE} -B ${GITHUB_WORKSPACE}/build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: |
cmake --build ${GITHUB_WORKSPACE}/build --target mssql_tests
- name: Test
run: |
export NANODBC_TEST_CONNSTR_MSSQL="Driver={ODBC Driver 17 for SQL Server};Server=localhost;Database=master;UID=sa;PWD=Password!123;"
ctest --test-dir ${GITHUB_WORKSPACE}/build --output-on-failure --no-tests=error -R mssql_tests
test-sqlite:
needs: [test-utility]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install
run: |
apt-get install -y unixodbc-dev libsqliteodbc
cat <<EOF > ${GITHUB_WORKSPACE}/.odbcinst.ini
[SQLite3]
Description=SQLite 3 ODBC Driver
Driver=/usr/lib/x86_64-linux-gnu/odbc/libsqlite3odbc.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libsqlite3odbc.so
UsageCount=1
EOF
sudo odbcinst -i -d -f ${GITHUB_WORKSPACE}/.odbcinst.ini
cat /etc/odbcinst.ini
shell: sudo bash {0}
- name: Configure
run: |
cmake -S ${GITHUB_WORKSPACE} -B ${GITHUB_WORKSPACE}/build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: |
cmake --build ${GITHUB_WORKSPACE}/build --target sqlite_tests
- name: Test
run: |
ctest --test-dir ${GITHUB_WORKSPACE}/build --output-on-failure --no-tests=error -R sqlite_tests