Skip to content

ci: docker test-ci parity harness #71

ci: docker test-ci parity harness

ci: docker test-ci parity harness #71

Workflow file for this run

name: Test
on: [push, pull_request]
jobs:
# Unit-only run: server-dependent and embedded testsets self-skip when
# their prerequisites aren't available. Matrix across the compat range
# (1.10 LTS) and current stable to catch version-skew regressions.
test-unit:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
julia-version: ['1.10', '1']
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
if: matrix.julia-version == '1'
- uses: codecov/codecov-action@v4
if: matrix.julia-version == '1'
with:
files: lcov.info
fail_ci_if_error: false
# Matrix across SurrealDB server versions and wire formats. Catches:
# * version-skew bugs (tags pinned, not floating, so a run is
# reproducible over time; bump deliberately in a PR)
# * wire-codec drift against a real server (mock-only tests echo the
# codec; only a live server emits ciborium-canonical envelopes for
# RPC responses, query results, errors, and notification frames)
test-remote:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
julia-version: ['1.10', '1']
surreal-image:
- surrealdb/surrealdb:v2.6.5
- surrealdb/surrealdb:v3.1.2
wire:
- cbor
- json
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- name: Instantiate test env
run: julia --project=test -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Start SurrealDB (${{ matrix.surreal-image }})
run: |
docker run -d -p 8000:8000 \
--name surrealdb \
-e SURREAL_LOG=debug \
-e RUST_LOG=surrealdb=debug,surrealdb_server=debug \
${{ matrix.surreal-image }} \
start --user root --pass root --log debug memory
- name: Wait for SurrealDB
run: |
for i in $(seq 1 30); do
curl -s -X POST http://localhost:8000/rpc \
-H "Content-Type: application/json" \
-d '{"id":1,"method":"version","params":[]}' && break
sleep 1
done
- name: Run remote tests
run: julia --project=test test/runtests.jl
env:
SURREALDB_URL: ws://localhost:8000
SURREALDB_WIRE: ${{ matrix.wire }}
- name: Docker logs (always — needed on cancellation too)
if: always()
run: docker logs surrealdb 2>&1 | tail -200
# Embedded matrix: linux x86_64 (glibc) and macos arm64 (libSystem).
# The s2 audit hit an ARM64-only `sr_object_keys` FFI bug — having
# macos-latest in the matrix catches that bug class on every PR.
test-embedded:
strategy:
fail-fast: false
matrix:
julia-version: ['1.10', '1']
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- name: Instantiate test env
run: julia --project=test -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
# Cache only cargo's own dirs, NOT /tmp/surrealdb.c/target — the
# latter caused build failures when the cache restored the target
# directory without the source tree, defeating the `if [ ! -d ]`
# guard. Cargo's own build cache is enough.
- name: Cache cargo registries
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-registry-${{ runner.os }}
- name: Build libsurreal
run: |
# Always re-clone to a deterministic state (--depth 1 is cheap).
rm -rf /tmp/surrealdb.c
git clone https://github.com/surrealdb/surrealdb.c.git --depth 1 /tmp/surrealdb.c
cd /tmp/surrealdb.c
cargo build --release
# Each platform produces a different filename; copy whichever exists.
cp target/release/libsurrealdb_c.so ${RUNNER_TEMP}/libsurreal.lib 2>/dev/null || \
cp target/release/libsurrealdb_c.dylib ${RUNNER_TEMP}/libsurreal.lib 2>/dev/null || \
cp target/release/surrealdb_c.dll ${RUNNER_TEMP}/libsurreal.lib
env:
CARGO_PROFILE_RELEASE_DEBUG: 0
- name: Run full suite (embedded loaded via SURREALDB_LIB)
run: julia --project=test test/runtests.jl
env:
SURREALDB_LIB: ${{ runner.temp }}/libsurreal.lib