-
Notifications
You must be signed in to change notification settings - Fork 3
69 lines (63 loc) · 2.49 KB
/
Copy pathconverged-database-lab.yml
File metadata and controls
69 lines (63 loc) · 2.49 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
name: converged-database-lab
on:
push:
branches: [main]
paths:
- 'labs/converged-database-lab/**'
- '.github/workflows/converged-database-lab.yml'
pull_request:
paths:
- 'labs/converged-database-lab/**'
- '.github/workflows/converged-database-lab.yml'
schedule:
- cron: '17 6 * * *' # nightly: substantive freshness, not cosmetic
workflow_dispatch:
jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 45
defaults:
run:
working-directory: labs/converged-database-lab
steps:
- uses: actions/checkout@v4
- name: Free disk space
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
- name: Boot lab (build + init)
run: |
docker compose up -d --build oracle
# Health check polls every 15s with up to 40 retries + 120s start_period.
# We wait up to 90 × 15s = 22.5 min, which covers the cold-start image pull
# and DB initialization in CI. Break early once healthy; fail fast on unhealthy.
for i in $(seq 1 90); do
status=$(docker inspect -f '{{.State.Health.Status}}' lab-oracle 2>/dev/null || echo "starting")
[ "$status" = "healthy" ] && echo "Healthy after $((i * 15))s" && break
if [ "$status" = "unhealthy" ]; then
echo "Container is unhealthy — printing last 100 log lines and aborting"
docker logs lab-oracle --tail 100
exit 1
fi
echo "[$i/90] status=$status — sleeping 15s"
sleep 15
done
final=$(docker inspect -f '{{.State.Health.Status}}' lab-oracle)
if [ "$final" != "healthy" ]; then
echo "Container never became healthy (status=$final)"
docker logs lab-oracle --tail 100
exit 1
fi
- name: Verify domain initialized
# Use a heredoc piped to sqlplus to avoid all shell-quoting issues.
# The grep checks for 'customers=200' in the output.
run: |
docker exec lab-oracle bash -c "sqlplus -s / as sysdba <<'ENDSQL'
ALTER SESSION SET CONTAINER=FREEPDB1;
SELECT 'customers='||COUNT(*) FROM lab_user.customers;
ENDSQL
" | grep -q 'customers=200'
- uses: actions/setup-python@v5
with: { python-version: '3.11' }
- name: Run validator
run: |
pip install -r validator/requirements.txt
python validator/run.py