name: Build and Test
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master]
jobs:
build-framework:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential uuid-dev valgrind
- name: Build CelerityAPI Example
run: make all
- name: Build DocDB
run: make -f Makefile.docdb all
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries
path: |
example
loadtest
docserver
docclient
test-framework:
runs-on: ubuntu-latest
needs: build-framework
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential uuid-dev
- name: Build
run: |
make all
make -f Makefile.docdb all
- name: Test CelerityAPI
run: |
./example --port 9000 &
sleep 2
./loadtest -c 10 -d 3 http://127.0.0.1:9000/health
pkill -f "./example --port 9000" || true
- name: Test DocDB
run: |
./docserver --port 9080 &
sleep 2
./docclient --port 9080 --quick
pkill -f "./docserver --port 9080" || true
test-docdb-full:
runs-on: ubuntu-latest
needs: build-framework
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential uuid-dev
- name: Build DocDB
run: make -f Makefile.docdb all
- name: Run full test suite
run: |
./docserver --port 9080 &
sleep 2
./docclient --port 9080
pkill -f "./docserver --port 9080" || true
- name: Test persistence
run: |
rm -rf ./docdb_data
./docserver --port 9080 &
sleep 1
curl -X POST http://127.0.0.1:9080/collections -H "Content-Type: application/json" -d '{"name":"ci_test"}'
curl -X POST http://127.0.0.1:9080/collections/ci_test/documents -H "Content-Type: application/json" -d '{"test":"data"}'
pkill -f "./docserver --port 9080" || true
sleep 1
./docserver --port 9080 &
sleep 1
curl -s http://127.0.0.1:9080/collections/ci_test | grep -q "ci_test"
pkill -f "./docserver --port 9080" || true
memory-check:
runs-on: ubuntu-latest
needs: build-framework
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential uuid-dev valgrind
- name: Build with debug symbols
run: |
make debug
make -f Makefile.docdb debug
- name: Memory check CelerityAPI
run: |
timeout 10 valgrind --leak-check=full --error-exitcode=1 ./example --port 9000 &
sleep 3
curl http://127.0.0.1:9000/health || true
curl http://127.0.0.1:9000/users || true
pkill -f "./example" || true
- name: Memory check DocDB
run: |
timeout 10 valgrind --leak-check=full --error-exitcode=1 ./docserver --port 9080 &
sleep 3
curl -X POST http://127.0.0.1:9080/collections -H "Content-Type: application/json" -d '{"name":"valgrind_test"}' || true
curl http://127.0.0.1:9080/collections || true
pkill -f "./docserver" || true