-
Notifications
You must be signed in to change notification settings - Fork 39
181 lines (153 loc) · 6.47 KB
/
tests.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
name: Tests
on:
push:
branches: '**'
tags-ignore: '**'
pull_request:
jobs:
Static-Code-Checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install pip Dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --user fusepy pytest lz4 PySquashfsImage
- name: Style Check With Black
run: |
python3 -m pip install black
black -q --diff --line-length 120 --skip-string-normalization ratarmount.py tests/*.py core/ratarmountcore/*.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 --ignore-words-list fo,Nd,unx $( git ls-tree -r --name-only HEAD )
- name: Lint With Flake8
run: |
python3 -m pip install flake8
flake8 --config tests/.flake8 *.py tests/*.py core/ratarmountcore/[^_]*.py
- name: Lint With Pylint
run: |
python3 -m pip install pylint
pylint --rcfile tests/.pylintrc *.py tests/*.py core/ratarmountcore/*.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 -P$( cd core && pwd ):$( pwd ) ratarmount.py core/ratarmountcore/*.py
- name: Lint With Mypy
run: |
yes | python3 -m pip install --upgrade-strategy eager --upgrade types-dataclasses mypy
mypy --config-file tests/.mypy.ini *.py core/ratarmountcore/*.py
yes | python3 -m pip uninstall types-dataclasses
- name: Lint With ShellCheck
run: |
sudo apt-get -y install shellcheck
shellcheck -e SC2064 tests/*.sh
Tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest']
# macos-13 / macos-latest does not work anymore because the dependencies don't have any wheels,
# probably because it is M1 based.
# ToDo: Add windows-latest but it requires a lot of setup of the dependencies!
# Maybe only test ratarmount-core without most dependencies after I have split that off.
# Oldest and newest versions should be enough. Python versions are supported 5 years from release date.
# https://endoflife.date/python
# 3.5 was released 2015-09-13 and end-of-life was 2020-09-13
# 3.6 was released 2016-12-23 and end-of-life was 2021-12-23
# 3.7 was released 2018-06-27 and end-of-life was 2023-06-27
# 3.8 was released 2019-10-14 and end-of-life will be 2024-10-14
# 3.9 was released 2020-10-05 and end-of-life will be 2025-10-25
# 3.10 was released 2021-10-04 and end-of-life will be 2026-10-04
# 3.11 was released 2022-10-24 and end-of-life will be 2027-10
# 3.12 was released 2023-10-02 and end-of-life will be 2028-10
# 3.13 is to be released 2024-10
# 3.14 is to be released 2025-10
python-version: ['3.13.0-rc.2']
include:
- os: ubuntu-latest
python-version: '3.14.0-alpha.0'
defaults:
run:
# This is especially important for windows because it seems to default to powershell
shell: bash
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Print System Information
run: |
echo "uname -a: $( uname -a )"
echo "Shell: $SHELL"
echo "Cores: $( nproc )"
echo "Mount points:"; mount
- uses: msys2/setup-msys2@v2
if: startsWith( matrix.os, 'windows' )
with:
install: gcc make liblzma-devel libzstd-devel zlib-devel
- name: Install Dependencies (Linux)
if: startsWith( matrix.os, 'ubuntu' )
run: |
# Libarchive calls the grzip, lrzip, lzop binaries for lrzip support. Others, such as bzip2, gzip, lz4, lzma,
# zstd, may also call external binaries depending on how libarchive was compiled!
# https://github.com/libarchive/libarchive/blob/ad5a0b542c027883d7069f6844045e6788c7d70c/libarchive/
# archive_read_support_filter_lrzip.c#L68
sudo apt-get -y install libfuse2 fuse3 bzip2 pbzip2 pixz zstd unar lrzip lzop gcc liblzo2-dev
set -x
- name: Install Dependencies (MacOS)
if: startsWith( matrix.os, 'macos' )
run: |
# coreutils is required for the tests written in shell, e.g., for the 'realpath' command
# unar is required for rar tests with passwords. By default, bsdtar is installed but that is the only
# one of the three supported tools (the third is unrar) that does not support passwords.
# And the error message is atrocious:
# cmdline.extend(args)
# TypeError: 'NoneType' object is not iterable
brew install macfuse coreutils pixz pbzip2 zstd unar libarchive lrzip lzop lzo
# Add brew installation binary folder to PATH so that command line tools like zstd can be found
export PATH="$PATH:/usr/local/bin"
- name: Install pip Dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade wheel
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade-strategy eager --upgrade twine build fusepy cffi
- name: Test ratarmountcore Installation From Tarball
working-directory: core
run: |
python3 -m build
twine check dist/*
python3 -m pip install "$( find dist -name '*.tar.gz' | head -1 )"[full]
- 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 .[full]
- name: Regression Tests (FUSE 3)
if: ${{ !startsWith( matrix.os, 'macos' ) }}
run: |
export FUSE_LIBRARY_PATH=$( dpkg -L libfuse3-3 | 'grep' -F .so | head -1 )
ratarmount --version
bash tests/runtests.sh
- name: Regression Tests (FUSE 2)
if: ${{ !startsWith( matrix.os, 'macos' ) }}
run: |
bash tests/runtests.sh
- name: Module tests without fusepy
run: |
python3 -m pip uninstall -y fusepy
python3 tests/tests.py