-
Notifications
You must be signed in to change notification settings - Fork 4
131 lines (110 loc) · 3.79 KB
/
check-publish.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
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Check and publish
on:
workflow_dispatch: {}
pull_request:
branches: [master]
release:
types: [created]
jobs:
quality:
name: Code QA
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: pip install black flake8 isort
- run: black --version
- run: isort --check .
- run: black --check .
- run: flake8 .
checks:
strategy:
fail-fast: false
matrix:
platform: ["ubuntu-20.04", "macos-13"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
name: Python ${{ matrix.python-version }} on ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
needs: quality
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install etcd for linux
run: |
ETCD_VER=v3.4.14
DOWNLOAD_URL=https://github.com/etcd-io/etcd/releases/download
curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
mkdir /tmp/etcd-download-test
tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1
/tmp/etcd-download-test/etcd &
if: runner.os == 'Linux'
- name: Install etcd for macos
run: |
ETCD_VER=v3.4.14
DOWNLOAD_URL=https://github.com/etcd-io/etcd/releases/download
curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-darwin-amd64.zip -o /tmp/etcd-${ETCD_VER}-darwin-amd64.zip
mkdir /tmp/etcd-download-test
unzip /tmp/etcd-${ETCD_VER}-darwin-amd64.zip -d /tmp
mv /tmp/etcd-${ETCD_VER}-darwin-amd64/* /tmp/etcd-download-test
/tmp/etcd-download-test/etcd &
if: runner.os == 'macOS'
- name: Install packages
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install -e .
pip install -e aviso-server/monitoring
pip install -e aviso-server/rest
pip install -e aviso-server/auth
pip install -e aviso-server/admin
pip install -U -r tests/requirements-dev.txt
pip install -r docs/requirements.txt
- name: Tests on Ubuntu
if: matrix.platform == 'ubuntu-20.04'
run: |
pip freeze
pytest
env:
AVISO_DEBUG: True
- name: Tests on macOS
if: matrix.platform == 'macos-13'
run: |
pip freeze
pytest -v --cov=pyaviso --cache-clear
env:
AVISO_DEBUG: True
- name: Documentation
run: |
make clean
make html
working-directory: docs
deploy:
if: ${{ github.event_name == 'release' }}
name: Upload to Pypi
needs: checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Check version
run: |
release=${GITHUB_REF##*/}
version=$(python setup.py --version)
test "$release" == "$version"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/* --verbose