-
Notifications
You must be signed in to change notification settings - Fork 3
167 lines (158 loc) · 5.58 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
159
160
161
162
163
164
165
166
167
name: CI
env:
NodeVersion: 16.15.0
DistDirectory: ./build/
CacheName: dsp-js-lib
on:
push:
release:
types: [published]
jobs:
find-ignored-tests:
name: Find ignored tests
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Run the script
run: ./find-ignored-tests.sh
unit-tests:
name: Run unit tests
needs: [find-ignored-tests]
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Cache node_modules artifacts
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.CacheName }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Set up Node.js ${{ env.NodeVersion }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NodeVersion }}
- name: Install requirements
run: |
sudo apt-get install expect
sudo npm install --global @bazel/bazelisk
- name: Install dependencies
run: make npm-install
- name: Prepare test data
run: make prepare-test-data
- name: Run unit tests
run: make unit-tests
e2e-tests:
name: Run e2e tests incl. build lib
needs: [find-ignored-tests]
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Cache node_modules artifacts
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.CacheName }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Set up Node.js ${{ env.NodeVersion }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NodeVersion }}
- name: Install requirements
run: |
sudo apt-get install expect
sudo npm install --global @bazel/bazelisk
- name: Install dependencies
run: make npm-install
# - name: Get api client test data from knora-api (makefile variant)
# run: make get-test-data-from-release
# - name: Prepare test data
# run: make prepare-test-data
- name: Build lib
run: make build
- name: Prepare test environment
run: make prepare-test-ci
- name: Run e2e tests
run: make e2e-tests
release-please:
name: Prepare next release
runs-on: ubuntu-latest
# Automate releases with Conventional Commit Messages as Pull Requests are merged into "main" branch
if: github.ref == 'refs/heads/main'
steps:
- uses: GoogleCloudPlatform/release-please-action@v2
with:
token: ${{ secrets.GH_TOKEN }}
release-type: node
changelog-types: '[{"type": "feat", "section": "Enhancements", "hidden": false }, {"type": "fix", "section": "Bug Fixes", "hidden": false }, {"type": "chore", "section": "Maintenance", "hidden": false }, {"type": "refactor", "section": "Maintenance", "hidden": false }, {"type": "docs", "section": "Documentation", "hidden": false }]'
build:
name: Build package and publish (on release only)
needs: [
unit-tests,
e2e-tests
]
runs-on: ubuntu-latest
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up Node.js ${{ env.NodeVersion }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NodeVersion }}
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: |
sudo npm install --global @bazel/bazelisk
npm install
npm run peer-deps
- name: Prepare dev publication
run: npm run prepare-dev-publication
- name: Build
run: npm run build
- if: "github.event.release.prerelease"
name: Publish pre-release to GitHub packages
run: npm publish ${{env.DistDirectory}} --registry=https://npm.pkg.github.com/ --_authToken=${{secrets.GITHUB_TOKEN}} --tag rc --access public
- if: "!github.event.release.prerelease"
name: Publish release to GitHub packages
run: npm publish ${{env.DistDirectory}} --registry=https://npm.pkg.github.com/ --_authToken=${{secrets.GITHUB_TOKEN}} --access public
notification:
name: Google chat notification about release and published version
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
steps:
- name: Send notification to google chat room "DSP releases"
uses: lakto/google-chat-action@main
with:
url: ${{ secrets.GOOGLE_CHAT_DSP_RELEASES_WEBHOOK_URL }}
publish-docs:
name: Build and publish API docs
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'release' && !github.event.release.prerelease && startsWith(github.ref, 'refs/tags')
steps:
- name: Check out
uses: actions/checkout@v1
- name: Install dependencies
run: |
npm install
npm run peer-deps
- name: Build API docs
run: |
npm run typedoc-config
npm run build-docs
- name: Publish generated content to GitHub Pages
uses: tsunematsu21/actions-publish-gh-pages@v1.0.1
with:
dir: docs
branch: gh-pages
token: ${{ secrets.GH_TOKEN }}