-
Notifications
You must be signed in to change notification settings - Fork 0
200 lines (174 loc) Β· 5.23 KB
/
actions.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
195
196
197
198
199
200
---
# Taken from pyhaversion
name: Actions
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
changes:
runs-on: ubuntu-latest
outputs:
docfiles: ${{ steps.filter.outputs.docfiles }}
steps:
- uses: actions/[email protected]
- uses: dorny/[email protected]
id: filter
with:
filters: |
docfiles:
- 'pysmsboxnet/*.py'
- 'docs/**'
- 'requirements_doc.txt'
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: π₯ Checkout the repository
uses: actions/[email protected]
- name: π Set up Python 3
uses: actions/[email protected]
id: python
with:
python-version: 3.11
cache: pip
cache-dependency-path: |
**/requirements*.txt
pyproject.toml
check-latest: true
- name: π¦ Install dependencies in virtual env
run: |
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements_lint.txt
pip install -e .
- name: π€ Lint with Black
run: venv/bin/black pysmsboxnet tests --check
- name: π€ Lint with Flake8
run: venv/bin/flake8 pysmsboxnet tests
- name: Pre-commit cache
uses: actions/[email protected]
with:
path: ~/.cache/pre-commit
key: "${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}"
restore-keys: |
${{ runner.os }}-pre-commit-
- name: "Run pre-commits"
run: venv/bin/pre-commit run --all-files
test:
name: Test with Python ${{ matrix.python-version }}
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", 3.11]
steps:
- name: π₯ Checkout the repository
uses: actions/[email protected]
- name: π οΈ Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
**/requirements*.txt
pyproject.toml
check-latest: true
- name: π¦ Install dependencies
run: pip3 install -r requirements_test.txt
- name: π Run tests
run: pytest tests
- name: Run code coverage
if: ${{ matrix.python-version == '3.10' }}
run: pytest --cov=./pysmsboxnet --cov-report=xml tests
- name: upload to codecov
if: ${{ matrix.python-version == '3.10' }}
uses: codecov/[email protected]
test_install:
name: Test installing with Python ${{ matrix.python-version }}
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", 3.11]
steps:
- name: π₯ Checkout the repository
uses: actions/[email protected]
- name: π οΈ Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
**/requirements*.txt
pyproject.toml
check-latest: true
- name: Install using pip
run: pip3 install .
- name: Try example in /tmp
env:
SMSBOX_API_KEY: ${{ secrets.SMSBOX_API_KEY }}
run: |
mkdir -p /tmp/test_example
cp example.py /tmp/test_example
cd /tmp/test_example
python3 /tmp/test_example/example.py
cd -
rm -rf /tmp/test_example
test_build:
name: Test building with Python 3
needs: test_install
runs-on: ubuntu-latest
steps:
- name: π₯ Checkout the repository
uses: actions/[email protected]
- name: π οΈ Set up Python 3
uses: actions/[email protected]
with:
python-version: 3.x
cache: pip
cache-dependency-path: |
**/requirements*.txt
pyproject.toml
check-latest: true
- name: Install build
run: pip3 install build
- name: Run build
run: python3 -m build
deploy_doc:
if: github.event_name == 'push' && needs.changes.outputs.docfiles == 'true'
needs: [test_build, changes]
permissions:
contents: write
runs-on: ubuntu-latest
name: Build and deploydocumentation from main
steps:
- name: π₯ Checkout the repository
uses: actions/[email protected]
with:
fetch-depth: 0
- name: π Set up Python3
uses: actions/[email protected]
id: python
with:
python-version: "3.11"
cache: pip
cache-dependency-path: |
**/requirements*.txt
pyproject.toml
check-latest: true
- name: π¦ Install dependencies
run: |
pip3 install --upgrade pip
pip3 install -r requirements_doc.txt
pip3 install -e .
- name: Build documentation using sphinx
run: make -C docs html
- name: deploy documentation
uses: JamesIves/[email protected]
with:
folder: docs/_build/html
target-folder: dev