This repository has been archived by the owner on Apr 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
158 lines (134 loc) · 4.71 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
156
157
158
name: TONOS SE
on:
push:
branches:
- main
paths-ignore:
- "README.md"
pull_request:
types: [labeled]
env:
DEFAULT_PORTS: '{"nginx":8080,"arango":8529,"qserver":4000,"node":40301,"requests":3000}'
CUSTOM_PORTS: '{"nginx":8881,"arango":8882,"qserver":8883,"node":8884,"requests":8885}'
defaults:
run:
shell: bash
jobs:
labels:
name: Label taking off
if: github.event.label.name == 'start_tests'
runs-on: ubuntu-latest
steps:
- name: Take off label
uses: actions/github-script@v1
with:
script: "github.issues.removeLabel({...context.issue, name: '${{ github.event.label.name }}' })"
tests:
if: github.event.label.name == 'start_tests' || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
node-version: [14.x]
os: [ubuntu, macos, windows]
runs-on: ${{ matrix.os }}-latest
steps:
- name: Prepare envs
uses: actions/github-script@v3
with:
script: |
core.exportVariable('DEFAULT_PORTS_ARRAY', Object.values(JSON.parse(process.env.DEFAULT_PORTS)).join(','));
var customPorts = JSON.parse(process.env.CUSTOM_PORTS);
core.exportVariable('CUSTOM_PORTS_ARRAY', Object.values(customPorts).join(','));
Object.keys(customPorts).forEach((name) => core.exportVariable(`CUSTOM_PORTS_${name.toUpperCase()}`, customPorts[name]));
- name: "Use Node.js: ${{ matrix.node-version }} OS: ${{matrix.os}}"
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/checkout@v2
with:
path: tonos-se
- uses: actions/checkout@v2
with:
repository: tonlabs/ton-client-js
path: ton-client-js
- name: Install tonos-se tools
working-directory: tonos-se
run: |
npm ci
npm i -g
- name: Install Type Script
run: npm i -g typescript
- name: Build ton-client-js/packages/core
working-directory: ton-client-js/packages/core
run: |
npm i
tsc
- name: Build ton-client-js/packages/tests
working-directory: ton-client-js/packages/tests
run: |
npm i
tsc
- name: Restore packages ton-client-js/packages/tests-node
working-directory: ton-client-js/packages/tests-node
run: npm i
- name: Run TON OS SE
run: tonos-se start
- name: Ensure that ports are opened
uses: nrukavkov/open-ports-check-action@v1
with:
port: ${{ env.DEFAULT_PORTS_ARRAY }}
needFail: "true"
- name: Run tests
working-directory: ton-client-js/packages/tests-node
env:
USE_NODE_SE: true
TON_NETWORK_ADDRESS: http://localhost:${{ fromJson(env.DEFAULT_PORTS).nginx }}
run: node run
- name: Stop TON OS SE
run: tonos-se stop
- name: Ensure that ports are closed
uses: nrukavkov/open-ports-check-action@v1
with:
port: ${{ env.DEFAULT_PORTS_ARRAY }}
needFail: "true"
reverse: "true"
- name: Change default ports
run: |
tonos-se config --nginx-port ${{ env.CUSTOM_PORTS_NGINX }} --arango-port ${{ env.CUSTOM_PORTS_ARANGO }} --ton-node-port ${{ env.CUSTOM_PORTS_NODE }} --q-server-port ${{ env.CUSTOM_PORTS_QSERVER }} --ton-node-kafka-msg-port ${{ env.CUSTOM_PORTS_REQUESTS }}
- name: Run TON OS SE
run: tonos-se start
- name: Ensure that ports are opened
uses: nrukavkov/open-ports-check-action@v1
with:
port: ${{ env.CUSTOM_PORTS_ARRAY }}
needFail: "true"
- name: Run tests
working-directory: ton-client-js/packages/tests-node
env:
USE_NODE_SE: true
TON_NETWORK_ADDRESS: http://localhost:${{ env.CUSTOM_PORTS_NGINX }}
run: node run
- name: Stop TON OS SE
run: tonos-se stop
- name: Ensure that ports are closed
uses: nrukavkov/open-ports-check-action@v1
with:
port: ${{ env.CUSTOM_PORTS_ARRAY }}
needFail: "true"
reverse: "true"
publish:
needs: tests
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.1.5
- uses: JS-DevTools/npm-publish@v1
id: npm-publish
with:
token: ${{ secrets.NPM_TOKEN }}
- uses: tvdias/github-tagger@v0.0.2
if: ${{ steps.npm-publish.outputs.type != 'none' && steps.npm-publish.outputs.dry-run != 'true' }}
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
tag: "v${{ steps.npm-publish.outputs.version }}"