Skip to content

CI: Add Python 3.12 #466

CI: Add Python 3.12

CI: Add Python 3.12 #466

Workflow file for this run

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@v4
- uses: actions/setup-python@v5
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@v4
- uses: actions/setup-python@v5
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@v4
with:
fetch-depth: 20
- uses: actions/setup-python@v5
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