forked from NicTool/NicTool
-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (111 loc) · 3.79 KB
/
Copy pathdocker.yml
File metadata and controls
134 lines (111 loc) · 3.79 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
name: Docker
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- '.github/workflows/docker.yml'
- 'client/**'
- 'server/**'
- 'dist/**'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build Docker image
uses: docker/build-push-action@v7
with:
context: .
file: dist/docker/Dockerfile
tags: docker-web:latest
cache-from: type=gha
cache-to: type=gha,mode=max
docker-tests:
needs: build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Load Docker image from cache
uses: docker/build-push-action@v7
with:
context: .
file: dist/docker/Dockerfile
tags: docker-web:latest
load: true
cache-from: type=gha
- name: Generate credentials
run: |
dist/docker/generate-env.sh
echo "NICTOOL_TEST_PASSWORD=$(sed -n 's/^ROOT_USER_PASSWORD=//p' dist/docker/.env)" >> "$GITHUB_ENV"
- name: Start containers
working-directory: dist/docker
run: docker compose up -d --wait
timeout-minutes: 5
- name: Run server tests
run: docker compose -f dist/docker/docker-compose.yml exec -T web make -C /usr/local/nictool/server test
- name: Run client tests
run: docker compose -f dist/docker/docker-compose.yml exec -T web make -C /usr/local/nictool/client test
- name: Failure diagnostics
if: failure()
run: |
docker compose -f dist/docker/docker-compose.yml logs web || true
docker compose -f dist/docker/docker-compose.yml logs db || true
e2e-tests:
needs: build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Load Docker image from cache
uses: docker/build-push-action@v7
with:
context: .
file: dist/docker/Dockerfile
tags: docker-web:latest
load: true
cache-from: type=gha
- name: Generate credentials
run: |
dist/docker/generate-env.sh
echo "NICTOOL_TEST_PASSWORD=$(sed -n 's/^ROOT_USER_PASSWORD=//p' dist/docker/.env)" >> "$GITHUB_ENV"
- name: Start containers
working-directory: dist/docker
run: docker compose up -d --wait
timeout-minutes: 5
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
cache-dependency-path: client/t/e2e/package-lock.json
- name: Cache Playwright browsers
uses: actions/cache@v5
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ hashFiles('client/t/e2e/package-lock.json') }}
- name: Install E2E dependencies
working-directory: client/t/e2e
run: |
npm ci
npx playwright install --with-deps chromium
- name: Run E2E tests
working-directory: client/t/e2e
env:
NICTOOL_URL: http://localhost:8080
NICTOOL_TEST_PASSWORD: ${{ env.NICTOOL_TEST_PASSWORD }}
DEBUG: pw:api
run: npx playwright test --reporter=list
- name: Failure diagnostics
if: failure()
run: |
docker compose -f dist/docker/docker-compose.yml logs web || true
docker compose -f dist/docker/docker-compose.yml logs db || true
docker compose -f dist/docker/docker-compose.yml exec -T web cat /var/log/apache2/error.log 2>/dev/null || true