-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (153 loc) Β· 4.73 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
---
# 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:
- 'src/pysmsboxnet/*.py'
- 'docs/**'
- 'pyproject.toml'
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: π₯ Checkout the repository
uses: actions/[email protected]
- name: π Set up UV and Python 3
uses: astral-sh/[email protected]
id: python
with:
enable-cache: true
cache-suffix: lint
- name: π¦ Install dependencies
run: uv sync --frozen --group lint
- 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: uv run pre-commit run --show-diff-on-failure --all-files
test:
name: Test with Python ${{ matrix.python-version }} on ${{ matrix.os }}
needs: lint
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
python-version: ["3.10", 3.11, 3.12]
os: [ubuntu, windows, macos]
steps:
- name: π₯ Checkout the repository
uses: actions/[email protected]
- name: π οΈ Set up UV and Python ${{ matrix.python-version }}
uses: astral-sh/[email protected]
with:
enable-cache: true
cache-suffix: test-${{ matrix.python-version }}-${{ matrix.os }}
- name: install Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: π¦ Install dependencies
run: uv sync --frozen --group test
- name: π Run tests
run: uv run pytest tests
- name: Run code coverage
if: ${{ matrix.python-version == '3.10' }}
run: uv run pytest --cov=./src --cov-report=xml tests
- name: upload to codecov
if: ${{ matrix.python-version == '3.10' }}
uses: codecov/[email protected]
test_install:
name: "Test install with Python ${{matrix.python-version}} ${{matrix.os}}"
needs: test
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
python-version: ["3.10", 3.11, 3.12]
os: [ubuntu, windows, macos]
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 }}
check-latest: true
- name: Install using pip
run: pip3 install .
- name: Try example in temporary directory
env:
SMSBOX_API_KEY: ${{ secrets.SMSBOX_API_KEY }}
RUNNER_TEMP: ${{ runner.temp }}
run: |
python3 script/copy_example.py
cd ${{ runner.temp }}/test_example
python3 ${{ runner.temp }}/test_example/example.py
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 and UV
uses: astral-sh/[email protected]
id: python
- name: Run build
run: uv 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: astral-sh/[email protected]
id: python
- name: π¦ Install dependencies
run: uv sync --frozen --group doc
- name: Build documentation using sphinx
run: uv run make -C docs html
- name: deploy documentation
uses: JamesIves/[email protected]
with:
folder: docs/_build/html
target-folder: dev
alls_green:
name: Check if all checks are green
if: always()
needs:
- lint
- test
- test_install
- test_build
runs-on: ubuntu-latest
steps:
- name: Decide if checks succeeded or not
uses: re-actors/[email protected]
with:
allowed-skips: changes
jobs: ${{ toJSON(needs) }}