Skip to content

Commit

Permalink
Merge pull request #169 from atilaneves/travis-python38
Browse files Browse the repository at this point in the history
Use Python 3.8 on Travis CI
  • Loading branch information
atilaneves committed Nov 28, 2019
2 parents c4b6fbd + f3ff43d commit 1bae55e
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 32 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: required
dist: bionic

python:
- "3.7"
- "3.8"

addons:
apt:
Expand All @@ -24,10 +24,11 @@ install:

env:
global:
- PYTHON_INCLUDE_DIR=~/virtualenv/python3.7/include/python3.7m
- PYTHON_LIB_DIR=/opt/python/3.7.1/lib
- PYTHON_INCLUDE_DIR=~/virtualenv/python3.8/include/python3.8
- PYTHON_LIB_DIR=/opt/python/3.8.0/lib
- PYD_LIBPYTHON_DIR=/opt/python/3.8.0/lib
- PATH=$PYTHON_LIB_DIR:$PATH
- LD_RUN_PATH=$PYTHON_LIB_DIR:$LD_RUN_PATH
- LD_RUN_PATH=$PYTHON_LIB_DIR:$PYD_LIBPYTHON_DIR:$LD_RUN_PATH
matrix:
- DC=dmd-2.089.0
- DC=dmd-2.088.1
Expand Down
30 changes: 18 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
# Makefile to drive the tests

export PYTHON_LIB_DIR ?= /usr/lib
DUB_CONFIGURATION ?= python37
export DUB_CONFIGURATION ?= env
export PYD_LIBPYTHON_DIR ?= /usr/lib
export PYD_LIBPYTHON ?= python3.8
export PYD_D_VERSION_1 ?= Python_2_4_Or_Later
export PYD_D_VERSION_2 ?= Python_2_5_Or_Later
export PYD_D_VERSION_3 ?= Python_2_6_Or_Later
export PYD_D_VERSION_4 ?= Python_2_7_Or_Later
export PYD_D_VERSION_5 ?= Python_3_0_Or_Later
export PYD_D_VERSION_6 ?= Python_3_1_Or_Later
export PYD_D_VERSION_7 ?= Python_3_2_Or_Later
export PYD_D_VERSION_8 ?= Python_3_3_Or_Later
export PYD_D_VERSION_9 ?= Python_3_4_Or_Later
export PYD_D_VERSION_10 ?= Python_3_5_Or_Later
export PYD_D_VERSION_11 ?= Python_3_6_Or_Later
export PYD_D_VERSION_12 ?= Python_3_7_Or_Later
export PYD_D_VERSION_13 ?= Python_3_8_Or_Later


.PHONY: clean test test_python test_python_pyd test_python_pynih test_cs test_simple_pyd test_simple_pynih test_simple_cs test_pyd_pyd test_issues_pyd test_issues_pynih test_numpy_pyd test_numpy_pynih examples/simple/lib/pyd/libsimple.so examples/simple/lib/pynih/libsimple.so examples/issues/lib/pyd/libissues.so examples/issues/lib/pynih/libissues.so examples/numpy/lib/pyd/libnumpy.so examples/numpy/lib/pynih/libnumpy.so examples/pyd/lib/pyd/libpydtests.so examples/pyd/lib/pynih/libpydtests.so examples/phobos/lib/pyd/libphobos.so examples/phobos/lib/pynih/libphobos.so examples/simple/lib/csharp/libsimple.so examples/simple/Simple.cs

Expand All @@ -13,17 +29,7 @@ test_python_pynih: test_simple_pynih test_pyd_pynih test_issues_pynih
test_cs: test_simple_cs

clean:
@cd csharp && dub clean -q
@cd excel && dub clean -q
@cd pynih && dub clean -q
@cd python && dub clean -q
@cd reflection && dub clean -q
@cd examples/issues && dub clean -q
@cd examples/numpy && dub clean -q
@cd examples/pyd && dub clean -q
@cd examples/simple && dub clean -q
@rm -f examples/*/*.so examples/pyd/lib/pyd/*.so examples/simple/lib/*/*.so examples/simple/simple examples/simple/Simple.cs
@rm -rf tests/*/bin tests/*/obj
git clean -xffd

test_simple_pyd: tests/test_simple.py examples/simple/lib/pyd/simple.so
PYTHONPATH=$(PWD)/examples/simple/lib/pyd pytest -s -vv $<
Expand Down
4 changes: 3 additions & 1 deletion ci/test-csharp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
set -euo pipefail

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo 'Running C# script test'
"$SCRIPT_DIR"/../csharp/tests/test.sh
make -j`nproc` -C "$SCRIPT_DIR"/.. test_cs
echo 'Running C# makefile test'
make -j"$(nproc)" -C "$SCRIPT_DIR"/.. test_cs
32 changes: 21 additions & 11 deletions ci/test-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,29 @@ set -euo pipefail

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DC="${DC:-dmd}"
PYTHON_LIB_DIR="${PYTHON_LIB_DIR:-/usr/lib}"

echo "Testing with $DC compiler"


# echo 'Testing pynih'
"$SCRIPT_DIR"/../pynih/ci.sh

DUB_CONFIGURATION=python37 make -j`nproc` test_python
pushd /tmp
dub fetch pyd --version=0.11.0
dub run pyd:setup
set +u # or else the script below fails
source pyd_set_env_vars.sh
set -u
popd
DUB_CONFIGURATION=env make -j`nproc` test_python
dub test -q --build=unittest-cov --compiler="$DC"
# FIXME - Use pythono38 when it exists
# DUB_CONFIGURATION=python38 make -j"$(nproc)" test_python

# FIXME - use env when it works (broken until pyd tags the latest fix)
# pushd /tmp
# dub fetch pyd --version=0.13.0
# dub run pyd:setup
# set +u # or else the script below fails
# source pyd_set_env_vars.sh
# set -u
# popd
# DUB_CONFIGURATION=env make -j"$(nproc)" test_python

echo 'Running Python makefile test'
echo "And the lib dir is $PYTHON_LIB_DIR"
make -j"$(nproc)" test_python # FIXME - restore the two above instad of this line

echo 'Running autowrap unit tests'
PYTHON_LIB_DIR="$PYTHON_LIB_DIR" dub test -q --build=unittest-cov --compiler="$DC"
4 changes: 2 additions & 2 deletions dub.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ configuration "unittest" {
versions "unitUnthreaded" # GIL
versions "TestingAutowrap"

libs "python3.7m"
libs "python3.8"
lflags "-L$PYTHON_LIB_DIR"

dependency ":common" version="*"
Expand All @@ -53,7 +53,7 @@ configuration "unittest-no-pynih" {
versions "unitUnthreaded" # GIL
versions "TestingAutowrap"

libs "python3.7m"
libs "python3.8"
lflags "-L$PYTHON_LIB_DIR"
versions "NoPynih"

Expand Down
4 changes: 2 additions & 2 deletions pynih/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
DC="${DC:-dmd}"
TRAVIS="${TRAVIS:-}"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
PYTHON_INCLUDE_DIR="${PYTHON_INCLUDE_DIR:-/usr/include/python3.7m}"
PYTHON_INCLUDE_DIR="${PYTHON_INCLUDE_DIR:-/usr/include/python3.8}"


if [ "$DC" = "ldc2" ]; then
Expand All @@ -14,4 +14,4 @@ if [ "$DC" = "ldc2" ]; then
fi

cd "$SCRIPT_DIR"
make -j`nproc`
make -j"$(nproc)"

0 comments on commit 1bae55e

Please sign in to comment.