@@ -12,110 +12,141 @@ jobs:
1212 runs-on : ubuntu-latest
1313 timeout-minutes : 30
1414
15- services :
16- xtdb :
17- image : ghcr.io/xtdb/xtdb:edge
18- ports :
19- - 5432:5432
20- - 8080:8080
21- options : >-
22- --health-cmd "curl --silent --fail http://localhost:8080/healthz/alive || exit 1"
23- --health-interval 10s
24- --health-timeout 5s
25- --health-retries 5
26-
27- container :
28- image : archlinux:base
29- options : --user root
30-
3115 steps :
3216 - name : Checkout Repository
3317 uses : actions/checkout@v4
3418
35- - name : Install Essential System Dependencies
36- run : |
37- chmod +x $GITHUB_WORKSPACE/.devcontainer/install-system-deps.sh
38- $GITHUB_WORKSPACE/.devcontainer/install-system-deps.sh essential
39-
40- - name : Create Test User
41- run : |
42- useradd -m -s /bin/bash -u 1001 runner
43- echo "runner ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
44-
45- - name : Install and configure mise
46- run : |
47- cp $GITHUB_WORKSPACE/.devcontainer/setup-mise.sh /tmp/setup-mise.sh
48- chmod +x /tmp/setup-mise.sh
49- su - runner -c "/tmp/setup-mise.sh runner $GITHUB_WORKSPACE"
50- rm /tmp/setup-mise.sh
51-
52- - name : Install Language Runtimes
53- run : |
54- chown -R runner:runner $GITHUB_WORKSPACE
55- su - runner -c "cd $GITHUB_WORKSPACE && ~/.local/bin/mise install"
56-
57- - name : Install Language-Specific Tools
58- run : |
59- su - runner -c "cd $GITHUB_WORKSPACE && for dir in python csharp babashka; do
60- if [ -d \"\$dir\" ] && [ -f \"\$dir/.mise.toml\" ]; then
61- echo \"Installing mise tools for \$dir...\"
62- (cd \"\$dir\" && ~/.local/bin/mise install) || echo \"Warning: Failed to install tools for \$dir\"
63- fi
64- done"
65-
66- - name : Setup Language Runtime Packages
67- run : |
68- # Install system packages for Ruby, Elixir, PHP
69- $GITHUB_WORKSPACE/.devcontainer/install-system-deps.sh languages
70-
71- - name : Setup Language Tools (Clojure, Elixir, PHP)
72- run : |
73- cp $GITHUB_WORKSPACE/.devcontainer/setup-language-tools.sh /tmp/setup-language-tools.sh
74- chmod +x /tmp/setup-language-tools.sh
75- su - runner -c "/tmp/setup-language-tools.sh all"
76- rm /tmp/setup-language-tools.sh
77-
78- - name : Install Language Dependencies
79- run : |
80- su - runner -c "cd $GITHUB_WORKSPACE && \
81- eval \"\$(~/.local/bin/mise activate bash)\" && \
82- for dir in python node ruby go elixir php; do
83- if [ -d \"\$dir\" ]; then
84- echo \"Installing dependencies for \$dir...\"
85- (cd \"\$dir\" && ~/.local/bin/mise run deps 2>&1) || echo \"Warning: Failed to install deps for \$dir\"
86- fi
87- done"
88-
89- - name : Wait for XTDB to be Ready
19+ - name : Start XTDB with Flight SQL
9020 run : |
21+ # Create XTDB config with Flight SQL enabled
22+ # Write directly to avoid mount issues
23+ cat > /tmp/xtdb.yaml << 'EOF'
24+ server:
25+ host: '*'
26+ port: 5432
27+
28+ log: !Local
29+ path: "/var/lib/xtdb/log"
30+
31+ storage: !Local
32+ path: "/var/lib/xtdb/buffers"
33+
34+ healthz:
35+ host: '*'
36+ port: 8080
37+
38+ flightSql:
39+ host: '*'
40+ port: 9833
41+ EOF
42+
43+ # Remove leading whitespace from heredoc (caused by YAML indentation)
44+ sed -i 's/^ //' /tmp/xtdb.yaml
45+
46+ # Verify config
47+ echo "XTDB config:"
48+ cat /tmp/xtdb.yaml
49+
50+ # Start XTDB container with custom config that enables Flight SQL
51+ docker run -d --name xtdb \
52+ -p 5432:5432 -p 8080:8080 -p 9833:9833 \
53+ -v "/tmp/xtdb.yaml:/config/xtdb.yaml:ro" \
54+ ghcr.io/xtdb/xtdb:edge \
55+ -f /config/xtdb.yaml
56+
57+ # Wait for XTDB to be ready
9158 for i in {1..60}; do
92- if curl --silent --fail http://xtdb :8080/healthz/alive; then
59+ if curl --silent --fail http://localhost :8080/healthz/alive 2>/dev/null ; then
9360 echo "XTDB is ready"
94- exit 0
61+ break
9562 fi
63+ echo "Waiting for XTDB... ($i/60)"
9664 sleep 2
9765 done
98- echo "XTDB did not start in time" && exit 1
9966
100- - name : Verify XTDB Connection
101- run : |
102- $GITHUB_WORKSPACE/.devcontainer/install-system-deps.sh postgres
103- su - runner -c "psql -h xtdb -U xtdb -d xtdb -c 'SELECT 1'" || echo "PostgreSQL connection test failed"
104- env :
105- PGPASSWORD : xtdb
106-
107- - name : Run All Tests
108- env :
109- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
67+ # Verify it started
68+ if ! curl --silent --fail http://localhost:8080/healthz/alive; then
69+ echo "XTDB did not start in time"
70+ docker logs xtdb
71+ exit 1
72+ fi
73+
74+ - name : Pull Archlinux container
75+ run : docker pull archlinux:base
76+
77+ - name : Run tests in Archlinux container
11078 run : |
111- su - runner -c "cd $GITHUB_WORKSPACE && \
112- export XTDB_HOST=xtdb && \
113- export XTDB_PORT=5432 && \
114- export XTDB_USER=xtdb && \
115- export XTDB_PASSWORD=xtdb && \
116- export XTDB_DATABASE=xtdb && \
117- eval \"\$(~/.local/bin/mise activate bash)\" && \
118- ~/.local/bin/mise run test:all"
79+ docker run --rm \
80+ --network host \
81+ -v ${{ github.workspace }}:/workspace \
82+ -w /workspace \
83+ -e XTDB_HOST=localhost \
84+ -e XTDB_PORT=5432 \
85+ -e XTDB_USER=xtdb \
86+ -e XTDB_PASSWORD=xtdb \
87+ -e XTDB_DATABASE=xtdb \
88+ -e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
89+ archlinux:base \
90+ bash -c '
91+ set -e
92+
93+ # Install essential deps
94+ chmod +x /workspace/.devcontainer/install-system-deps.sh
95+ /workspace/.devcontainer/install-system-deps.sh essential
96+
97+ # Create test user
98+ useradd -m -s /bin/bash -u 1001 runner
99+ echo "runner ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
100+
101+ # Install mise
102+ cp /workspace/.devcontainer/setup-mise.sh /tmp/setup-mise.sh
103+ chmod +x /tmp/setup-mise.sh
104+ su - runner -c "/tmp/setup-mise.sh runner /workspace"
105+
106+ # Install language runtimes
107+ chown -R runner:runner /workspace
108+ su - runner -c "cd /workspace && ~/.local/bin/mise install"
109+
110+ # Install language-specific tools
111+ su - runner -c "cd /workspace && for dir in python csharp babashka; do
112+ if [ -d \"\$dir\" ] && [ -f \"\$dir/.mise.toml\" ]; then
113+ echo \"Installing mise tools for \$dir...\"
114+ (cd \"\$dir\" && ~/.local/bin/mise install) || echo \"Warning: Failed to install tools for \$dir\"
115+ fi
116+ done"
117+
118+ # Install system packages for Ruby, Elixir, PHP
119+ /workspace/.devcontainer/install-system-deps.sh languages
120+
121+ # Setup Clojure, Elixir, PHP
122+ cp /workspace/.devcontainer/setup-language-tools.sh /tmp/setup-language-tools.sh
123+ chmod +x /tmp/setup-language-tools.sh
124+ su - runner -c "/tmp/setup-language-tools.sh all"
125+
126+ # Install language dependencies
127+ su - runner -c "cd /workspace && \
128+ eval \"\$(~/.local/bin/mise activate bash)\" && \
129+ for dir in python node ruby go elixir php; do
130+ if [ -d \"\$dir\" ]; then
131+ echo \"Installing dependencies for \$dir...\"
132+ (cd \"\$dir\" && ~/.local/bin/mise run deps 2>&1) || echo \"Warning: Failed to install deps for \$dir\"
133+ fi
134+ done"
135+
136+ # Verify XTDB connection
137+ /workspace/.devcontainer/install-system-deps.sh postgres
138+ PGPASSWORD=xtdb su - runner -c "psql -h localhost -U xtdb -d xtdb -c \"SELECT 1\"" || echo "PostgreSQL connection test failed"
139+
140+ # Run all tests
141+ su - runner -c "cd /workspace && \
142+ export XTDB_HOST=localhost && \
143+ export XTDB_PORT=5432 && \
144+ export XTDB_USER=xtdb && \
145+ export XTDB_PASSWORD=xtdb && \
146+ export XTDB_DATABASE=xtdb && \
147+ eval \"\$(~/.local/bin/mise activate bash)\" && \
148+ ~/.local/bin/mise run test:all"
149+ '
119150
120151 - name : Upload Test Results
121152 if : always()
@@ -126,3 +157,7 @@ jobs:
126157 **/test-results/
127158 **/coverage/
128159 retention-days : 7
160+
161+ - name : Show XTDB logs on failure
162+ if : failure()
163+ run : docker logs xtdb
0 commit comments