-
-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (110 loc) · 3.98 KB
/
test-and-build.yaml
File metadata and controls
131 lines (110 loc) · 3.98 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
name: Test and Build
on:
pull_request:
push:
branches:
- master
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
test-and-build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "21"
- name: Set up Node.js
uses: actions/setup-node@v5
with:
node-version: "22"
cache: npm
- name: Set up Clojure CLI
run: |
curl -fsSL -O https://download.clojure.org/install/linux-install-1.12.4.1602.sh
chmod +x linux-install-1.12.4.1602.sh
sudo ./linux-install-1.12.4.1602.sh
- name: Cache Clojure dependencies
uses: actions/cache@v5
with:
path: |
~/.gitlibs
~/.m2/repository
key: ${{ runner.os }}-clojure-${{ hashFiles('deps.edn') }}
restore-keys: |
${{ runner.os }}-clojure-
- name: Install frontend dependencies
run: npm ci
- name: Install Playwright Chromium
run: npx playwright install --with-deps chromium
- name: Download PocketBase
env:
POCKETBASE_VERSION: "0.36.6"
run: |
curl -fsSL -o /tmp/pocketbase.zip \
"https://github.com/pocketbase/pocketbase/releases/download/v${POCKETBASE_VERSION}/pocketbase_${POCKETBASE_VERSION}_linux_amd64.zip"
unzip -q /tmp/pocketbase.zip -d /tmp/pocketbase
chmod +x /tmp/pocketbase/pocketbase
- name: Initialize PocketBase superuser
env:
PB_SUPERUSER_EMAIL: admin@example.org
PB_SUPERUSER_PASSWORD: change-me
run: |
mkdir -p /tmp/pb_ci_data
/tmp/pocketbase/pocketbase superuser create "$PB_SUPERUSER_EMAIL" "$PB_SUPERUSER_PASSWORD" --dir /tmp/pb_ci_data || \
/tmp/pocketbase/pocketbase superuser upsert "$PB_SUPERUSER_EMAIL" "$PB_SUPERUSER_PASSWORD" --dir /tmp/pb_ci_data
- name: Start PocketBase
run: |
/tmp/pocketbase/pocketbase serve \
--http 127.0.0.1:8090 \
--dir /tmp/pb_ci_data \
>/tmp/pocketbase.log 2>&1 &
echo $! > /tmp/pocketbase.pid
- name: Wait for PocketBase health
run: |
for _ in $(seq 1 30); do
if curl -fsS http://127.0.0.1:8090/api/health >/dev/null; then
exit 0
fi
sleep 1
done
cat /tmp/pocketbase.log
exit 1
- name: Initialize PocketBase users collection
env:
AGILADMIN_CONF: doc/agiladmin.pocketbase.yaml
run: clojure -M -m agiladmin.pocketbase-init
- name: Run tests
run: make test CLOJURE=clojure
# Keep browser regressions separate from live PocketBase integration noise.
- name: Run Playwright E2E tests
run: npm run test:e2e
- name: Run PocketBase integration tests
env:
AGILADMIN_PB_IT: "1"
AGILADMIN_PB_BASE_URL: http://127.0.0.1:8090
AGILADMIN_PB_SUPERUSER_EMAIL: admin@example.org
AGILADMIN_PB_SUPERUSER_PASSWORD: change-me
AGILADMIN_PB_IT_USER_EMAIL: agiladmin-it@example.org
AGILADMIN_PB_IT_USER_PASSWORD: agiladmin-it-secret
run: make test-pocketbase-integration CLOJURE=clojure
- name: Build uberjar
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: make build CLOJURE=clojure
- name: Print PocketBase log on failure
if: failure()
run: |
test -f /tmp/pocketbase.log && cat /tmp/pocketbase.log || true
- name: Upload Playwright artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-artifacts
path: |
test-results
playwright-report
.tmp/agiladmin-e2e-state.json
output/playwright/agiladmin-server.log