Skip to content

Commit 39b8c83

Browse files
Eric Prud'hommeauxclaude
andcommitted
+ GitHub Actions CI: build and test on Linux and macOS
Add .github/workflows/ci.yml running the cmake build and ctest on ubuntu-latest and macos-latest. The W3C test-suite downloads move into tests/fetch-test-suites.sh, shared by CI and humans (README updated). Suites with known pre-existing failures (unimplemented md5/sha* builtins, the csv-IRI function_library expectation, and the heap-layout-nondeterministic QueryMap/ShEx cases) run in a separate non-blocking step so they stay visible without gating the build. Linux portability fixes found while replicating the CI job in an ubuntu:24.04 container: - link libuuid on Linux (uuid_generate_random in the uuid builtins) - make ~URI public: gcc requires an accessible destructor at the point of aggregate-initializing AtomFactory::_URIConstants[] (C++17 [dcl.init.aggr]); construction stays factory-only Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent cf3efa2 commit 39b8c83

5 files changed

Lines changed: 106 additions & 7 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ubuntu-latest, macos-latest]
13+
runs-on: ${{ matrix.os }}
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install dependencies (Linux)
19+
if: runner.os == 'Linux'
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install -y cmake bison flex libexpat1-dev uuid-dev \
23+
libboost-dev libboost-regex-dev libboost-thread-dev \
24+
libboost-filesystem-dev libboost-date-time-dev \
25+
libboost-program-options-dev libboost-iostreams-dev \
26+
libboost-log-dev libboost-test-dev
27+
28+
- name: Install dependencies (macOS)
29+
if: runner.os == 'macOS'
30+
run: brew install cmake boost bison flex expat
31+
32+
- name: Fetch W3C test suites
33+
run: sh tests/fetch-test-suites.sh
34+
35+
- name: Configure
36+
run: cmake -B build
37+
38+
- name: Build
39+
run: cmake --build build -j4
40+
41+
- name: Run test suites
42+
run: >
43+
ctest --test-dir build --output-on-failure --timeout 600
44+
-E 'test_(SPARQL|SPARQL11|QueryMap|ShEx)$'
45+
46+
# These suites carry known pre-existing failures:
47+
# - test_SPARQL11: md5/sha* builtins are unimplemented (8 cases)
48+
# - test_SPARQL: function_library expects CSV <foo> parsed as an IRI,
49+
# a csv-regex branch deliberately disabled upstream (~2013)
50+
# - test_QueryMap, test_ShEx: heap-layout-dependent nondeterminism in
51+
# the query rewriter / ShEx normalizer makes single cases flaky
52+
# Run them for visibility without gating the build.
53+
- name: Run suites with known pre-existing failures (non-blocking)
54+
continue-on-error: true
55+
run: >
56+
ctest --test-dir build --output-on-failure --timeout 600
57+
-R 'test_(SPARQL|SPARQL11|QueryMap|ShEx)$'

‎CMakeLists.txt‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ target_link_libraries(SWObjects PUBLIC
182182
Boost::iostreams Boost::log Boost::log_setup
183183
)
184184

185+
# The uuid()/struuid() SPARQL builtins use uuid_generate_random(). macOS
186+
# and Windows have it in the base system; Linux needs libuuid.
187+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
188+
find_path(LIBUUID_INCLUDE_DIR NAMES uuid/uuid.h REQUIRED)
189+
find_library(LIBUUID_LIBRARY NAMES uuid REQUIRED)
190+
target_include_directories(SWObjects PUBLIC ${LIBUUID_INCLUDE_DIR})
191+
target_link_libraries(SWObjects PUBLIC ${LIBUUID_LIBRARY})
192+
endif()
193+
185194
if(SWOBJ_XML_PARSER STREQUAL "EXPAT1")
186195
target_link_libraries(SWObjects PUBLIC EXPAT::EXPAT)
187196
elseif(SWOBJ_XML_PARSER STREQUAL "LIBXML2")

‎README‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ cmake options (see the options block at the top of CMakeLists.txt):
1010
cmake -B build -DSWOBJ_XML_PARSER=LIBXML2 -DSWOBJ_SQL_MYSQL=ON
1111

1212
Some test suites (test_Turtle, test_Trig, test_RDFXML, test_SPARQL11)
13-
expect the W3C test data unpacked under tests/ :
13+
expect the W3C test data unpacked under tests/ ; fetch it with:
1414

15-
(cd tests && curl -sL http://www.w3.org/2013/TurtleTests/TESTS.tar.gz | tar xzf -)
16-
(cd tests && mkdir -p TriGTests && curl -sL http://www.w3.org/2013/TrigTests/TESTS.tar.gz | tar xzf - -C TriGTests)
17-
(cd tests && mkdir -p RDFXMLTests && curl -sL http://www.w3.org/2013/RDFXMLTests/TESTS.tar.gz | tar xzf - -C RDFXMLTests)
18-
(cd tests && curl -sL http://www.w3.org/2009/sparql/docs/tests/sparql11-test-suite-20121023.tar.gz | tar xzf - \
19-
&& cd sparql11-test-suite && patch -p 0 < ../sparql11-test-suite.patch)
15+
sh tests/fetch-test-suites.sh
16+
17+
CI (.github/workflows/ci.yml) runs the same steps on Linux and macOS.
2018

2119
# Debian instructions
2220

@@ -25,6 +23,7 @@ you'll need these packages:
2523
- cmake
2624
- flex (>= 2.6)
2725
- bison (>= 3.2)
26+
- uuid-dev
2827
- libexpat1-dev (or libxml2-dev with -DSWOBJ_XML_PARSER=LIBXML2)
2928
- libmysqlclient-dev (only with -DSWOBJ_SQL_MYSQL=ON)
3029
- libboost-dev

‎lib/SWObjects.hpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,8 +973,11 @@ class URI : public TTerm {
973973
friend struct _URIstr_initializer;
974974
private:
975975
URI (std::string str) : TTerm(str) { }
976-
~URI () { }
977976
public:
977+
// Public for GCC: aggregate-initializing AtomFactory::_URIConstants[]
978+
// requires an accessible destructor at the point of initialization
979+
// (C++17 [dcl.init.aggr]). Construction stays factory-only.
980+
~URI () { }
978981
virtual e_TYPE getTypeOrder () const { return TYPE_URI; }
979982
virtual const char * getToken () { return "-TTerm-"; }
980983
virtual void express(Expressor* p_expressor) const;

‎tests/fetch-test-suites.sh‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
# Fetch the W3C test-suite data needed by test_Turtle, test_Trig,
3+
# test_RDFXML and test_SPARQL11. Idempotent: skips suites already present.
4+
# Run from anywhere; data lands next to this script.
5+
set -e
6+
cd "$(dirname "$0")"
7+
8+
if [ ! -d TurtleTests ]; then
9+
echo "Fetching TurtleTests..."
10+
curl -sL http://www.w3.org/2013/TurtleTests/TESTS.tar.gz | tar xzf -
11+
fi
12+
13+
if [ ! -d TriGTests ]; then
14+
echo "Fetching TriGTests..."
15+
mkdir -p TriGTests
16+
curl -sL http://www.w3.org/2013/TrigTests/TESTS.tar.gz | tar xzf - -C TriGTests
17+
fi
18+
19+
if [ ! -d RDFXMLTests ]; then
20+
echo "Fetching RDFXMLTests..."
21+
mkdir -p RDFXMLTests
22+
curl -sL http://www.w3.org/2013/RDFXMLTests/TESTS.tar.gz | tar xzf - -C RDFXMLTests
23+
fi
24+
25+
if [ ! -d sparql11-test-suite ]; then
26+
echo "Fetching sparql11-test-suite..."
27+
curl -sL http://www.w3.org/2009/sparql/docs/tests/sparql11-test-suite-20121023.tar.gz | tar xzf -
28+
(cd sparql11-test-suite && patch -p 0 < ../sparql11-test-suite.patch)
29+
fi
30+
31+
echo "Test suites ready."

0 commit comments

Comments
 (0)