From b84685e68907a76688be589f28700977e8794049 Mon Sep 17 00:00:00 2001 From: Krzysztof Date: Thu, 31 Mar 2022 21:16:20 +0200 Subject: [PATCH 1/3] created github actions --- .github/workflows/build.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..9b58267ab --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,29 @@ +name: Publish Python distributions to PyPI and TestPyPI +env: + BOOST_PYTHON_LIB: boost_python + BOOST_SYSTEM_LIB: boost_system + MASON_BUILD: true +on: [push, pull_request] +jobs: + build-n-publish: + runs-on: ubuntu-20.04 + name: Build and publish Python distribution + steps: + - uses: actions/checkout@v3 + - name: install dependencies + run: | + sudo apt-get install libboost-python-dev + - name: Initialize Python 2.7 + uses: actions/setup-python@v3 + with: + python-version: 2.7 + - name: Build binary wheel and a source tarball + run: | + pip install wheel + python setup.py sdist bdist_wheel + - uses: actions/upload-artifact@v2 + with: + path: ./dist/*.whl + - name: Run tests + run: | + python setup.py test From 10b955c917c89c36e4adf94a6637a6cbd7ba67db Mon Sep 17 00:00:00 2001 From: Krzysztof Date: Mon, 4 Apr 2022 00:49:29 +0200 Subject: [PATCH 2/3] created github actions --- .github/workflows/build.yml | 52 +++++++++++++++++---- .travis.yml | 93 ------------------------------------- README.md | 3 +- src/mapnik_image.cpp | 2 +- src/mapnik_python.cpp | 2 +- 5 files changed, 45 insertions(+), 107 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9b58267ab..120d6005c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,28 +2,60 @@ 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-n-publish: - runs-on: ubuntu-20.04 + 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 - - name: Initialize Python 2.7 + 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: 2.7 + python-version: ${{ matrix.python-version }} - name: Build binary wheel and a source tarball run: | - pip install wheel + pip install wheel pycairo nose PyPDF2 python setup.py sdist bdist_wheel - - uses: actions/upload-artifact@v2 - with: - path: ./dist/*.whl - name: Run tests run: | - python setup.py test + 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 From 20c800e7a51d425bb7795f2ad90cbd511a6d7f07 Mon Sep 17 00:00:00 2001 From: ravenwing Date: Mon, 4 Apr 2022 09:55:36 +0200 Subject: [PATCH 3/3] Changed name of uploaded artifacts --- .github/workflows/build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 120d6005c..e82224f6e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,7 @@ jobs: - 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}} + - name: Initialize Python ${{ matrix.python-version }} uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} @@ -48,8 +48,6 @@ jobs: 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 @@ -57,5 +55,5 @@ jobs: ./mason_packages/.link/bin/pg_ctl -w stop - uses: actions/upload-artifact@v3 with: - name: python_{{ matrix.python-version }}-${{matrix.system}} + name: python_${{ matrix.python-version }}-${{matrix.system}} path: ./dist/*.whl