-
Notifications
You must be signed in to change notification settings - Fork 34
145 lines (137 loc) · 4.64 KB
/
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
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
name: Test
on:
- push
- pull_request
jobs:
checks:
runs-on: ubuntu-latest
env:
REPROZIP_USAGE_STATS: "off"
REPROZIP_PARAMETERS: "false"
LANG: C
LC_ALL: C
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
if [ -z "${XDG_CACHE_HOME-}" ]; then
mkdir -p ~/.cache/reprozip
else
mkdir -p "$XDG_CACHE_HOME/reprozip"
fi
pip install flake8 readme_renderer
- name: flake8
run: flake8 --ignore=E731,W503,W504
- name: Check for non-ASCII files
run: |
find reprozip reprounzip reprozip-* reprounzip-* -name '*.py' -or -name '*.sh' -or -name '*.h' -or -name '*.c' | (set +x; while read i; do
T=$(file -b --mime "$i")
if ! ( echo "$T" | grep -q ascii || echo "$T" | grep -q empty ) ; then
echo "$i is not ASCII"
exit 1
fi
done)
- name: Check logging usage
run: |
find reprozip reprounzip reprozip-* reprounzip-* -name '*.py' -exec sh -c "grep 'logging\\.\\(debug\\|warning\\|critical\\|error\\|info\\)' \"\$@\" && exit 1; exit 0" {} +
- name: Check READMEs
run: |
for pkg in reprozip reprounzip reprozip-* reprounzip-*; do
(cd $pkg && python setup.py check -r -s)
done
check-images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install ./reprozip-core ./reprounzip
- name: Check images
run: |
python tests --check-vagrant-images --check-docker-images
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
mode: [tests]
python:
- "3.7"
- "3.11"
- "3.12"
include:
- os: ubuntu-latest
mode: coverage
python: "3.10"
- os: ubuntu-20.04
mode: tests
python: "3.6"
runs-on: ${{ matrix.os }}
env:
TEST_MODE: ${{ matrix.mode }}
REPROZIP_USAGE_STATS: "off"
REPROZIP_PARAMETERS: "false"
LANG: C
LC_ALL: C
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 20
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
if [ -z "${XDG_CACHE_HOME-}" ]; then
mkdir -p ~/.cache/reprozip
else
mkdir -p "$XDG_CACHE_HOME/reprozip"
fi
if [ "$TEST_MODE" = "coverage" ]; then
export CFLAGS="-fprofile-arcs -ftest-coverage"
fi
PKGS="libc6-dev-i386 gcc-multilib libsqlite3-dev"
if [ "$TEST_MODE" = "coverage" ]; then PKGS="$PKGS lcov"; fi
sudo apt-get update -qq
sudo apt-get install -qq $PKGS
if [ $TEST_MODE = "coverage" ]; then
pip install 'coverage>=5,<6'
# `--config-settings editable_mode=compat` works around https://github.com/pypa/setuptools/issues/3557
pip install -e ./reprozip-core -e ./reprozip -e ./reprounzip -e ./reprounzip-docker -e ./reprounzip-vagrant -e ./reprounzip-vistrails -e ./reprounzip-qt -e ./reprozip-jupyter --config-settings editable_mode=compat
else
pip install ./reprozip-core ./reprozip ./reprounzip ./reprounzip-docker ./reprounzip-vagrant ./reprounzip-vistrails ./reprounzip-qt ./reprozip-jupyter
fi
- name: Unit tests
run: |
export PYTHONUNBUFFERED=1
if [ "$TEST_MODE" = "coverage" ]; then
export COVER="coverage run --append --source=$PWD --branch"
fi
python -Wd tests --unittests
- name: Functional test
run: |
export PYTHONUNBUFFERED=1
export REPROZIP_TEST_PYTHON="$(which python) -Wd"
if [ "$TEST_MODE" = "coverage" ]; then
export COVER="coverage run --append --source=$PWD --branch"
python -Wd -m $COVER -m tests --functests --run-docker
else
python -Wd tests --functests --run-docker
fi
- name: Upload coverage
if: matrix.mode == 'coverage'
run: |
# Python
if [ -f .coverage ]; then mv .coverage .coverage.orig; fi # FIXME: useless?
coverage combine
# C
# Find the coverage file (in distutils's build directory)
OBJDIR=$(dirname "$(find . -name pytracer.gcno | head -n 1)")
(cd reprozip/native && lcov --directory ../../$OBJDIR -c -o reprozip.lcov)
curl -s -o - https://codecov.io/bash | bash -s - -X gcov