-
Notifications
You must be signed in to change notification settings - Fork 159
103 lines (98 loc) · 3.24 KB
/
ci.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
name: MQTT IO CI
on:
- push
- pull_request
- release
jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install poetry
poetry install
- name: Lint with pylint
run: poetry run pylint -d fixme mqtt_io
- name: Lint with mypy
run: poetry run mypy --show-error-codes --strict --no-warn-unused-ignores mqtt_io
- name: Test with behave
run: poetry run behave -t ~skip mqtt_io/tests/features
publish:
name: Publish to PyPI
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-20.04
needs: test
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install poetry
run: pip install poetry
- name: Build packages
run: poetry build
- name: Publish packages
uses: pypa/gh-action-pypi-publish@master
# if: startsWith(github.ref, 'refs/tags')
with:
password: ${{ secrets.PYPI_API_TOKEN }}
build_docker_image:
name: Build Docker Image
if: (github.event_name == 'release' && github.event.action == 'created') || github.event_name == 'push'
runs-on: ubuntu-20.04
needs: test
steps:
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- id: buildx
uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- if: github.event_name == 'release' && github.event.action == 'created'
run: |
# Remove prefix release
TAG_NAME=${GITHUB_REF##*/}
# Change slashes to hyphens
TAG_NAME=${TAG_NAME//\//-}
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t flyte/mqtt-io:${TAG_NAME} -t flyte/mqtt-io:latest --push .
- if: github.event_name == 'push'
run: |
# Remove prefix push
TAG_NAME=${GITHUB_REF##*/}
# Change slashes to hyphens
TAG_NAME=${TAG_NAME//\//-}
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t flyte/mqtt-io:${TAG_NAME} --push .
generate_docs:
name: Generate Documentation
if: github.event_name == 'push'
concurrency: generate_docs
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- id: branch-name
uses: tj-actions/branch-names@v7.0.7
- name: Ensure we can checkout gh-pages
run: |
git checkout gh-pages
git checkout ${{ steps.branch-name.outputs.current_branch }}
- name: Setup Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies and generate docs
run: |
pip install poetry
poetry install
poetry run python docs_src/generate_docs.py