forked from fusepy/fusepy
-
Notifications
You must be signed in to change notification settings - Fork 7
366 lines (309 loc) · 13.1 KB
/
tests.yml
File metadata and controls
366 lines (309 loc) · 13.1 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
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
name: Tests
on:
push:
branches: '**'
tags-ignore: '**'
pull_request:
jobs:
Static-Code-Checks:
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Dependencies
run: |
python3 -m pip install ioctl-opt paramiko types-paramiko pytest
- name: Style Check With Ruff
run: |
python3 -m pip install ruff
ruff check --config tests/.ruff.toml -- $( git ls-tree -r --name-only HEAD | 'grep' -E '[.]py$' )
- name: Style Check With Black
run: |
python3 -m pip install black
black -q --diff --line-length 120 --skip-string-normalization $( git ls-tree -r --name-only HEAD | 'grep' -E '[.]py$' ) > black.diff
if [ -s black.diff ]; then
cat black.diff
exit 123
fi
- name: Lint With Codespell
run: |
python3 -m pip install codespell
codespell $( git ls-tree -r --name-only HEAD | 'grep' -E '[.](py|md|txt|sh|yml)$' )
- name: Lint With Flake8
run: |
python3 -m pip install flake8
flake8 --config tests/.flake8 $( git ls-tree -r --name-only HEAD | 'grep' -E '[.]py$' )
- name: Lint With Pylint
run: |
python3 -m pip install pylint
pylint --rcfile tests/.pylintrc $( git ls-tree -r --name-only HEAD | 'grep' -E '[.]py$' ) | tee pylint.log
! 'egrep' ': E[0-9]{4}: ' pylint.log
- name: Lint With Pytype
run: |
python3 -m pip install pytype
pytype -d import-error $( git ls-tree -r --name-only HEAD | 'grep' -E '[.]py$' )
- name: Lint With Mypy
run: |
yes | python3 -m pip install --upgrade-strategy eager --upgrade types-dataclasses mypy
mypy --config-file tests/.mypy.ini $( git ls-tree -r --name-only HEAD | 'grep' -E '[.]py$' )
Tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# https://endoflife.date/python
include:
- os: ubuntu-22.04
python-version: '3.9'
- os: ubuntu-22.04-arm
python-version: '3.10'
- os: ubuntu-22.04
python-version: '3.11'
- os: ubuntu-24.04-arm
python-version: '3.12'
- os: ubuntu-24.04
python-version: '3.13'
- os: ubuntu-24.04
python-version: '3.14'
- os: macos-15
python-version: '3.9'
- os: macos-14
python-version: '3.10'
- os: macos-15-intel
python-version: '3.11'
- os: macos-14
python-version: '3.12'
- os: macos-15-intel
python-version: '3.13'
- os: macos-15
python-version: '3.14'
env:
MFUSEPY_CHECK_OVERRIDES: 1
defaults:
run:
# This is especially important for windows because it seems to default to powershell
shell: bash
steps:
- uses: actions/checkout@v4
with:
# We need one tag for testing the git mount.
# This is BROKEN! God damn it. Is anything working at all...
# https://github.com/actions/checkout/issues/1781
fetch-tags: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies (Linux)
if: startsWith( matrix.os, 'ubuntu' )
run: |
sudo apt-get -y install libfuse2 libfuse-dev libfuse3-dev fuse3 wget
- name: Install Dependencies (MacOS)
if: startsWith( matrix.os, 'macos' )
run: |
brew install -q macfuse
- name: Install pip Dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
# https://github.com/pyca/pynacl/issues/839
# https://github.com/pyca/pynacl/pull/848
python3 -m pip install --upgrade git+https://github.com/pyca/pynacl.git
python3 -m pip install --upgrade-strategy eager --upgrade twine build pytest pytest-order ioctl-opt paramiko types-paramiko
- name: Test Installation From Tarball
run: |
python3 -m build
twine check dist/*
python3 -m pip install "$( find dist -name '*.tar.gz' | head -1 )"[full]
- name: Test Installation From Source
run: |
python3 -m pip install .
- name: Test Import
run: |
python3 -c 'import mfusepy'
- name: Examples
run: |
# Simply parsing the source runs the @overrides check!
for file in examples/*.py; do
python3 "$file" -h
done
- name: Only test struct layout (MacOS)
if: startsWith( matrix.os, 'macos' )
run: |
python3 -m pytest -s -v -rs tests/test_struct_layout.py
- name: Unit Tests (FUSE 2)
if: startsWith( matrix.os, 'ubuntu' )
run: |
python3 -c 'import mfusepy; assert mfusepy.fuse_version_major == 2'
python3 -m pytest -v -rs tests
- name: Unit Tests (FUSE 3)
if: startsWith( matrix.os, 'ubuntu' )
run: |
export FUSE_LIBRARY_PATH=$( dpkg -L libfuse3-3 | 'grep' -F .so | head -1 )
python3 -c 'import mfusepy; assert mfusepy.fuse_version_major == 3'
python3 -m pytest -v -rs tests
- name: Test Compatibility (Ratarmount)
if: startsWith( matrix.os, 'ubuntu' )
run: |
python3 -m pip install ratarmount
python3 -m pip install --force-reinstall .
mkdir -p mounted-tar
ratarmount tests/single-file.tar mounted-tar
[[ "$( cat mounted-tar/bar )" == "foo" ]]
fusermount -u mounted-tar
- name: Test Compatibility (ninfs)
if: ${{ startsWith( matrix.os, 'ubuntu' ) && matrix.python-version != '3.7' }}
run: |
python3 -m pip install git+https://github.com/ihaveamac/ninfs.git@main
python3 -m pip install --force-reinstall .
mkdir -p mounted-3dsx
ninfs threedsx tests/3dsfetch.3dsx mounted-3dsx
[[ "$( md5sum mounted-3dsx/icon.smdh )" =~ "a3d784b6f20182ebdf964589cbf427c2" ]]
fusermount -u mounted-3dsx
VM-Tests:
# Run tests inside a VM using cross-platform-actions
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
include:
- os: freebsd
version: '14.3'
display_name: FreeBSD
- os: freebsd
version: '13.5'
display_name: FreeBSD
- os: openbsd
version: '7.7'
display_name: OpenBSD
# OpenBSD 6.9 is not supported because it only has Python 3.8, which is not supported anymore.
# NetBSD 9.4 is not supported because its interface seems to mirror libFUSE 2.6 and therefore is HIGHLY
# incompatible. Even fuse_context.umask is missing!
- os: netbsd
version: '10.1'
display_name: NetBSD
- os: omnios
version: r151056
display_name: OmniOS
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-tags: true
- name: Test on ${{ matrix.display_name }}
uses: cross-platform-actions/action@v0.32.0
with:
operating_system: ${{ matrix.os }}
version: ${{ matrix.version }}
shell: bash
run: |
set -euxo pipefail
case "${{ matrix.os }}" in
freebsd)
# Ensure a proper hostname/FQDN is set (VMs may not have one by default)
sudo -E /bin/sh -c 'grep -q "freebsd\.local" /etc/hosts || echo "127.0.0.1 freebsd.local freebsd" >> /etc/hosts'
sudo -E hostname freebsd.local
hostname
# Keep pkg from aborting on minor version drift
export IGNORE_OSVERSION=yes
# Packages
sudo -E pkg update -f
sudo -E pkg install -y git fusefs-libs python3 python311 py311-pip
# Make FUSE work
sudo -E kldload fusefs
sudo -E sysctl vfs.usermount=1
sudo -E chmod 666 /dev/fuse
# Install pip Dependencies
python3 -m pip install pytest pytest-order ioctl-opt
# Test Installation From Source
python3 -m pip install .
# Unit Tests (FUSE 2)
python3 -c 'import mfusepy; assert mfusepy.fuse_version_major == 2'
python3 -m pytest -s -v -rs tests
;;
openbsd)
# Ensure a proper hostname/FQDN is set (VMs may not have one by default)
sudo -E /bin/sh -c 'grep -q "openbsd\.local" /etc/hosts || echo "127.0.0.1 openbsd.local openbsd" >> /etc/hosts'
sudo -E hostname openbsd.local
hostname
# Packages
sudo -E pkg_add git py3-pip py3-virtualenv py3-tox
sudo -E pkg_add sshfs-fuse # needed for sideeffect of having fuse 2.6?
# Install pip Dependencies
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install pytest pytest-order ioctl-opt
# Test Installation From Source
python3 -m pip install .
# Unit Tests (FUSE 2)
python3 -c 'import mfusepy; assert mfusepy.fuse_version_major == 2'
# FUSE mounting only works as root on OpenBSD
sudo -E .venv/bin/python3 -m pytest -s -v -rs tests
;;
netbsd)
# Ensure a proper hostname/FQDN is set (VMs may not have one by default)
sudo -E /bin/sh -c 'grep -q "netbsd\.local" /etc/hosts || echo "127.0.0.1 netbsd.local netbsd" >> /etc/hosts'
sudo -E hostname netbsd.local
hostname
# Packages
sudo -E pkgin -y update
sudo -E pkgin -y install git fuse perfuse python311 py311-pip
sudo -E ln -sf /usr/pkg/bin/python3.11 /usr/pkg/bin/python3
# Fix PATH
export PATH="/usr/pkg/bin:/usr/pkg/sbin:/sbin:/usr/sbin:$PATH"
# Make FUSE work (NetBSD)
sudo sysctl -w vfs.generic.usermount=1
sudo sysctl -w kern.sbmax=4194304
sudo chmod 666 /dev/puffs
# avoid permissions issue for perfused trace file:
sudo chmod 777 /var/run
# Install pip Dependencies
python3 -m pip install pytest pytest-order ioctl-opt
# Test Installation From Source
python3 -m pip install .
# preserve pytest exit status, always show logs
rc=0
python3 -m pytest -s -v -rs tests/test_struct_layout.py
# for now, run the tests as root, too many PermissionErrors:
sudo -E python3 -m pytest -s -v -rs tests || rc=$?
exit "$rc"
;;
omnios)
# Ensure a proper hostname/FQDN is set (VMs may not have one by default)
sudo -E /bin/sh -c 'grep -q "omnios\.local" /etc/hosts || echo "127.0.0.1 omnios.local omnios" >> /etc/hosts'
sudo -E hostname omnios.local
hostname
# Packages
pfexec pkg install developer/versioning/git
pfexec pkg install developer/gcc14
pfexec pkg set-mediator -V 14 gcc
# driver + libfuse
pfexec pkg set-publisher -p https://sfe.opencsw.org/localhostomnios localhostomnios
pfexec pkg refresh localhostomnios
pfexec pkg install --accept system/file-system/fusefs
pfexec pkg install --accept system/file-system/libfuse
pfexec pkg install --accept system/file-system/libfuse/src
pkg list system/file-system/fusefs
pkg list system/file-system/libfuse
pkg list system/file-system/libfuse/src
pkg contents system/file-system/fusefs
pkg contents system/file-system/libfuse
pkg contents system/file-system/libfuse/src
# Install pip Dependencies
python3 -m pip install pytest pytest-order ioctl-opt
# Fix PATH
export PATH="/home/runner/.local/bin:$PATH"
echo $PATH
# Test Installation From Source
python3 -m pip install .
# Unit Tests (FUSE 2)
python3 -c 'import mfusepy; assert mfusepy.fuse_version_major == 2'
# preserve pytest exit status, always show logs
rc=0
pfexec python3 -m pytest -v -rs tests || rc=$?
exit "$rc"
;;
esac