180 lines (171 loc) · 5.31 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
168
169
170
171
172
173
174
175
176
177
178
179
180
name: CI
on:
push:
release:
types: [published]
jobs:
build-test:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Find ignored tests
run: ./find-ignored-tests.sh
- name: Run unit tests (lib)
run: npm run test-lib
env:
TZ: Europe/Zurich
- name: Build lib in dev mode
run: npm run build-lib-dev
- name: Build lib in prod mode
run: npm run build-lib
- name: Build app
run: npm run build-app
- name: Run unit tests (app)
run: npm run test
env:
TZ: Europe/Zurich
CI: true
e2e-test:
name: E2E Tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- name: Checkout private ci-assets
uses: actions/checkout@v2
with:
repository: dasch-swiss/dsp-ci-assets
token: ${{ secrets.GH_TOKEN }}
path: ci
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Build lib in prod mode
run: npm run build-lib
- name: Run knora stack
run: make knora-stack
- name: Run e2e tests
run:
npm run webdriver-update
npm run e2e
env:
TZ: Europe/Zurich
CI: true
docker-build:
name: Docker build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: docker build .
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 }}
path: projects/dsp-ui
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 }]'
publish:
name: Publish to npm (on release only)
needs: [build-test, e2e-test]
runs-on: ubuntu-latest
env:
dist-directory: ./dist/@dasch-swiss/dsp-ui/
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm install
- name: Build lib in prod mode
run: npm run build-lib
- if: "github.event.release.prerelease"
name: Publish pre-release to npm
run: npm publish ${{env.dist-directory}} --tag rc --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN_DASCHBOT}}
- if: "!github.event.release.prerelease"
name: Publish release to npm
run: npm publish ${{env.dist-directory}} --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN_DASCHBOT}}
notification:
name: Google chat notification about release and published version
needs: [publish]
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 }}
# build documentation
docs-build-test:
name: Docs Build Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Disk Free
run: |
df -h
docker system df
docker system prune --all --force --volumes
df -h
- name: run docs build
run: make docs-build
- name: Disk Free After
run: |
df -h
docker system df
# deploy documentation only on release
deploy-docs:
name: Deploy docs (on release only)
needs: [
docs-build-test
]
runs-on: ubuntu-latest
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
steps:
- name: Checkout main
uses: actions/checkout@v2
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@1.16
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
REQUIREMENTS: docs/requirements.txt
- name: Disk Free After
run: |
df -h
docker system df