-
Notifications
You must be signed in to change notification settings - Fork 4.5k
184 lines (153 loc) · 5.37 KB
/
continous-integration.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
181
182
183
184
name: Continuous Integration
on: [push]
# SECRETS
# - COVERALLS_REPO_TOKEN: can be found on the coveralls page for the repo
# - GH_RELEASE_NOTES_TOKEN: personal access token of `rasabot` github account
# (login for account in 1pw)
# - SLACK_WEBHOOK_TOKEN: token to post to RasaHQ slack account (in 1password)
# - PYPI_TOKEN: publishing token for amn41 account, needs to be maintainer of
# RasaHQ/rasa on pypi (account credentials in 1password)
env:
# needed to fix issues with boto during testing:
# https://github.com/travis-ci/travis-ci/issues/7940
BOTO_CONFIG: /dev/null
PIP_USE_PEP517: false
jobs:
api:
name: Test API specification
runs-on: ubuntu-latest
steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v2
- name: Setup Node 🦝
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Run Swagger 🕵️♀️
run: |
npm install -g swagger-cli
swagger-cli validate docs/_static/spec/action-server.yml
swagger-cli validate docs/_static/spec/rasa.yml
quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v2
- name: Set up Python 3.7 🐍
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Load Pip Cached Artifacts ⬇
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-3.7-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-3.7-pip-
- name: Install Dependencies 📦
run: |
sudo apt-get -y install libpq-dev
python -m pip install -U 'pip<20'
pip install -r requirements-dev.txt
pip install -e .
- name: Lint Code 🎎
run: |
make lint
- name: Check Types 📚
run: |
make types
- name: Test CLI 🖥
# makes sure we catch any dependency error early. they will create strange
# errors during the docs build, so easier to catch them early on by
# trying to run the `rasa` command once before the docs build.
run: |
rasa --help
# DOES NOT WORK YET DUE TO TENSORFLOW 1.5 (some issue with no tensorflow-cpu verison)
# -> should work with 2.0 and replace the below "Test Docs":
#
# - name: Test Docs
# uses: ammaraskar/sphinx-action@0.3
# with:
# docs-folder: "docs/"
# repo-token: "${{ secrets.GITHUB_TOKEN }}"
# build-command: "make SPHINXOPTS=\"-W --keep-going -A html_theme=rasabaster\" html"
# pre-build-command: "apt-get update -y && apt-get install -y git"
- name: Test Docs 📃
run: |
pip install -r requirements-docs.txt
pip install -e .[sql]
cd docs && make SPHINXOPTS="-W --keep-going -A html_theme=rasabaster" html
test:
name: Run Tests
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
python-version: [3.6, 3.7]
steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }} 🐍
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Load Pip Cached Artifacts ⬇
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-
- name: Install Dependencies 📦
run: |
sudo apt-get update -qq
python -m pip install -U 'pip<20'
pip install -r requirements-dev.txt
pip install -e .
make prepare-tests-ubuntu
pip list
- name: Test Code 🔍
run: |
make test
- name: Send Coverage Report 📊
if: matrix.python-version == 3.6
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_SERVICE_NAME: github-ci
run: |
coveralls
deploy:
name: Deploy to PyPI
runs-on: ubuntu-latest
# deploy will only be run when there is a tag available
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: [quality, test, api] # only run after all other stages succeeded
steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v2
- name: Set up Python 3.6 🐍
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Build ⚒️ Distributions
run: |
python3 -m pip install --user --upgrade setuptools wheel
python setup.py sdist bdist_wheel
- name: Publish to PyPI 📦
uses: pypa/gh-action-pypi-publish@37e305e7413032d8422456179fee28fac7d25187
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
- name: Notify Slack & Publish Release Notes 🗞
env:
GH_RELEASE_NOTES_TOKEN: ${{ secrets.GH_RELEASE_NOTES_TOKEN }}
SLACK_WEBHOOK_TOKEN: ${{ secrets.SLACK_WEBHOOK_TOKEN }}
GITHUB_TAG: ${{ github.ref }}
GITHUB_REPO_SLUG: ${{ github.repository }}
run: |
sudo apt-get update
sudo apt-get -y install pandoc
pip install -U github3.py pypandoc
python3 scripts/publish_gh_release_notes.py
./scripts/ping_slack_about_package_release.sh