-
Notifications
You must be signed in to change notification settings - Fork 135
67 lines (63 loc) · 2.27 KB
/
build-and-test.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
name: Build and test rmlint (master)
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
env:
RM_TS_DIR: "/tmp/rmlint-unit-testdir"
steps:
- uses: actions/checkout@v4
- name: "Prepare build environment"
run: |
sudo apt update
sudo apt install -y --no-install-recommends \
scons python3-sphinx gettext python3-setuptools \
libblkid-dev libelf-dev libglib2.0-dev libjson-glib-dev \
clang python3-pip python3-cffi python3-dev libffi-dev
pip3 install -r tests/requirements.txt
- name: "Build"
# Todo: eventually run tests with valgrind (RM_TS_USE_VALGRIND)
# Todo enable slow tests in pytest
run: |
scons config
scons VERBOSE=1 DEBUG=1 O=release
- name: "Prepare test environment"
# The test suite is seriously disk-intensive. Given that linux
# instances hosted in GitHub have 16G of RAM available we will
# use it to speed up the run.
run: |
sudo mkdir "${RM_TS_DIR}"
sudo mount -o size=12G,nr_inodes=0 -t tmpfs tmpfs "${RM_TS_DIR}"
- name: "Test"
run: |
RM_TS_PRINT_CMD=1 RM_TS_PEDANTIC=0 python -m pytest -s -v
- name: CoW tests
shell: bash
run: |
sudo umount "${RM_TS_DIR}"
sudo modprobe brd rd_nr=1 rd_size=12582912
sudo mkfs.btrfs -f /dev/ram0
sudo mount /dev/ram0 "${RM_TS_DIR}"
sudo chmod 0777 "${RM_TS_DIR}"
cat <<'EOF' >> tests/conftest.py
def pytest_collection_modifyitems(items, config):
selected_items = []
deselected_items = []
for item in items:
if "needs_reflink_fs" in getattr(item, "fixturenames", ()):
selected_items.append(item)
else:
deselected_items.append(item)
config.hook.pytest_deselected(items=deselected_items)
items[:] = selected_items
EOF
RM_TS_PRINT_CMD=1 RM_TS_PEDANTIC=0 python -m pytest -s -v
- name: "Cleanup"
run: |
sudo umount "${RM_TS_DIR}"
sudo rmdir "${RM_TS_DIR}"