-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (126 loc) · 4.88 KB
/
Copy pathtest.yml
File metadata and controls
129 lines (126 loc) · 4.88 KB
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
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.9 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.9', '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 (`latest` floats; pinned tags lock v2.x / v3.x)
# * 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:
surreal-image:
- surrealdb/surrealdb:v2
- surrealdb/surrealdb:latest
wire:
- cbor
- json
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- 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:
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: '1'
- 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