-
-
Notifications
You must be signed in to change notification settings - Fork 92
228 lines (210 loc) · 8.21 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
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
name: CI
on:
push:
branches:
- dev
pull_request:
env:
UV_CACHE_DIR: /tmp/.uv-cache
jobs:
code-quality:
runs-on: "ubuntu-latest"
name: Check code quality
steps:
- name: ⤵️ Checkout repository
uses: actions/checkout@v4
- name: 🏗 Install uv and Python
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
cache-local-path: ${{ env.UV_CACHE_DIR }}
- name: 🏗 Install the project
run: uv sync --locked --dev
# Following steps cannot run by pre-commit.ci as repo = local
- name: Run mypy
run: uv run --frozen mypy deebot_client/
- name: Pylint review
run: uv run --frozen pylint deebot_client/**/*.py
- name: Verify no getLogger usages
run: scripts/check_getLogger.sh
armv7_job:
# The host should always be Linux
runs-on: ubuntu-22.04
name: Build on ubuntu-22.04 armv7
steps:
- uses: actions/checkout@v4
- uses: uraimo/run-on-arch-action@v2
name: Run commands
id: runcmd
with:
arch: armv7
distro: alpine_latest
# Not required, but speeds up builds by storing container images in
# a GitHub package registry.
# githubToken: ${{ github.token }}
# Install some dependencies in the container. This speeds up builds if
# you are also using githubToken. Any dependencies installed here will
# be part of the container image that gets cached, so subsequent
# builds don't have to re-install them. The image layer is cached
# publicly in your project's package repository, so it is vital that
# no secrets are present in the container state or logs.
install: |
apk add --no-cache xz-dev
curl -LsSf https://astral.sh/uv/install.sh | sh
# Set an output parameter `uname` for use in subsequent steps
run: |
uv sync --locked --dev
uv build --wheel
rm -rf deebot_client*
uv pip install --force-reinstall dist/*
pytest tests --cov=./ --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
test:
runs-on: "ubuntu-latest"
steps:
- name: ⤵️ Checkout repository
uses: actions/checkout@v4
- name: Build for Alpine targets
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/astral-sh/uv:alpine
run: |
apk add --no-cache xz-dev
uv venv -p 3.13
ls -al
uv build --wheel
rm -rf deebot_client*
uv sync --locked --only-dev
uv pip install --force-reinstall dist/*
pytest tests --cov=./ --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
# wheels:
# name: Py${{ matrix.python-version }} on ${{ matrix.config.platform }} with ${{ matrix.config.manylinux }}
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# config:
# # - platform: "x86_64"
# # manylinux: "musllinux_1_2"
# # before-script: "sudo apt update && sudo apt install -y pkg-config liblzma-dev"
# - platform: "x86_64"
# manylinux: "manylinux_2_28"
# before-script: "yum install -y xz-devel"
# - platform: "armv7"
# manylinux: "manylinux_2_28"
# before-script: "sudo apt update && sudo apt install -y pkg-config liblzma-dev"
# - platform: "aarch64"
# manylinux: "manylinux_2_28"
# before-script: "sudo apt update && sudo apt install -y pkg-config liblzma-dev"
# python-version:
# - "3.12"
# - "3.13"
# steps:
# - name: ⤵️ Check out code from GitHub
# uses: actions/[email protected]
# - name: 🏗 Set up uv and Python ${{ matrix.python-version }}
# uses: astral-sh/setup-uv@v5
# with:
# enable-cache: true
# python-version: ${{ matrix.python-version }}
# - name: 🏗 Set package version
# if: ${{ github.event_name == 'release' }}
# run: |
# sed -i "s/^version = \".*\"/version = \"${{ github.event.release.tag_name }}\"/" pyproject.toml
# - name: 🏗 Prepare for build
# run: |
# uv sync --locked --only-dev
# python3 -m ensurepip
# - name: Cache Docker images.
# uses: ScribeMD/[email protected]
# with:
# key: docker-${{ runner.os }}-${{ matrix.config.platform }}-${{ matrix.config.manylinux }}
# - name: 📦 Build wheel
# uses: PyO3/maturin-action@v1
# id: build
# with:
# target: ${{ matrix.config.platform }}
# args: --release --out dist -i ${{ matrix.python-version}}
# manylinux: ${{ matrix.config.manylinux }}
# before-script-linux: ${{ matrix.config.before-script }}
# - name: ⬆️ Upload wheel
# uses: actions/upload-artifact@v4
# with:
# name: wheels-${{ matrix.python-version }}-${{ matrix.config.manylinux }}-${{ matrix.config.platform }}
# path: dist
# - name: Remove sources to avoid conflicts during tests
# run: |
# rm -rf deebot_client*
# - name: pytest
# if: ${{ startsWith(matrix.config.manylinux, 'manylinux') && matrix.config.platform == 'x86_64' }}
# shell: bash
# run: |
# set -e
# uv pip install --force-reinstall dist/*
# pytest tests --cov=./ --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
# - name: pytest
# if: ${{ startsWith(matrix.config.manylinux, 'manylinux') && matrix.config.platform != 'x86_64' }}
# uses: uraimo/run-on-arch-action@v2
# with:
# arch: ${{ matrix.config.platform }}
# distro: ubuntu_latest
# githubToken: ${{ github.token }}
# install: |
# curl -LsSf https://astral.sh/uv/install.sh | sh
# uv sync --locked --only-dev
# run: |
# set -e
# uv pip install --force-reinstall dist/*
# pytest tests --cov=./ --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
# - name: pytest
# if: ${{ startsWith(matrix.config.manylinux, 'musllinux') && matrix.config.platform == 'x86_64' }}
# uses: addnab/docker-run-action@v3
# with:
# image: alpine:latest
# options: -v ${{ github.workspace }}:/io -w /io
# run: |
# set -e
# curl -LsSf https://astral.sh/uv/install.sh | sh
# uv sync --locked --only-dev
# uv pip install --force-reinstall dist/*
# pytest tests --cov=./ --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
# - name: pytest
# if: ${{ startsWith(matrix.config.manylinux, 'musllinux') && matrix.config.platform != 'x86_64' }}
# uses: uraimo/run-on-arch-action@v2
# with:
# arch: ${{ matrix.config.platform }}
# distro: alpine_latest
# githubToken: ${{ github.token }}
# install: |
# curl -LsSf https://astral.sh/uv/install.sh | sh
# uv sync --locked --only-dev
# run: |
# set -e
# uv pip install --force-reinstall dist/*
# pytest tests --cov=./ --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v5
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true
# - name: Upload test results to Codecov
# if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
# uses: codecov/test-results-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true
sdist:
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist