-
Notifications
You must be signed in to change notification settings - Fork 1
148 lines (142 loc) · 4.4 KB
/
ci.yml
File metadata and controls
148 lines (142 loc) · 4.4 KB
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
name: CI
on:
push:
branches:
- master
tags:
- v*
pull_request:
env:
IS_TAG: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')}}
MASTER_PYTHON: "3.8"
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ env.MASTER_PYTHON }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.MASTER_PYTHON }}
- name: Install Poetry Itself
run: pip install poetry
- name: Poetry Install
run: poetry install
- name: Flake8
run: poetry run flake8
- name: Mypy
run: poetry run mypy .
- name: Black
run: poetry run black --check .
- name: Isort
run: poetry run isort --check-only .
- name: Shellcheck
run: shellcheck scripts/*.sh
test:
strategy:
matrix:
python: ["3.6", "3.7", "3.8"]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install Poetry Itself
run: pip install poetry
- name: Poetry Install
run: poetry install
- name: Pytest
run: poetry run pytest
- name: ASV
run: |
poetry run asv machine --machine travis --os unknown --arch unknown --cpu unknown --ram unknown
poetry run asv run --show-stderr --environment existing --quick
- name: Codecov
uses: codecov/codecov-action@v1.2.1
with:
# NOTE: `token` is not required, because the rle-array repo is public
file: ./coverage.xml
name: pytest-${{ runner.OS }}-${{ matrix.python }}
docs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ env.MASTER_PYTHON }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.MASTER_PYTHON }}
- name: Install Poetry Itself
run: pip install poetry
- name: Poetry Install
run: poetry install
- name: Sphinx
run: |
poetry run python setup.py build_sphinx
touch ./docs/_build/html/.nojekyll
- name: Preserve Docs
uses: actions/upload-artifact@v2.2.2
with:
name: docs
path: docs/_build/html
- name: Deploy Docs
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
release:
runs-on: ubuntu-latest
needs: [lint, test, docs]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ env.MASTER_PYTHON }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.MASTER_PYTHON }}
- name: Install Poetry Itself
run: pip install poetry
- name: Poetry Install
run: poetry install
- name: Build
run: poetry build
- name: Prepare Release Notes
run: awk 'BEGIN{found=0} {if (match($0, "==============")) {if (found == 1) exit; found=1}; if (found == 1) {print last}; last=$0}' CHANGES.rst > release_notes.rst
- name: Create Release Notes
uses: docker://pandoc/core:2.9
with:
args: --from=rst --to=markdown -o release_notes.md release_notes.rst
- name: Preserve Dist
uses: actions/upload-artifact@v2.2.2
with:
name: dist
path: dist
- name: Preserve Release Notes
uses: actions/upload-artifact@v2.2.2
with:
name: release_notes.md
path: release_notes.md
- name: Publish to PyPI
if: env.IS_TAG == 'true'
run: poetry publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
- name: Create GitHub Release
if: env.IS_TAG == 'true'
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: rle-array ${{ github.ref }}
body_path: release_notes.md
draft: false
prerelease: false