-
Notifications
You must be signed in to change notification settings - Fork 22
109 lines (102 loc) · 3.37 KB
/
ci.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: testsuite
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
NODE_VERSION: 18.x
DOCKER_REPO: sheltertechsf/askdarcel-web
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- run: npm ci
- run: cp config.example.yml config.yml
- run: npm run prettier
- run: npm run lint
test_unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- run: npm ci
- run: cp config.example.yml config.yml
- run: npm run test
test_e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- run: npm ci
- run: cp config.example.yml config.yml
- run: npm run build
- run: docker-compose -f docker-compose.test.yml up -d db api api-go frontend
- run: sleep 60
- run: yarn cypress run
- if: always()
run: docker-compose -f docker-compose.test.yml logs -t # Output all docker logs from API and frontend to help debugging after the fact
- uses: actions/upload-artifact@v2
if: failure()
with:
name: E2E screenshot(s) and video(s)
path: |
/home/runner/work/askdarcel-web/askdarcel-web/cypress/videos/
/home/runner/work/askdarcel-web/askdarcel-web/cypress/screenshots/
retention-days: 3
publish-latest:
runs-on: ubuntu-latest
needs: [lint, test_e2e, test_unit]
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v2
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- run: npm ci
- run: cp config.example.yml config.yml
- run: CONFIG_YAML=config.docker.yml npm run build
- run: touch version.json
- uses: docker/build-push-action@v2
with:
push: true
context: .
tags: ${{ env.DOCKER_REPO }}:latest
- run: echo ${{ steps.docker_build.outputs.digest }}