This repository has been archived by the owner on Jun 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
123 lines (99 loc) · 2.94 KB
/
nodejs.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
name: Test, Eslint and Publish
on:
push:
tags:
- '*'
branches:
- master
pull_request:
branches:
- '*'
schedule:
# run every day at 00:00
- cron: '0 0 * * *'
jobs:
eslint:
name: Run eslint using Node 12
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
- name: npm run eslint
run: |
npm ci
npm run eslint
test:
name: Test Unit/Build/Benchmark using Node ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm ci
run: npm ci
- name: test-unit
run: npm run test-unit
- name: build
run: npm run build
- name: benchmarks
run: npm run benchmark
integration:
name: Test Integration using Node ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: setup streamr-docker-dev
run: |
sudo service mysql stop
git clone https://github.com/streamr-dev/streamr-docker-dev.git
sudo ifconfig docker0 10.200.10.1/24
${GITHUB_WORKSPACE}/streamr-docker-dev/streamr-docker-dev/bin.sh start --wait
- name: npm ci
run: npm ci
- name: build
run: npm run build
- name: test-integration
run: npm run test-integration
publish:
needs: [eslint, test, integration]
name: Publishing master using Node 12
runs-on: ubuntu-latest
# run job only for tags and skip for cron
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule'
steps:
- name: Get the release version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: npm ci
run: |
npm ci
npm run build --if-present
- name: Publish beta ${{ steps.get_version.outputs.VERSION }}
# if tag includes beta keyword
if: contains(steps.get_version.outputs.VERSION, 'beta') == true
run: npm publish --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish latest ${{ steps.get_version.outputs.VERSION }}
# if tag doesn't include beta keyword
if: contains(steps.get_version.outputs.VERSION, 'beta') == false
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}