-
Notifications
You must be signed in to change notification settings - Fork 73
87 lines (85 loc) · 2.41 KB
/
push.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
81
82
83
84
85
86
87
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
windows:
runs-on: windows-latest
steps:
- uses: textbook/take-action@nodejs
with:
node-version: 20
- run: npm run lint
nodejs:
strategy:
matrix:
node: [20.9, 20, 22]
runs-on: ubuntu-latest
services:
mongodb:
image: mongo
env:
MONGO_INITDB_ROOT_PASSWORD: keepitsecret
MONGO_INITDB_ROOT_USERNAME: testdb
ports:
- 27017:27017
env:
MONGODB_URI: mongodb://testdb:keepitsecret@localhost:27017/testdb?authSource=admin
steps:
- uses: textbook/take-action@nodejs
with:
node-version: ${{ matrix.node }}
- uses: textbook/take-action@playwright
- run: npm run lint
- run: npm run test:cover
env:
FORCE_COLOR: true
- run: npm run migration up
- run: npm run e2e
- run: npm run e2e:dev
docker:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo
env:
MONGO_INITDB_ROOT_PASSWORD: keepitsecret
MONGO_INITDB_ROOT_USERNAME: testdb
ports:
- 27017:27017
steps:
- uses: textbook/take-action@nodejs
with:
node-version: 20
- uses: textbook/take-action@playwright
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
load: true
push: false
tags: textbook/starter-kit:v2
- id: env-file
run: |
echo 'LOG_LEVEL=debug' >> "$ENV_FILE"
echo 'MONGODB_URI=mongodb://testdb:keepitsecret@localhost:27017/testdb?authSource=admin' >> "$ENV_FILE"
echo 'NODE_ENV=docker' >> "$ENV_FILE"
echo 'PORT=4321' >> "$ENV_FILE"
echo "file=$ENV_FILE" >> "$GITHUB_OUTPUT"
env:
ENV_FILE: docker.env
- id: docker-run
run: |
echo "id=$(docker run \
--detach \
--env-file ${{ steps.env-file.outputs.file }} \
--init \
--network 'host' \
textbook/starter-kit:v2)" >> $GITHUB_OUTPUT
- run: npx --yes wait-on --log --timeout 30000 http-get://localhost:4321
- run: npm run e2e
env:
PLAYWRIGHT_BASE_URL: http://localhost:4321
- if: always() && steps.docker-run.outputs.id
run: docker logs ${{ steps.docker-run.outputs.id }}