diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..e82224f6e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,59 @@ +name: Publish Python distributions to PyPI and TestPyPI +env: + BOOST_PYTHON_LIB: boost_python + BOOST_SYSTEM_LIB: boost_system + BOOST_THREAD_LIB: boost_thread + MASON_BUILD: true + CCACHE_TEMPDIR: /tmp/.ccache-temp + CCACHE_COMPRESS: 1 + PYTHONUSERBASE: $(pwd)/mason_packages/.link + PYTHONPATH: $(pwd)/mason_packages/.link/lib/python2.7/site-packages +on: [push, pull_request] +jobs: + build-and-test: + strategy: + fail-fast: false + matrix: + python-version: + - "2.7" + - "3.6" + - "3.8" + system: + - ubuntu-18.04 + - ubuntu-20.04 + runs-on: ${{matrix.system}} + name: Build and publish Python distribution + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Git Sumbodule Update + run: | + git pull --recurse-submodules + git submodule update --remote --recursive + - name: install dependencies + run: | + sudo apt-get install libboost-python-dev python3-cairo-dev python-cairo-dev clang postgresql + - name: Initialize Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Build binary wheel and a source tarball + run: | + pip install wheel pycairo nose PyPDF2 + python setup.py sdist bdist_wheel + - name: Run tests + run: | + source scripts/setup_mason.sh + export PATH=$(pwd)/mason_packages/.link/bin:${PYTHONUSERBASE}/bin:${PATH} + mkdir -p ${PYTHONPATH} + python setup.py install --prefix ${PYTHONUSERBASE} + source mason-config.env + ./mason_packages/.link/bin/postgres -k ${PGHOST} > postgres.log & + python test/run_tests.py + python test/visual.py -q + ./mason_packages/.link/bin/pg_ctl -w stop + - uses: actions/upload-artifact@v3 + with: + name: python_${{ matrix.python-version }}-${{matrix.system}} + path: ./dist/*.whl diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6d3648a6c..000000000 --- a/.travis.yml +++ /dev/null @@ -1,93 +0,0 @@ -language: generic - -matrix: - include: - - os: linux - sudo: false - compiler: clang - # note: only using ccache for CC is intentional here to - # workaround an odd bug in distutils that manifests when only `ccache` is used to link - # because distutils also has a bug whereby CC is used to compile instead of CXX, this works :) - env: JOBS=8 CXX="clang++-3.9 -Qunused-arguments" CC="ccache clang-3.9 -Qunused-arguments" - addons: - apt: - sources: [ 'ubuntu-toolchain-r-test'] - packages: [ 'libstdc++-5-dev', 'gdb', 'apport'] - - os: osx - osx_image: xcode8.2 - compiler: clang - env: JOBS=4 - -cache: - directories: - - $HOME/.ccache - -env: - global: - - secure: "CqhZDPctJcpXGPpmIPK5usD/O+2HYawW3434oDufVS9uG/+C7aHzKzi8cuZ7n/REHqJMzy7gJfp6DiyF2QowpnN1L2W0FSJ9VOgj4JQF2Wsupo6gJkq6/CW2Fa35PhQHsv29bfyqtIq+R5SBVAieBe/Lh2P144RwRliGRopGQ68=" - - secure: "idk4fdU49i546Zs6Fxha14H05eRJ1G/D6NPRaie8M8o+xySnEqf+TyA9/HU8QH7cFvroSLuHJ1U7TmwnR+sXy4XBlIfHLi4u2MN+l/q014GG7T2E2xYcTauqjB4ldToRsDQwe5Dq0gZCMsHLPspWPjL9twfp+Ds7qgcFhTsct0s=" - - BOOST_PYTHON_LIB="boost_python" - - BOOST_SYSTEM_LIB="boost_system" - - BOOST_THREAD_LIB="boost_thread" - - CCACHE_TEMPDIR=/tmp/.ccache-temp - - CCACHE_COMPRESS=1 - -before_install: - # workaround travis rvm bug - # http://superuser.com/questions/1044130/why-am-i-having-how-can-i-fix-this-error-shell-session-update-command-not-f - - | - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then - rvm get head || true - fi - - source scripts/setup_mason.sh - - export PYTHONUSERBASE=$(pwd)/mason_packages/.link - - export PYTHONPATH=$(pwd)/mason_packages/.link/lib/python2.7/site-packages - - export PATH=$(pwd)/mason_packages/.link/bin:${PYTHONUSERBASE}/bin:${PATH} - - export MASON_BUILD=true - - export COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n') - - | - if [[ $(uname -s) == 'Linux' ]]; then - export LDSHARED=$(python -c "import os;from distutils import sysconfig;print sysconfig.get_config_var('LDSHARED').replace('cc ','clang++-3.9 ')"); - mason install clang++ 3.9.1 - export PATH=$(mason prefix clang++ 3.9.1)/bin:${PATH} - which clang++ - else - sudo easy_install pip; - export LDSHARED=$(python -c "import os;from distutils import sysconfig;print sysconfig.get_config_var('LDSHARED').replace('cc ','clang++ ')"); - fi - - pip install --upgrade --user nose - - pip install --upgrade --user wheel - - pip install --upgrade --user twine - - pip install --upgrade --user setuptools - - pip install --upgrade --user PyPDF2 - - python --version - -install: - - mkdir -p ${PYTHONPATH} - - python setup.py install --prefix ${PYTHONUSERBASE} - -before_script: - # start postgres/postgis - - source mason-config.env - - ./mason_packages/.link/bin/postgres -k ${PGHOST} > postgres.log & - -script: - - python test/run_tests.py - - python test/visual.py -q - # stop postgres - - ./mason_packages/.link/bin/pg_ctl -w stop - - | - if [[ ${COMMIT_MESSAGE} =~ "[publish]" ]]; then - python setup.py bdist_wheel - if [[ $(uname -s) == 'Linux' ]]; then - export PRE_DISTS='dist/*.whl' - rename 's/linux_x86_64/any/;' $PRE_DISTS - fi - export DISTS='dist/*' - $(pwd)/mason_packages/.link/bin/twine upload -u $PYPI_USER -p $PYPI_PASSWORD $DISTS - fi - - -notifications: - slack: - secure: dZhYCFXTvn6zna7GhagCUcInfhoUf/AMkTpJKPnJgaGnS3DlfbnMsSU73J4hs46wCOFII3AfYUOI/SUEBZ15lkJHfBsCku0a5a2M8g5ddxKFoIM8gosH3dLjeGJ5Ou8zNQGyzokXidKfHC+Gh4UVGyn+aeXxglRmRkUeaP+GD1k= diff --git a/README.md b/README.md index bdcc1a0a6..81575254f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ - -[![Build Status](https://travis-ci.org/mapnik/python-mapnik.svg)](https://travis-ci.org/mapnik/python-mapnik) +[![Build Status](https://github.com/raven-wing/python-mapnik/actions/workflows/build.yml/badge.svg)](https://github.com/raven-wing/python-mapnik/actions) Python bindings for Mapnik. diff --git a/src/mapnik_image.cpp b/src/mapnik_image.cpp index 9add692c9..004b7405b 100644 --- a/src/mapnik_image.cpp +++ b/src/mapnik_image.cpp @@ -47,7 +47,7 @@ #define PYCAIRO_NO_IMPORT #include #else -#include +#include #endif #include #endif diff --git a/src/mapnik_python.cpp b/src/mapnik_python.cpp index 14523b034..69bb489af 100644 --- a/src/mapnik_python.cpp +++ b/src/mapnik_python.cpp @@ -146,7 +146,7 @@ void clear_cache() #if PY_MAJOR_VERSION >= 3 #include #else -#include +#include static Pycairo_CAPI_t *Pycairo_CAPI; #endif