Commit a35bd75c authored by davfsa's avatar davfsa Committed by GitHub

Switch to github actions (GH-3943)

parent 6af5d01e
name: CI
on: [push, pull_request]
jobs:
ci:
strategy:
# Allows for matrix sub-jobs to fail without canceling the rest
fail-fast: false
# MATRIX:
# =======
# Required parameters:
# os the os to run on
# python-version the python version to use
# backend the backend to use
# env any additional env variables. Set to '{}' for none
# Optional parameters:
# allowed_failure whether the job is allowed to fail
# extra_hash extra hash str to differentiate from other caches with similar name (must always start with '-')
matrix:
# Tests [amd64]
#
# FIXME: 'cpp' tests seems to fail due to compilation errors (numpy_pythran_unit)
# in all python versions and test failures (builtin_float) in 3.5<
os: [ubuntu-18.04]
backend: [c, cpp]
python-version: [2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10-dev]
env: [{}]
include:
# Temporary - Allow failure on all 3.10-dev jobs until beta comes out
- python-version: 3.10-dev
allowed_failure: true
# Ubuntu sub-jobs:
# ================
# Linting
- os: ubuntu-18.04
python-version: 3.7
backend: "c,cpp"
env: { TEST_CODE_STYLE: 1 }
extra_hash: "-codestyle"
# Limited API
- os: ubuntu-18.04
python-version: 3.6
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
- os: ubuntu-18.04
python-version: 3.7
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
- os: ubuntu-18.04
python-version: 3.8
backend: "c,cpp"
env: { LIMITED_API: "--limited-api", EXCLUDE: "--no-file" }
extra_hash: "-limited_api"
# Stackless
- os: ubuntu-18.04
python-version: 2.7
backend: c
env: { STACKLESS: true, PY: 2 }
extra_hash: "-stackless"
- os: ubuntu-18.04
python-version: 3.6
backend: c
env: { STACKLESS: true, PY: 3 }
extra_hash: "-stackless"
# Pypy
- os: ubuntu-18.04
python-version: pypy-2.7
backend: c
env: {}
- os: ubuntu-18.04
python-version: pypy-3.7
backend: c
env: {}
# Pypy [allowed-failures] - These specifically test known bugs
- os: ubuntu-18.04
python-version: pypy-2.7
backend: c
env:
{
EXCLUDE: "--listfile=tests/pypy_bugs.txt --listfile=tests/pypy2_bugs.txt bugs",
}
allowed_failure: true
extra_hash: "-allowed_failures"
- os: ubuntu-18.04
python-version: pypy-3.7
backend: c
env: { EXCLUDE: "--listfile=tests/pypy_bugs.txt bugs" }
allowed_failure: true
extra_hash: "-allowed_failures"
# Coverage - Disabled due to taking too long to run
# - os: ubuntu-18.04
# python-version: 3.7
# backend: "c,cpp"
# env: { COVERAGE: 1 }
# extra_hash: '-coverage'
# MacOS sub-jobs
# ==============
- os: macos-10.15
python-version: 2.7
backend: "c,cpp"
env: { MACOSX_DEPLOYMENT_TARGET: 10.14 }
- os: macos-10.15
python-version: 3.8
backend: "c,cpp"
env: { MACOSX_DEPLOYMENT_TARGET: 10.14 }
# This defaults to 360 minutes (6h) which is way too long and if a test gets stuck, it can block other pipelines.
# From testing, the runs tend to take ~20 minutes, so a limit of 30 minutes should be enough. This can always be
# changed in the future if needed.
timeout-minutes: 30
runs-on: ${{ matrix.os }}
env:
BACKEND: ${{ matrix.backend }}
OS_NAME: ${{ matrix.os }}
PYTHON_VERSION: ${{ matrix.python-version }}
USE_CCACHE: 1
CCACHE_SLOPPINESS: "pch_defines,time_macros"
CCACHE_COMPRESS: 1
CCACHE_MAXSIZE: "250M"
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache [ccache]
uses: pat-s/always-upload-cache@v2.1.3
if: startsWith(runner.os, 'Linux')
with:
path: ~/.ccache
key: ${{ runner.os }}-ccache${{ matrix.extra_hash }}-${{ matrix.python-version }}-${{ hashFiles('**/test-requirements*.txt', '**/ci.yml', '**/ci-run.sh') }}
- name: Run CI
continue-on-error: ${{ matrix.allowed_failure || false }}
env: ${{ matrix.env }}
run: bash ./Tools/ci-run.sh
......@@ -16,147 +16,33 @@ cache:
directories:
- $HOME/.ccache
python:
- 3.9
- 3.8
- 2.7
- 3.10-dev
- 3.7
- 3.6
- 3.5
- 3.4
env:
global:
- USE_CCACHE=1
- CCACHE_SLOPPINESS=pch_defines,time_macros
- CCACHE_COMPRESS=1
- CCACHE_MAXSIZE=250M
- PATH="/usr/lib/ccache:$HOME/miniconda/bin:$PATH"
- BACKEND=c,cpp
matrix:
- BACKEND=c
- BACKEND=cpp
- PATH="/usr/lib/ccache:$PATH"
- PYTHON_VERSION=3.8
- OS_NAME=ubuntu
python: 3.8
matrix:
include:
# slowest first
- os: osx
osx_image: xcode10.3
env: PY=2 MACOSX_DEPLOYMENT_TARGET=10.9
python: 2.7
language: c
compiler: clang
cache: false
- os: osx
osx_image: xcode10.3
env: PY=3 MACOSX_DEPLOYMENT_TARGET=10.9
python: 3.9
language: c
compiler: clang
cache: false
# Disabled: coverage analysis takes excessively long, several times longer than without.
# - python: 3.7
# env: COVERAGE=1
- python: 3.7
env: TEST_CODE_STYLE=1
- python: 3.8
env: LIMITED_API=--limited-api EXCLUDE=--no-file
- python: 3.7
env: LIMITED_API=--limited-api EXCLUDE=--no-file
- python: 3.6
env: LIMITED_API=--limited-api EXCLUDE=--no-file
- python: 3.8
arch: arm64
- arch: arm64
env: BACKEND=c
- python: 3.8
arch: arm64
- arch: arm64
env: BACKEND=cpp
- python: 3.8
arch: ppc64le
- arch: ppc64le
env: BACKEND=c
- python: 3.8
arch: ppc64le
- arch: ppc64le
env: BACKEND=cpp
# s390x currently shows test failures.
# - python: 3.8
# arch: s390x
# env: BACKEND=c
# - python: 3.8
# arch: s390x
# env: BACKEND=cpp
- env: STACKLESS=true BACKEND=c PY=2
python: 2.7
- env: STACKLESS=true BACKEND=c PY=3
python: 3.6
- python: pypy
env: BACKEND=c
- python: pypy3
env: BACKEND=c
# a secondary pypy tests which is allowed to fail and which specifically
# tests known bugs
- python: pypy
env: BACKEND=c EXCLUDE="--listfile=tests/pypy_bugs.txt --listfile=tests/pypy2_bugs.txt bugs"
- python: pypy3
env: BACKEND=c EXCLUDE="--listfile=tests/pypy_bugs.txt bugs"
allow_failures:
- env: BACKEND=c EXCLUDE="--listfile=tests/pypy_bugs.txt bugs"
- env: BACKEND=c EXCLUDE="--listfile=tests/pypy_bugs.txt --listfile=tests/pypy2_bugs.txt bugs"
before_install:
- |
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
# adding apt repos in travis is really fragile => retry a couple of times.
for i in {1..10}; do travis_retry sudo apt-add-repository --yes 'ppa:ubuntu-toolchain-r/test' && break; sleep 2; done
for i in {1..10}; do travis_retry sudo apt-get update && travis_retry sudo apt-get install --yes gcc-8 $(if [ -z "${BACKEND##*cpp*}" ]; then echo -n "g++-8"; fi ) && break; sleep 2; done
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 $(if [ -z "${BACKEND##*cpp*}" ]; then echo " --slave /usr/bin/g++ g++ /usr/bin/g++-8"; fi)
sudo update-alternatives --set gcc /usr/bin/gcc-8
export CC=gcc
if [ -z "${BACKEND##*cpp*}" ]; then sudo update-alternatives --set g++ /usr/bin/g++-8; export CXX=g++; fi
fi
- |
if [ "$TRAVIS_OS_NAME" == "osx" -o "$STACKLESS" == "true" ]; then
echo "Installing Miniconda"
if [ "$TRAVIS_OS_NAME" == "osx" ]; then CONDA_PLATFORM=MacOSX; else CONDA_PLATFORM=Linux; fi
travis_retry wget -O miniconda.sh https://repo.continuum.io/miniconda/Miniconda$PY-latest-${CONDA_PLATFORM}-x86_64.sh || exit 1
bash miniconda.sh -b -p $HOME/miniconda && rm miniconda.sh || exit 1
conda --version || exit 1
#conda install --quiet --yes nomkl --file=test-requirements.txt --file=test-requirements-cpython.txt
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
which clang && clang --version && export CC="clang -Wno-deprecated-declarations" || true
which clang++ && clang++ --version && export CXX="clang++ -stdlib=libc++ -Wno-deprecated-declarations" || true
fi
fi
- if [ -n "$CC" ]; then which ${CC%% *}; $CC --version; fi
- if [ -n "$CXX" ]; then which ${CXX%% *}; $CXX --version; fi
- if [ "$STACKLESS" == "true" ]; then
conda config --add channels stackless;
travis_retry conda install --quiet --yes stackless;
fi
install:
- python -c 'import sys; print("Python %s" % (sys.version,))'
- if [ -z "${TRAVIS_PYTHON_VERSION##2.7}" ]; then [ "$TRAVIS_OS_NAME" == "osx" -a "$PY" == "3" ] || pip install -r test-requirements-27.txt ; fi
- if [ -n "${TRAVIS_PYTHON_VERSION##*-dev}" -a -n "${TRAVIS_PYTHON_VERSION##2.7}" ]; then pip install -r test-requirements.txt $( [ -z "${TRAVIS_PYTHON_VERSION##pypy*}" -o -z "${TRAVIS_PYTHON_VERSION##3.[47891]*}" ] || echo " -r test-requirements-cpython.txt" ) ; fi
# - CFLAGS="-O2 -ggdb -Wall -Wextra $(python -c 'import sys; print("-fno-strict-aliasing" if sys.version_info[0] == 2 else "")')" python setup.py build
before_script: ccache -s || true
# Disabled due to test errors
# - arch: s390x
# env: BACKEND=c
# - arch: s390x
# env: BACKEND=cpp
script:
- PYTHON_DBG="python$( python -c 'import sys; print("%d.%d" % sys.version_info[:2])' )-dbg"
- if [ "$TEST_CODE_STYLE" = "1" ]; then
STYLE_ARGS="--no-unit --no-doctest --no-file --no-pyregr --no-examples";
else
STYLE_ARGS=--no-code-style;
if $PYTHON_DBG -V >&2; then CFLAGS="-O0 -ggdb" $PYTHON_DBG runtests.py -vv --no-code-style Debugger --backends=$BACKEND; fi;
if [ -z "${BACKEND##*cpp*}" -a -n "${TRAVIS_PYTHON_VERSION##*-dev}" ]; then pip install pythran==0.9.7; fi;
if [ "$BACKEND" != "cpp" -a -n "${TRAVIS_PYTHON_VERSION##2*}" -a -n "${TRAVIS_PYTHON_VERSION##pypy*}" -a -n "${TRAVIS_PYTHON_VERSION##*-dev}" -a -n "${TRAVIS_PYTHON_VERSION##*3.4}" ]; then pip install mypy; fi;
fi
# Need to clear the ccache? Try something like this:
# - if [ -n "${BACKEND##*cpp*}" -a -z "${TRAVIS_PYTHON_VERSION##*3.4}" ]; then ccache -C || true; fi
- if [ "$COVERAGE" != "1" ]; then CFLAGS="-O2 -ggdb -Wall -Wextra $(python -c 'import sys; print("-fno-strict-aliasing" if sys.version_info[0] == 2 else "")')" python setup.py build_ext -i $(python -c 'import sys; print("-j5" if sys.version_info >= (3,5) else "")'); fi
- CFLAGS="-O0 -ggdb -Wall -Wextra" python runtests.py -vv $STYLE_ARGS -x Debugger --backends=$BACKEND $LIMITED_API $EXCLUDE $(if [ "$COVERAGE" == "1" ]; then echo " --coverage"; fi) $(if [ -z "$TEST_CODE_STYLE" ]; then echo " -j7 "; fi)
- ccache -s || true
- bash ./Tools/ci-run.sh
#!/usr/bin/bash
# Set up compilers
if [ "${OS_NAME##ubuntu*}" == "" ]; then
echo "Installing requirements [apt]"
sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
sudo apt update -y -q
sudo apt install -y -q ccache gdb python-dbg python3-dbg gcc-8 || exit 1
if [ -z "${BACKEND##*cpp*}" ]; then
sudo apt install -y -q g++-8 || exit 1
fi
sudo /usr/sbin/update-ccache-symlinks
echo "/usr/lib/ccache" >> $GITHUB_PATH # export ccache to path
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 $(if [ -z "${BACKEND##*cpp*}" ]; then echo " --slave /usr/bin/g++ g++ /usr/bin/g++-8"; fi)
export CC="gcc"
if [ -z "${BACKEND##*cpp*}" ]; then
sudo update-alternatives --set g++ /usr/bin/g++-8
export CXX="g++"
fi
fi
if [ "${OS_NAME##macos*}" == "" ]; then
export CC="clang -Wno-deprecated-declarations"
export CXX="clang++ -stdlib=libc++ -Wno-deprecated-declarations"
fi
# Set up miniconda
if [ "$STACKLESS" == "true" ]; then
echo "Installing stackless python"
#conda install --quiet --yes nomkl --file=test-requirements.txt --file=test-requirements-cpython.txt
conda config --add channels stackless
conda install --quiet --yes stackless || exit 1
fi
# Log versions in use
echo "===================="
echo "|VERSIONS INSTALLED|"
echo "===================="
python -c 'import sys; print("Python %s" % (sys.version,))'
if [ "$CC" ]; then
which ${CC%% *}
${CC%% *} --version
fi
if [ "$CXX" ]; then
which ${CXX%% *}
${CXX%% *} --version
fi
echo "===================="
# Install python requirements
echo "Installing requirements [python]"
if [ -z "${PYTHON_VERSION##2.7}" ]; then
pip install -r test-requirements-27.txt || exit 1
elif [ -n "${PYTHON_VERSION##*-dev}" ]; then
python -m pip install -r test-requirements.txt || exit 1
if [ "${PYTHON_VERSION##pypy*}" -a "${PYTHON_VERSION##3.[4789]*}" ]; then
python -m pip install -r test-requirements-cpython.txt || exit 1
fi
fi
if [ "$TEST_CODE_STYLE" == "1" ]; then
STYLE_ARGS="--no-unit --no-doctest --no-file --no-pyregr --no-examples";
else
STYLE_ARGS="--no-code-style";
# Run python-dbg if available
PYTHON_DBG="python$( python -c 'import sys; print("%d.%d" % sys.version_info[:2])' )-dbg"
if $PYTHON_DBG -V >&2; then CFLAGS="-O0 -ggdb" $PYTHON_DBG runtests.py -vv --no-code-style Debugger --backends=$BACKEND; fi;
# Install more requirements
if [ -n "${PYTHON_VERSION##*-dev}" ]; then
if [ -z "${BACKEND##*cpp*}" ]; then
echo "WARNING: Currently not installing pythran due to compatibility issues"
# python -m pip install pythran==0.9.5 || exit 1
fi
if [ "$BACKEND" != "cpp" -a -n "${PYTHON_VERSION##pypy*}" -a -n "${PYTHON_VERSION##2*}" -a -n "${PYTHON_VERSION##*3.4}" ]; then
python -m pip install mypy || exit 1
fi
fi
fi
# Run tests
if [ "$COVERAGE" != "1" -a -n "${PYTHON_VERSION##pypy*}" ]; then
export CFLAGS="-O2 -ggdb -Wall -Wextra $(python -c 'import sys; print("-fno-strict-aliasing" if sys.version_info[0] == 2 else "")')"
python setup.py build_ext -i $(python -c 'import sys; print("-j5" if sys.version_info >= (3,5) else "")') || exit 1
fi
export CFLAGS="-O0 -ggdb -Wall -Wextra"
python runtests.py \
-vv $STYLE_ARGS \
-x Debugger \
--backends=$BACKEND \
$LIMITED_API \
$EXCLUDE \
$(if [ "$COVERAGE" == "1" ]; then echo " --coverage"; fi) \
$(if [ -z "$TEST_CODE_STYLE" ]; then echo " -j7 "; fi)
......@@ -21,4 +21,4 @@ If you have code that you want to contribute, please make sure that it
* includes tests in the ``tests/`` directory (see the `Hacker Guide on Testing <https://github.com/cython/cython/wiki/HackerGuide#the-test-suite>`_)
* comes in form of a pull request
We use `travis <https://travis-ci.org/cython/cython>`_ and `appveyor <https://ci.appveyor.com/project/cython/cython>`_ for cross-platform testing, including pull requests.
We use `github actions <https://github.com/cython/cython/actions>`_, `travis <https://travis-ci.org/cython/cython>`_ and `appveyor <https://ci.appveyor.com/project/cython/cython>`_ for cross-platform testing, including pull requests.
......@@ -2378,8 +2378,7 @@ def runtests_callback(args):
def runtests(options, cmd_args, coverage=None):
# faulthandler should be able to provide a limited traceback
# in the event of a segmentation fault. Hopefully better than Travis
# just keeping running until timeout. Only available on Python 3.3+
# in the event of a segmentation fault. Only available on Python 3.3+
try:
import faulthandler
except ImportError:
......@@ -2546,8 +2545,8 @@ def runtests(options, cmd_args, coverage=None):
sys.stderr.write("Backends: %s\n" % ','.join(backends))
languages = backends
if 'TRAVIS' in os.environ and sys.platform == 'darwin' and 'cpp' in languages:
bugs_file_name = 'travis_macos_cpp_bugs.txt'
if 'CI' in os.environ and sys.platform == 'darwin' and 'cpp' in languages:
bugs_file_name = 'macos_cpp_bugs.txt'
exclude_selectors += [
FileListExcluder(os.path.join(ROOTDIR, bugs_file_name),
verbose=verbose_excludes)
......
......@@ -16,18 +16,17 @@ PYTHON fake_grep.py -c '#include "common/AddTraceback_impl_.*h"' c.c
import sys
from Cython.Build.Dependencies import cythonize
import platform
import os
from distutils.core import setup
# os x on Travis specifically seems to crash with nthreads>0
osx_on_travis = (platform.system() == "Darwin" and os.getenv("TRAVIS"))
# os x on CI specifically seems to crash with nthreads>0
osx_on_ci = (sys.platform == "darwin" and os.getenv("CI"))
# Test concurrent safety if multiprocessing is available.
# (In particular, TravisCI does not support spawning processes from tests.)
# (In particular, CI providers like Travis and Github Actions do not support spawning processes from tests.)
nthreads = 0
if not (hasattr(sys, 'pypy_version_info') or osx_on_travis):
if not (hasattr(sys, 'pypy_version_info') or osx_on_ci):
try:
import multiprocessing
multiprocessing.Pool(2).close()
......
......@@ -10,6 +10,7 @@ sequential_parallel
yield_from_pep380
memoryview_inplace_division
run.unicodeliterals
run.unicodemethods
run.unicode_imports
run.test_genericclass
......@@ -64,14 +65,3 @@ run.exttype_dealloc
# bugs in cpyext
run.special_methods_T561
run.special_methods_T561_py2
# looks to be fixed in PyPy 7.3.0
# TODO - remove when Travis updates
run.py_unicode_strings
run.unicodeliterals
run.unicode_identifiers
run.unicode_identifiers_import
errors.unicode_identifiers_e4
run.tracebacks
run.fstring
run.unicode_identifiers_normalization
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment