-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (130 loc) · 4.68 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
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
# Disabled for now because when running in parallel, GitHub setups different
# machines with different chrome-browsers installed. That causes Cypress errors
# When trying to run in the cypress Docker container, there's no access to "sudo"
# to patch hosts file
# strategy:
# # when one test fails, DO NOT cancel the other
# # containers, because this will kill Cypress processes
# # leaving Cypress Cloud hanging ...
# # https://github.com/cypress-io/github-action/issues/48
# fail-fast: false
# matrix:
# # Run tests in parallel
# containers: [1, 2, 3]
# container:
# # Using Docker container because of the issue with parallelization:
# # https://github.com/cypress-io/github-action/blob/master/README.md#parallel
# # see browsers tags here: https://hub.docker.com/r/cypress/browsers/tags
# image: cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1
# options: --user 1001
# 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@v6
# 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
# # parallel: true
# group: Cypress tests
# env:
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# # Recommended: pass the GitHub token lets this action correctly
# # determine the unique run id necessary to re-run the checks
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# BASE_URL: http://budget-tracker.com:8100
# PORT: 8100
# HOST: budget-tracker.com
# VITE_APP_API_HTTP: https://${{ secrets.API_HOST_PROD }}
# 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 }}