-
Notifications
You must be signed in to change notification settings - Fork 5
163 lines (136 loc) · 5.36 KB
/
Copy pathtest.yml
File metadata and controls
163 lines (136 loc) · 5.36 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Test All Languages
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Start XTDB with Flight SQL
run: |
# Create XTDB config with Flight SQL enabled
# Write directly to avoid mount issues
cat > /tmp/xtdb.yaml << 'EOF'
server:
host: '*'
port: 5432
log: !Local
path: "/var/lib/xtdb/log"
storage: !Local
path: "/var/lib/xtdb/buffers"
healthz:
host: '*'
port: 8080
flightSql:
host: '*'
port: 9833
EOF
# Remove leading whitespace from heredoc (caused by YAML indentation)
sed -i 's/^ //' /tmp/xtdb.yaml
# Verify config
echo "XTDB config:"
cat /tmp/xtdb.yaml
# Start XTDB container with custom config that enables Flight SQL
docker run -d --name xtdb \
-p 5432:5432 -p 8080:8080 -p 9833:9833 \
-v "/tmp/xtdb.yaml:/config/xtdb.yaml:ro" \
ghcr.io/xtdb/xtdb:edge \
-f /config/xtdb.yaml
# Wait for XTDB to be ready
for i in {1..60}; do
if curl --silent --fail http://localhost:8080/healthz/alive 2>/dev/null; then
echo "XTDB is ready"
break
fi
echo "Waiting for XTDB... ($i/60)"
sleep 2
done
# Verify it started
if ! curl --silent --fail http://localhost:8080/healthz/alive; then
echo "XTDB did not start in time"
docker logs xtdb
exit 1
fi
- name: Pull Archlinux container
run: docker pull archlinux:base
- name: Run tests in Archlinux container
run: |
docker run --rm \
--network host \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
-e XTDB_HOST=localhost \
-e XTDB_PORT=5432 \
-e XTDB_USER=xtdb \
-e XTDB_PASSWORD=xtdb \
-e XTDB_DATABASE=xtdb \
-e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
archlinux:base \
bash -c '
set -e
# Install essential deps
chmod +x /workspace/.devcontainer/install-system-deps.sh
/workspace/.devcontainer/install-system-deps.sh essential
# Create test user
useradd -m -s /bin/bash -u 1001 runner
echo "runner ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Install mise
cp /workspace/.devcontainer/setup-mise.sh /tmp/setup-mise.sh
chmod +x /tmp/setup-mise.sh
su - runner -c "/tmp/setup-mise.sh runner /workspace"
# Install language runtimes
chown -R runner:runner /workspace
su - runner -c "cd /workspace && MISE_NODE_VERIFY=false ~/.local/bin/mise install"
# Install language-specific tools
su - runner -c "cd /workspace && for dir in python csharp babashka; do
if [ -d \"\$dir\" ] && [ -f \"\$dir/.mise.toml\" ]; then
echo \"Installing mise tools for \$dir...\"
(cd \"\$dir\" && ~/.local/bin/mise install) || echo \"Warning: Failed to install tools for \$dir\"
fi
done"
# Install system packages for Ruby, Elixir, PHP
/workspace/.devcontainer/install-system-deps.sh languages
# Setup Clojure, Elixir, PHP
cp /workspace/.devcontainer/setup-language-tools.sh /tmp/setup-language-tools.sh
chmod +x /tmp/setup-language-tools.sh
su - runner -c "/tmp/setup-language-tools.sh all"
# Install language dependencies
su - runner -c "cd /workspace && \
eval \"\$(~/.local/bin/mise activate bash)\" && \
for dir in python node ruby go elixir php; do
if [ -d \"\$dir\" ]; then
echo \"Installing dependencies for \$dir...\"
(cd \"\$dir\" && ~/.local/bin/mise run deps 2>&1) || echo \"Warning: Failed to install deps for \$dir\"
fi
done"
# Verify XTDB connection
/workspace/.devcontainer/install-system-deps.sh postgres
PGPASSWORD=xtdb su - runner -c "psql -h localhost -U xtdb -d xtdb -c \"SELECT 1\"" || echo "PostgreSQL connection test failed"
# Run all tests
su - runner -c "cd /workspace && \
export XTDB_HOST=localhost && \
export XTDB_PORT=5432 && \
export XTDB_USER=xtdb && \
export XTDB_PASSWORD=xtdb && \
export XTDB_DATABASE=xtdb && \
eval \"\$(~/.local/bin/mise activate bash)\" && \
~/.local/bin/mise run test:all"
'
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
**/test-results/
**/coverage/
retention-days: 7
- name: Show XTDB logs on failure
if: failure()
run: docker logs xtdb