-
Notifications
You must be signed in to change notification settings - Fork 484
199 lines (182 loc) · 5.6 KB
/
ci.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
# Continuous integration workflow for SOCI.
name: GitHub CI
on:
push:
branches:
- master
- 'release/**'
paths-ignore:
- .circleci/**
- .cirrus.yml
- .github/workflows/codeql.yml
- appveyor.yml
pull_request:
branches:
- master
paths-ignore:
- .circleci/**
- .cirrus.yml
- .github/workflows/codeql.yml
- appveyor.yml
workflow_dispatch:
inputs:
enable_ssh:
type: boolean
description: 'Enable ssh server before running the job'
required: false
default: false
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
# Ubuntu jobs
# Can't test DB2 as required db2exc package is no longer available after Ubuntu 14.04
- lib_type: shared
backend: SQLite3
runner: ubuntu-24.04
unity_build: false
- lib_type: shared
backend: PostgreSQL
runner: ubuntu-24.04
unity_build: false
- lib_type: shared
backend: MySQL
runner: ubuntu-24.04
unity_build: false
- lib_type: shared
backend: Firebird
runner: ubuntu-24.04
unity_build: false
- lib_type: shared
backend: Oracle
runner: ubuntu-22.04
unity_build: false
- lib_type: shared
backend: ODBC
runner: ubuntu-24.04
unity_build: false
- lib_type: shared
backend: Empty
runner: ubuntu-24.04
unity_build: false
- lib_type: static
backend: SQLite3
runner: ubuntu-24.04
- lib_type: static
backend: PostgreSQL
runner: ubuntu-24.04
- lib_type: static
backend: MySQL
runner: ubuntu-24.04
- lib_type: static
backend: Firebird
runner: ubuntu-24.04
- lib_type: static
backend: Oracle
runner: ubuntu-22.04
- lib_type: static
backend: ODBC
runner: ubuntu-24.04
- lib_type: static
backend: Empty
runner: ubuntu-24.04
# MacOS jobs
- lib_type: shared
backend: Empty
runner: macos-14
no_boost: true
- lib_type: shared
backend: PostgreSQL
runner: macos-14
no_boost: true
- lib_type: shared
backend: SQLite3
runner: macos-14
no_boost: true
# Special
- lib_type: shared
backend: SQLite3
runner: ubuntu-24.04
cxxstd: 17
name: SQLite3 Cxx17
- lib_type: shared
backend: Empty
runner: ubuntu-24.04
test_release_package: true
name: Release package
- lib_type: shared
backend: Empty
runner: ubuntu-24.04
build_examples: true
name: Examples
- lib_type: static
backend: Valgrind
runner: ubuntu-24.04
name: Valgrind
runs-on: ${{ matrix.runner }}
name: ${{ format('{0} on {1}', (matrix.name != '' && matrix.name || format('{0} ({1})', matrix.backend, matrix.lib_type)), matrix.runner) }}
env:
SOCI_CI: true
SOCI_CI_BACKEND: ${{ matrix.backend }}
SOCI_MYSQL_ROOT_PASSWORD: root
ASAN_OPTIONS: fast_unwind_on_malloc=0
UBSAN_OPTIONS: 'print_stacktrace=1:halt_on_error=1'
SOCI_CXXSTD: 14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set environment variables
shell: bash
run: |
set_env_var() {
echo "Setting environment variable $1=$2"
echo $1=$2 >> $GITHUB_ENV
}
set_env_var SOCI_CI_BRANCH $GITHUB_REF
set_env_var SOCI_SOURCE_DIR $GITHUB_WORKSPACE
case "${{runner.os}}" in
Linux)
set_env_var PGHOST localhost
set_env_var PGPORT 5432
set_env_var PGUSER postgres
set_env_var PGPASSWORD 'Password12!'
;;
macOS)
set_env_var PGDATA /opt/homebrew/var/postgresql@14
;;
esac
if [ -n "${{matrix.cxxstd}}" ]; then
set_env_var SOCI_CXXSTD ${{matrix.cxxstd}}
fi
if [ "${{matrix.no_boost}}" = true ]; then
set_env_var WITH_BOOST OFF
fi
if [ "${{matrix.test_release_package}}" = true ]; then
set_env_var TEST_RELEASE_PACKAGE YES
fi
if [ "${{matrix.build_examples}}" = true ]; then
set_env_var BUILD_EXAMPLES YES
fi
if [ "${{matrix.lib_type}}" = "static" ]; then
set_env_var SOCI_BUILD_STATIC YES
fi
if [ "${{matrix.unity_build}}" = false ]; then
set_env_var SOCI_ENABLE_UNITY_BUILD ON
else
set_env_var SOCI_ENABLE_UNITY_BUILD OFF
fi
# Ensure SOCI_CI_BACKEND is always lowercase
set_env_var SOCI_CI_BACKEND "$( echo "$SOCI_CI_BACKEND" | tr '[:upper:]' '[:lower:]' )"
- name: Setup tmate
if: ${{ github.event_name == 'workflow_dispatch' && inputs.enable_ssh }}
uses: mxschmitt/action-tmate@v3
- name: Install dependencies
run: ./scripts/ci/install.sh
- name: Prepare for build
run: ./scripts/ci/before_build.sh
- name: Build
run: ./scripts/ci/build.sh
- name: Test
run: ./scripts/ci/test.sh