Skip to content

Commit 3049adc

Browse files
authored
Unit tests now run in Github CI (#170)
1 parent bb2b036 commit 3049adc

File tree

2 files changed

+39
-26
lines changed

2 files changed

+39
-26
lines changed

.github/workflows/cmake.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ jobs:
2626
{ os: ubuntu-24.04, c_compiler: clang-17, cpp_compiler: clang++-17 },
2727
{ os: ubuntu-24.04, c_compiler: gcc-13, cpp_compiler: g++-13 },
2828
{ os: ubuntu-24.04, c_compiler: gcc-14, cpp_compiler: g++-14 },
29-
{ os: macos-13, c_compiler: cc, cpp_compiler: c++, cmake_args: "-DSYSTEM_SQLITE=OFF" },
29+
{ os: macos-14, c_compiler: cc, cpp_compiler: c++, cmake_args: "-DSYSTEM_SQLITE=OFF" },
30+
{ os: macos-15, c_compiler: cc, cpp_compiler: c++, cmake_args: "-DSYSTEM_SQLITE=OFF" },
3031
{ os: windows-2022, c_compiler: cl, cpp_compiler: cl },
3132
{ os: windows-2025, c_compiler: cl, cpp_compiler: cl },
3233
]
@@ -38,17 +39,24 @@ jobs:
3839

3940
- name: Install dependencies (macOS)
4041
if: runner.os == 'macOS'
41-
run: brew install zlib
42+
# Note: separate commands for main deps and test deps
43+
run: |
44+
brew install zlib
45+
brew install boost
4246
4347
- name: Install dependencies (Ubuntu)
4448
if: runner.os == 'Linux'
49+
# Note: separate commands for main deps and test deps
4550
run: |
4651
sudo apt-get update
4752
sudo apt-get install --yes libz-dev libsqlite3-dev
53+
sudo apt-get install --yes libboost-filesystem-dev libboost-test-dev
4854
4955
- name: Install dependencies (Windows)
5056
if: runner.os == 'Windows'
51-
run: vcpkg install zlib sqlite3
57+
# Note: test deps not currently installed for Windows as unit testing currently not supported for this platform.
58+
run: |
59+
vcpkg install zlib sqlite3
5260
5361
- name: Configure CMake (non-Windows)
5462
if: runner.os != 'Windows'
@@ -64,5 +72,10 @@ jobs:
6472
- name: Test
6573
if: runner.os != 'Windows'
6674
working-directory: ${{github.workspace}}/build
67-
run: ctest -C ${{env.BUILD_TYPE}}
68-
75+
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
76+
77+
- name: Install (non-Windows)
78+
if: runner.os != 'Windows'
79+
working-directory: ${{github.workspace}}/build
80+
run: DESTDIR=. cmake --install .
81+

include/djinterop/exceptions.hpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
namespace djinterop
3030
{
31-
class database_not_found : public std::runtime_error
31+
class DJINTEROP_PUBLIC database_not_found : public std::runtime_error
3232
{
3333
public:
3434
explicit database_not_found(const std::string& what_arg) noexcept :
@@ -40,7 +40,7 @@ class database_not_found : public std::runtime_error
4040
/// The `database_inconsistency` exception is thrown when the schema of a
4141
/// database does not match the expectations suggested by its reported version
4242
/// number.
43-
class database_inconsistency : public std::runtime_error
43+
class DJINTEROP_PUBLIC database_inconsistency : public std::runtime_error
4444
{
4545
public:
4646
explicit database_inconsistency(const std::string& what_arg) noexcept :
@@ -51,7 +51,7 @@ class database_inconsistency : public std::runtime_error
5151

5252
/// The `unsupported_database` exception is thrown when a database is
5353
/// encountered that is not yet supported by this version of the library.
54-
class unsupported_database : public std::runtime_error
54+
class DJINTEROP_PUBLIC unsupported_database : public std::runtime_error
5555
{
5656
public:
5757
explicit unsupported_database(const std::string& what_arg) noexcept :
@@ -64,7 +64,7 @@ class unsupported_database : public std::runtime_error
6464
/// perform an operation that is not supported by the database, such as a
6565
/// missing feature on the high-level API, or a feature only available in
6666
/// certain database versions.
67-
class unsupported_operation : public std::runtime_error
67+
class DJINTEROP_PUBLIC unsupported_operation : public std::runtime_error
6868
{
6969
public:
7070
explicit unsupported_operation(const std::string& what_arg) noexcept :
@@ -75,7 +75,7 @@ class unsupported_operation : public std::runtime_error
7575

7676
/// The `crate_deleted` exception is thrown when an invalid `crate` object is
7777
/// used, i.e. one that does not exist in the database anymore.
78-
class crate_deleted : public std::runtime_error
78+
class DJINTEROP_PUBLIC crate_deleted : public std::runtime_error
7979
{
8080
public:
8181
/// Constructs the exception for a given crate ID
@@ -93,7 +93,7 @@ class crate_deleted : public std::runtime_error
9393

9494
/// The `crate_database_inconsistency` exception is thrown when a database
9595
/// inconsistency is found that correlates to a crate.
96-
class crate_database_inconsistency : public database_inconsistency
96+
class DJINTEROP_PUBLIC crate_database_inconsistency : public database_inconsistency
9797
{
9898
public:
9999
/// Construct the exception for a given crate ID
@@ -112,7 +112,7 @@ class crate_database_inconsistency : public database_inconsistency
112112

113113
/// The `crate_already_exists` exception is thrown when a request is made to
114114
/// create a crate with a name that already exists.
115-
class crate_already_exists : public std::runtime_error
115+
class DJINTEROP_PUBLIC crate_already_exists : public std::runtime_error
116116
{
117117
public:
118118
/// Construct the exception.
@@ -124,7 +124,7 @@ class crate_already_exists : public std::runtime_error
124124

125125
/// The `crate_invalid_parent` exception is thrown when a crate parent is found
126126
/// to be invalid.
127-
class crate_invalid_parent : public std::runtime_error
127+
class DJINTEROP_PUBLIC crate_invalid_parent : public std::runtime_error
128128
{
129129
public:
130130
/// Construct the exception.
@@ -136,7 +136,7 @@ class crate_invalid_parent : public std::runtime_error
136136

137137
/// The `crate_invalid_name` exception is thrown when a crate name is found to
138138
/// be invalid.
139-
class crate_invalid_name : public std::runtime_error
139+
class DJINTEROP_PUBLIC crate_invalid_name : public std::runtime_error
140140
{
141141
public:
142142
/// Construct the exception for a given crate name.
@@ -155,7 +155,7 @@ class crate_invalid_name : public std::runtime_error
155155

156156
/// The `playlist_already_exists` exception is thrown when a request is made to
157157
/// create a playlist with a name that already exists.
158-
class playlist_already_exists : public std::runtime_error
158+
class DJINTEROP_PUBLIC playlist_already_exists : public std::runtime_error
159159
{
160160
public:
161161
/// Construct the exception.
@@ -167,7 +167,7 @@ class playlist_already_exists : public std::runtime_error
167167

168168
/// The `playlist_database_inconsistency` exception is thrown when a database
169169
/// inconsistency is found that correlates to a playlist.
170-
class playlist_database_inconsistency : public database_inconsistency
170+
class DJINTEROP_PUBLIC playlist_database_inconsistency : public database_inconsistency
171171
{
172172
public:
173173
/// Construct the exception for a given crate ID
@@ -179,7 +179,7 @@ class playlist_database_inconsistency : public database_inconsistency
179179

180180
/// The `playlist_deleted` exception is thrown when an invalid `playlist` object
181181
/// is used, i.e. one that does not exist in the database anymore.
182-
class playlist_deleted : public std::runtime_error
182+
class DJINTEROP_PUBLIC playlist_deleted : public std::runtime_error
183183
{
184184
public:
185185
/// Constructs the exception for a given playlist ID
@@ -197,7 +197,7 @@ class playlist_deleted : public std::runtime_error
197197

198198
/// The `playlist_invalid_parent` exception is thrown when a playlist parent is found
199199
/// to be invalid.
200-
class playlist_invalid_parent : public std::runtime_error
200+
class DJINTEROP_PUBLIC playlist_invalid_parent : public std::runtime_error
201201
{
202202
public:
203203
/// Construct the exception.
@@ -209,7 +209,7 @@ class playlist_invalid_parent : public std::runtime_error
209209

210210
/// The `playlist_invalid_name` exception is thrown when a playlist name is found to
211211
/// be invalid.
212-
class playlist_invalid_name : public std::runtime_error
212+
class DJINTEROP_PUBLIC playlist_invalid_name : public std::runtime_error
213213
{
214214
public:
215215
/// Construct the exception for a given playlist name.
@@ -228,7 +228,7 @@ class playlist_invalid_name : public std::runtime_error
228228

229229
/// The `track_deleted` exception is thrown when an invalid `track` object is
230230
/// used, i.e. one that does not exist in the database anymore.
231-
class track_deleted : public std::invalid_argument
231+
class DJINTEROP_PUBLIC track_deleted : public std::invalid_argument
232232
{
233233
public:
234234
/// Constructs the exception for a given track ID
@@ -246,7 +246,7 @@ class track_deleted : public std::invalid_argument
246246

247247
/// The `invalid_track_snapshot` exception is thrown when there is a problem
248248
/// with a track snapshot.
249-
class invalid_track_snapshot : public std::invalid_argument
249+
class DJINTEROP_PUBLIC invalid_track_snapshot : public std::invalid_argument
250250
{
251251
public:
252252
/// Initialise a new instance of the exception with a custom message.
@@ -258,7 +258,7 @@ class invalid_track_snapshot : public std::invalid_argument
258258

259259
/// The `track_database_inconsistency` exception is thrown when a database
260260
/// inconsistency is found that correlates to a track.
261-
class track_database_inconsistency : public database_inconsistency
261+
class DJINTEROP_PUBLIC track_database_inconsistency : public database_inconsistency
262262
{
263263
public:
264264
/// Construct the exception for a given track ID
@@ -277,7 +277,7 @@ class track_database_inconsistency : public database_inconsistency
277277

278278
/// The `track_already_in_playlist` exception is thrown when a request is made
279279
/// to add a track a playlist it is already in.
280-
class track_already_in_playlist : public std::invalid_argument
280+
class DJINTEROP_PUBLIC track_already_in_playlist : public std::invalid_argument
281281
{
282282
public:
283283
explicit track_already_in_playlist(const std::string& what_arg) noexcept :
@@ -289,7 +289,7 @@ class track_already_in_playlist : public std::invalid_argument
289289
/// The `track_not_in_playlist` exception is thrown when a reference is made to
290290
/// a track that is supposed to be in a playlist, but actually is not in the
291291
/// playlist.
292-
class track_not_in_playlist : public std::invalid_argument
292+
class DJINTEROP_PUBLIC track_not_in_playlist : public std::invalid_argument
293293
{
294294
public:
295295
explicit track_not_in_playlist(const std::string& what_arg) noexcept :
@@ -300,7 +300,7 @@ class track_not_in_playlist : public std::invalid_argument
300300

301301
/// The `hot_cues_overflow` exception is thrown when more hot cues are provided
302302
/// than are supported by the database.
303-
class hot_cues_overflow : public std::invalid_argument
303+
class DJINTEROP_PUBLIC hot_cues_overflow : public std::invalid_argument
304304
{
305305
public:
306306
/// Constructs the exception.
@@ -312,7 +312,7 @@ class hot_cues_overflow : public std::invalid_argument
312312

313313
/// The `loops_overflow` exception is thrown when more loops are provided than
314314
/// are supported by the database.
315-
class loops_overflow : public std::invalid_argument
315+
class DJINTEROP_PUBLIC loops_overflow : public std::invalid_argument
316316
{
317317
public:
318318
/// Constructs the exception.

0 commit comments

Comments
 (0)