-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (108 loc) · 3.49 KB
/
check-source-code.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
110
111
112
113
114
115
name: Lint, Test and Build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
prepare-dependencies:
name: Prepare local deps
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }}
- id: prepare-env
uses: ./.github/actions/prepare-local-env
- name: Install dependencies
if: steps.prepare-env.outputs.cache-hit != 'true'
run: npm ci
lint:
name: Lint source code
needs: prepare-dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }}
- uses: ./.github/actions/prepare-local-env
- name: Lint source code
run: npm run lint
unit-tests:
name: Unit testing
needs: prepare-dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }}
- uses: ./.github/actions/prepare-local-env
- name: Unit testing
run: npm run test:unit
build:
name: Build source code
needs: prepare-dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }}
- uses: ./.github/actions/prepare-local-env
- name: Build source code
run: npm run build
integration-tests:
name: Integration testing
needs: prepare-dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }}
- uses: ./.github/actions/prepare-local-env
- name: Run Cypress e2e tests
uses: cypress-io/github-action@v4
with:
start: npm run dev
wait-on: http://budget-tracker.com:8100
install: false
config-file: cypress.config.ts
browser: chrome
quiet: true
record: true
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to detect new build vs re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_URL: http://budget-tracker.com:8100
PORT: 8100
HOST: budget-tracker.com
VITE_APP_API_HTTP: http://${{ secrets.VPS_HOST }}:8081
VITE_APP_API_VER: ${{ secrets.VUE_APP_API_VER }}
docker-build:
name: Build source code using Docker
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }}
- id: docker-build
uses: ./.github/actions/docker-build
with:
vps-host: ${{ secrets.VPS_HOST }}
vue-app-api-ver: ${{ secrets.VUE_APP_API_VER }}
docker-hub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
docker-hub-access-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Image digest
run: echo ${{ steps.docker-build.outputs.docker-build-digest }}