-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (52 loc) · 1.84 KB
/
docker-test.yml
File metadata and controls
66 lines (52 loc) · 1.84 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
name: Docker Startup Test
# yamllint disable-line rule:truthy
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
permissions:
contents: read
jobs:
test-docker-startup:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@main
- name: Setup Node.js
uses: actions/setup-node@main
with:
node-version: lts/*
cache: npm
- name: Install npm dependencies
run: npm ci --ignore-scripts
- name: Verify committed assets are up to date
run: |
npm run build:assets
if ! git diff --quiet -- docroot/css docroot/js data/assets/assets-sizes.json; then
echo "Committed assets are out of date. Run 'npm run build:assets' and commit generated files."
git status --short -- docroot/css docroot/js data/assets/assets-sizes.json
exit 1
fi
- name: Setup environment
run: |
cp .env.sample .env
cp data/db/schema.sql install/db/
cp data/db/schema_init_sample.sql install/db/
- name: Start Docker Compose services
run: docker compose up -d
- name: Wait for web server
run: |
timeout 300 sh -c 'until docker compose exec -T web curl --fail http://localhost > /dev/null 2>&1; do echo "Waiting for web..."; sleep 2; done'
- name: Test homepage loads inside the container
run: docker compose exec -T web curl --fail http://localhost --output /dev/null
- name: Test homepage loads outside the container
run: |
source .env
curl --fail http://localhost:${HTTP_PORT} --output /dev/null
- name: Show logs on failure
if: failure()
run: docker compose logs
- name: Cleanup
if: always()
run: docker compose down -v