194 lines (161 loc) · 6.28 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# GitHub actions for Autobahn|Python CI/CD
# https://github.com/crossbario/autobahn-python/actions
#
# See also:
#
# * https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# * https://github.com/actions/starter-workflows/blob/main/ci/python-package.yml
#
name: main
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install OS package dependencies
run: |
sudo apt update
sudo apt install libenchant-dev libbz2-dev libsnappy-dev libunwind-dev
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- name: Install Python package dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Run Flake8
run: tox -c tox.ini -e flake8
# since we use --parallel-mode to coverage inside Tox we use
# "coverage combine" so the filename is always ".coverage"
- name: Run Coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
tox -c tox.ini -e coverage
test:
env:
CB_FULLTESTS: 1
# Test on Ubuntu, MacOS, Windows using CPython 3.6-3.9, PyPy 3.6-3.7
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
# os: [ubuntu-20.04, macos-latest, windows-latest]
# https://github.com/actions/setup-python#specifying-a-pypy-version
# python-version: ['3.6', '3.7', '3.8', '3.9', 'pypy-3.6', 'pypy-3.7']
# framework: ['asyncio', 'tw189', 'tw1910', 'tw203', 'twtrunk']
python-version: ['3.6', '3.9', 'pypy-3.7']
framework: ['asyncio', 'tw203', 'twtrunk']
# https://github.blog/changelog/2020-04-15-github-actions-new-workflow-features/
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error
continue-on-error: false
steps:
# Checkout sources
- uses: actions/checkout@v2
# Install OS packages, as we install Python packages from source:
#
# libenchant-dev needed for pyenchant, needed for sphinx-spellcheck
# libbz2-dev, libsnappy-dev needed for compression
# libunwind-dev needed for vmprof
#
- name: Install OS package dependencies
run: |
sudo apt update
sudo apt install build-essential libssl-dev libffi-dev libunwind-dev \
libreadline-dev zlib1g-dev libbz2-dev libsqlite3-dev libncurses5-dev \
libsnappy-dev
# Use this Python
# https://github.com/actions/setup-python/blob/main/README.md
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python package dependencies
run: |
python -m pip install -U pip
pip install -U -r requirements-dev.txt
- name: Install this package
run: |
make abi_files
pip install .[all]
- name: Run unit tests (PyTest)
run: |
python -c "import autobahn; print(autobahn.__version__)"
python -c "from autobahn import xbr; print(xbr.HAS_XBR)"
python -c "from autobahn.testutil import FakeTransport; print(FakeTransport)"
tox -c tox.ini -e ${{ matrix.framework }}
docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install OS package dependencies
run: |
sudo apt update
sudo apt install libenchant-dev libbz2-dev libsnappy-dev libunwind-dev
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- name: Install Python package dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Install this package
run: |
make abi_files
pip install .[all]
- name: Run Sphinx
run: tox -c tox.ini -e sphinx
deploy:
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
# https://github.blog/changelog/2020-12-15-github-actions-environments-environment-protection-rules-and-environment-secrets-beta/
# https://docs.github.com/en/free-pro-team@latest/actions/reference/environments
environment: deploy_aws
env:
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
WAMP_PRIVATE_KEY: ${{ secrets.WAMP_PRIVATE_KEY }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
- name: Set environment
run: |
echo BUILD_DATE=`date -u +"%Y-%m-%d"` >> $GITHUB_ENV
echo AUTOBAHN_VCS_REF=`git rev-parse --short ${GITHUB_SHA}` >> $GITHUB_ENV
echo AUTOBAHN_BUILD_ID=$(date --utc +%Y%m%d)-$(git rev-parse --short ${GITHUB_SHA}) >> $GITHUB_ENV
echo AUTOBAHN_VERSION=$(grep -E '^(__version__)' ./zlmdb/_version.py | cut -d ' ' -f3 | sed -e 's|[u"'\'']||g') >> $GITHUB_ENV
# - name: Set environment - 2
# run: |
# echo AUTOBAHN_VCS_REF=`git --git-dir="./.git" rev-list -n 1 v${AUTOBAHN_VERSION} --abbrev-commit` >> $GITHUB_ENV
- name: Install OS package dependencies
run: |
sudo apt update
sudo apt install build-essential libssl-dev libffi-dev libunwind-dev \
libreadline-dev zlib1g-dev libbz2-dev libsqlite3-dev libncurses5-dev \
libsnappy-dev
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: 'x64'
- name: Install Python package dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Deploy (build, package and upload)
run: |
./deploy.sh