-
Notifications
You must be signed in to change notification settings - Fork 1
155 lines (126 loc) · 3.88 KB
/
main.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Main
on:
push:
branches: [ main, beta, 1.x ]
pull_request:
branches: [ main, beta, 1.x ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Build
run: yarn build
- uses: actions/upload-artifact@v4
with:
name: bedita-sdk
path: dist
test:
needs: build
runs-on: ubuntu-latest
env:
BEDITA_API_KEY: 1234567890
BEDITA_API: http://localhost:8090
BEDITA_ADMIN_USR: admin
BEDITA_ADMIN_PWD: admin
BEDITA_DOCKER_IMG: bedita/bedita:5
strategy:
matrix:
node-version: [18, 20, 22]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '${{ matrix.node-version }}'
cache: 'yarn'
- name: 'Docker pull bedita image'
run: 'docker pull ${BEDITA_DOCKER_IMG}'
- name: 'Docker inspect bedita image'
run: 'docker inspect ${BEDITA_DOCKER_IMG}'
- name: 'Docker run bedita image'
run: 'docker run --name api -d -p 8090:80 --env BEDITA_API_KEY=${BEDITA_API_KEY} --env BEDITA_ADMIN_USR=${BEDITA_ADMIN_USR} --env BEDITA_ADMIN_PWD=${BEDITA_ADMIN_PWD} ${BEDITA_DOCKER_IMG}'
- name: 'Wait for 10'
run: 'sleep 10'
- name: 'Docker ps - show all containers'
run: 'docker ps -a'
- name: Install dependencies
run: yarn install
- name: Linter
run: yarn lint
- name: Test
run: yarn test
coverage:
needs: build
runs-on: ubuntu-latest
env:
BEDITA_API_KEY: 1234567890
BEDITA_API: http://localhost:8090
BEDITA_ADMIN_USR: admin
BEDITA_ADMIN_PWD: admin
BEDITA_DOCKER_IMG: bedita/bedita:5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'yarn'
- name: 'Docker pull bedita image'
run: 'docker pull ${BEDITA_DOCKER_IMG}'
- name: 'Docker inspect bedita image'
run: 'docker inspect ${BEDITA_DOCKER_IMG}'
- name: 'Docker run bedita image'
run: 'docker run --name api -d -p 8090:80 --env BEDITA_API_KEY=${BEDITA_API_KEY} --env BEDITA_ADMIN_USR=${BEDITA_ADMIN_USR} --env BEDITA_ADMIN_PWD=${BEDITA_ADMIN_PWD} ${BEDITA_DOCKER_IMG}'
- name: 'Wait for 10'
run: 'sleep 10'
- name: 'Docker ps - show all containers'
run: 'docker ps -a'
- name: Install dependencies
run: yarn install
- name: Coverage
run: yarn coverage
- name: Check test coverage
id: test-coverage
uses: johanvanhelden/gha-clover-test-coverage-check@v1
with:
percentage: '65'
filename: './coverage/clover.xml'
- name: 'Export coverage results'
uses: 'codecov/codecov-action@v3'
with:
file: './coverage/clover.xml'
env_vars: NODE_VERSION
- name: 'Archive code coverage results'
uses: 'actions/upload-artifact@v4'
with:
name: 'NODE 20'
path: './coverage/clover.xml'
release:
needs: [test, coverage]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'yarn'
- name: Install dependencies
run: yarn install
- uses: actions/download-artifact@v4
with:
name: bedita-sdk
path: dist
- uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 19
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}