-
Notifications
You must be signed in to change notification settings - Fork 89
80 lines (67 loc) · 1.89 KB
/
docker-image.yml
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
name: e2e test
on:
push:
branches: "**"
pull_request:
branches: "**"
env:
PG_DB: postgres
PG_USER: postgres
PG_HOST: localhost
PG_PASS: thisisapassword
jobs:
build_chat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: check locale
run: python scripts/locale_missing_key.py web/src/locales --base zh-CN
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "16.x"
- name: build web
run: |
npm install
npm run build
working-directory: web
- name: copy to api/static
run: |
cp -R web/dist/* api/static/
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Build API
run: go build -v ./...
working-directory: api
- name: Test API
run: go test -v ./...
working-directory: api
- name: Build Chat image
run: |
docker build . --file Dockerfile -t ghcr.io/swuecho/chat:${GITHUB_SHA}
- name: change docker image tag
run: python scripts/replace_tag_to_test.py ${GITHUB_SHA}
- name: docker-compose
run: docker-compose up -d
- name: show docker ps
run: docker-compose ps
- name: show docker logs
run: docker-compose logs
# Setup cache for node_modules
- name: Cache node modules
uses: actions/cache@v3
with:
path: e2e/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('e2e/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
working-directory: e2e
- name: Install playwright browsers
run: npx playwright install --with-deps
working-directory: e2e
- run: npx playwright test
working-directory: e2e