-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (152 loc) · 5.81 KB
/
Copy pathci.yml
File metadata and controls
174 lines (152 loc) · 5.81 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
164
165
166
167
168
169
170
171
172
173
174
name: CI
on:
push:
branches: [master]
tags: ['v*']
pull_request:
branches: [master]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build & verify
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '11'
# No `cache: maven` here: this is a deps.edn project with no pom.xml,
# so the Maven cache lookup fails the job. Deps are cached by the
# actions/cache step below instead.
- name: Install Clojure CLI
# Install the official Clojure CLI directly via download.clojure.org
# (DeLaGuardo/setup-clojure intermittently 403s on GitHub asset
# downloads, issue #42). The linux-install script is the canonical
# install method for deps.edn projects. Pin to 1.11.1.1403 (the last
# 1.11.x CLI) because the code targets Clojure 1.11 and the 1.12 CLI
# bundles a stricter compiler that rejects the inner-class type hints.
run: |
curl -fsSL https://github.com/clojure/brew-install/releases/download/1.11.1.1403/linux-install.sh -o /tmp/linux-install.sh
chmod +x /tmp/linux-install.sh
/tmp/linux-install.sh --prefix "$HOME/.local" --version 1.11.1.1403
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
shell: bash
- name: Cache Clojure deps
uses: actions/cache@v6
with:
path: |
~/.m2
~/.gitlibs
~/.clojure
.cpcache
key: clj-deps-${{ runner.os }}-${{ hashFiles('deps.edn') }}
restore-keys: |
clj-deps-${{ runner.os }}-
- name: Print versions
run: |
clojure --version
java -version
- name: Compile Java exception classes
# Compile the five tiny Java exception classes AOT so the Clojure code
# can catch them by type. Output goes to target/classes (on the path).
run: |
mkdir -p target/classes
javac -d target/classes $(find java-src -name '*.java')
- name: Offline tests (no daemon)
# Run the test suite without a daemon; the live tests self-skip and the
# offline in-process tests run normally.
run: clojure -M:test -m visorcraft.mongreldb.live-test --offline
live:
# Boots a real mongreldb-server and runs the live round-trip suite.
name: Live integration (against mongreldb-server)
runs-on: ubuntu-latest
env:
SERVER_VERSION: '0.63.1'
MONGRELDB_URL: http://127.0.0.1:8453
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '11'
# No `cache: maven` here: this is a deps.edn project with no pom.xml,
# so the Maven cache lookup fails the job. Deps are cached by the
# actions/cache step below instead.
- name: Install Clojure CLI
run: |
curl -fsSL https://github.com/clojure/brew-install/releases/download/1.11.1.1403/linux-install.sh -o /tmp/linux-install.sh
chmod +x /tmp/linux-install.sh
/tmp/linux-install.sh --prefix "$HOME/.local" --version 1.11.1.1403
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
shell: bash
- name: Cache Clojure deps
uses: actions/cache@v6
with:
path: |
~/.m2
~/.gitlibs
~/.clojure
.cpcache
key: clj-deps-${{ runner.os }}-${{ hashFiles('deps.edn') }}
restore-keys: |
clj-deps-${{ runner.os }}-
- name: Print versions
run: |
clojure --version
java -version
- name: Compile Java exception classes
run: |
mkdir -p target/classes
javac -d target/classes $(find java-src -name '*.java')
- name: Cache mongreldb-server binary
id: server-cache
uses: actions/cache@v6
with:
path: bin/mongreldb-server
key: mongreldb-server-linux-x64-${{ env.SERVER_VERSION }}
- name: Download mongreldb-server
if: steps.server-cache.outputs.cache-hit != 'true'
run: |
mkdir -p bin
curl -fsSL -o bin/mongreldb-server \
"https://github.com/visorcraft/MongrelDB/releases/download/v${SERVER_VERSION}/mongreldb-server-linux-x64"
chmod +x bin/mongreldb-server
./bin/mongreldb-server --help | head -n 1
- name: Start mongreldb-server
run: |
rm -rf /tmp/mongreldb-data
./bin/mongreldb-server /tmp/mongreldb-data --port 8453 > /tmp/mongreldb-server.log 2>&1 &
echo $! > /tmp/mongreldb-server.pid
# Wait for the daemon to become healthy (max ~30s).
for i in $(seq 1 30); do
if curl -sf http://127.0.0.1:8453/health >/dev/null 2>&1; then
echo "mongreldb-server is healthy"
break
fi
sleep 1
done
curl -sf http://127.0.0.1:8453/health >/dev/null || (cat /tmp/mongreldb-server.log && exit 1)
- name: Run live tests
run: clojure -M:test -m visorcraft.mongreldb.live-test
- name: Run examples
run: |
for ex in basic-crud query-builder-example transactions-example; do
echo "=== Running $ex ==="
clojure -M:examples -m "$ex" || { echo "FAILED: $ex"; exit 1; }
done
- name: Dump server log on failure
if: failure()
run: cat /tmp/mongreldb-server.log
- name: Stop mongreldb-server
if: always()
run: |
if [ -f /tmp/mongreldb-server.pid ]; then
kill "$(cat /tmp/mongreldb-server.pid)" 2>/dev/null || true
fi