diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 120000 index 0000000..2aac66e --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1 @@ +../package/ci/circleci.yml \ No newline at end of file diff --git a/package/ci/circleci.yml b/package/ci/circleci.yml new file mode 100644 index 0000000..7092116 --- /dev/null +++ b/package/ci/circleci.yml @@ -0,0 +1,281 @@ +version: 2.1 + +orbs: + codecov: codecov/codecov@1.1.1 + +notify: + webhooks: + # Unfortunately Gitter messages are too verbose (one five-line message per + # each job in the build matrix) and thus not wanted + #- url: https://webhooks.gitter.im/e/cfbadbd34d28708a57c6 + +executors: + ubuntu-16_04: + docker: + - image: ubuntu:xenial-20201014 + xcode-10_3: + macos: + xcode: 10.3.0 + +commands: + install-base-linux: + parameters: + extra: + type: string + default: "" + steps: + - run: + name: Update apt and install base packages + # Git is needed always for cloning Corrade etc + command: | + apt update + if [[ "$CMAKE_CXX_FLAGS" == *"--coverage"* ]]; then export LCOV_PACKAGES="lcov curl"; fi + apt install -y git ninja-build $LCOV_PACKAGES << parameters.extra >> + + install-base-macos: + parameters: + extra: + type: string + default: "" + steps: + - run: + name: Install base packages + # As usual, homebrew takes five minutes to update and then explodes in + # a spectacular way. How is this acceptable?! + command: | + if [[ "$CMAKE_CXX_FLAGS" == *"--coverage"* ]]; then export LCOV_PACKAGES="lcov"; fi + HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake ninja $LCOV_PACKAGES << parameters.extra >> + + install-gcc-4_8: + steps: + - run: + name: Install GCC 4.8 + # For some reason, CMake needs a working C compiler, so provice CC as + # well for the case when default gcc isn't installed. + command: | + apt install -y g++-4.8 + echo 'export CC=gcc-4.8' >> $BASH_ENV + echo 'export CXX=g++-4.8' >> $BASH_ENV + + install-cmake-3_4: + steps: + - run: + name: Install CMake 3.4 + command: | + apt install -y wget + mkdir -p $HOME/cmake && cd $HOME/cmake + wget -nc --no-check-certificate https://cmake.org/files/v3.4/cmake-3.4.3-Linux-x86_64.tar.gz + tar --strip-components=1 -xzf cmake-3.4.3-Linux-x86_64.tar.gz + echo 'export PATH=$HOME/cmake/bin:$PATH' >> $BASH_ENV + source $BASH_ENV && cmake --version | grep 3.4 + + install-python-3_6: + # Can't use the python3.6 docker image because there I can't install GCC + # 4.8. Loosely based on https://gist.github.com/monkut/c4c07059444fd06f3f8661e13ccac619 + steps: + - run: + name: Install Python 3.6 and numpy + # The software-properties-common need to be installed in order to have + # apt-add-repository. Sigh, adding a repository should be a core + # feature ffs! + # + # Also, "Press ENTER to continue." Are we still in the DOS days?! + # + # Setting up 3.6 as the default is OF COURSE one command more than + # would be acceptable, but am I surprised on this distro?! + command: | + apt install -y software-properties-common + echo -e "\n" | add-apt-repository ppa:deadsnakes/ppa + apt update + apt install -y python3.6 python3.6-dev python3-pip + + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 10 + + python3 --version | grep 3.6 + + python3 -m pip install pip --upgrade + python3 -m pip install wheel + + pip3 install numpy + + install-pybind11: + steps: + - run: + name: Install Pybind11 + command: | + cd $HOME + export PYBIND_VERSION=2.3.0 + wget --no-clobber https://github.com/pybind/pybind11/archive/v$PYBIND_VERSION.tar.gz + tar -xzf v$PYBIND_VERSION.tar.gz + cd pybind11-$PYBIND_VERSION + mkdir -p build && cd build + cmake .. \ + -DCMAKE_INSTALL_PREFIX=$HOME/pybind11 \ + -DPYBIND11_PYTHON_VERSION=3.6 \ + -DPYBIND11_TEST=OFF \ + -G Ninja + ninja install + + install-swiftshader-gles: + parameters: + build: + type: string + steps: + - run: + name: Install SwiftShader GLES + # Zip from https://github.com/mosra/magnum-ci/tree/swiftshader and + # self-hosted because GH Actions would make it too simple for people if + # you could just download the artifacts directly, right? RIGHT? + command: | + mkdir -p $HOME/swiftshader && cd $HOME/swiftshader + wget https://ci.magnum.graphics/swiftshader-gles-r5464.a6940c8e6e-<< parameters.build >>.zip + unzip swiftshader-gles-r5464.a6940c8e6e-<< parameters.build >>.zip + + build: + parameters: + script: + type: string + steps: + - run: + name: Install coverage and codecov + command: pip3 install coverage codecov + - checkout + - run: + name: Build & test + command: | + if [ "$BUILD_STATIC" != "ON" ]; then export BUILD_STATIC=OFF; fi + if [ "$BUILD_DEPRECATED" != "OFF" ]; then export BUILD_DEPRECATED=ON; fi + ./package/ci/<< parameters.script >> + + lcov: + steps: + - run: + name: Collect code coverage + # Keep in sync with PKBUILD-coverage and travis.yml, please + command: | + lcov $LCOV_EXTRA_OPTS --directory . --capture --output-file coverage.info > /dev/null + lcov $LCOV_EXTRA_OPTS --extract coverage.info "*/src/python/*" "*/src/Corrade/*" "*/src/Magnum/*" --output-file coverage.info > /dev/null + cd src/python && coverage combine + - codecov/upload: + file: coverage.info + +jobs: + linux-gl: + executor: ubuntu-16_04 + environment: + CMAKE_CXX_FLAGS: --coverage + LCOV_EXTRA_OPTS: --gcov-tool /usr/bin/gcov-4.8 + PLATFORM_GL_API: GLX + steps: + - install-base-linux: + extra: libgl1-mesa-dev libsdl2-dev libglfw3-dev + - install-gcc-4_8 + - install-cmake-3_4 + - install-python-3_6 + - install-pybind11 + - build: + script: unix-desktop.sh + - lcov + + linux-gles2: + executor: ubuntu-16_04 + environment: + CMAKE_CXX_FLAGS: --coverage + LCOV_EXTRA_OPTS: --gcov-tool /usr/bin/gcov-4.8 + PLATFORM_GL_API: EGL + # STUPID yml interprets unquoted ON as a boolean + TARGET_GLES2: "ON" + steps: + - install-base-linux: + extra: libsdl2-dev libglfw3-dev wget unzip + - install-gcc-4_8 + - install-cmake-3_4 + - install-python-3_6 + - install-pybind11 + - install-swiftshader-gles: + build: ubuntu-16.04 + - build: + script: unix-desktop-gles.sh + - lcov + + linux-gles3: + executor: ubuntu-16_04 + environment: + CMAKE_CXX_FLAGS: --coverage + LCOV_EXTRA_OPTS: --gcov-tool /usr/bin/gcov-4.8 + PLATFORM_GL_API: EGL + # STUPID yml interprets unquoted OFF as a boolean + TARGET_GLES2: "OFF" + steps: + - install-base-linux: + extra: libsdl2-dev libglfw3-dev wget unzip + - install-gcc-4_8 + - install-cmake-3_4 + - install-python-3_6 + - install-pybind11 + - install-swiftshader-gles: + build: ubuntu-16.04 + - build: + script: unix-desktop-gles.sh + - lcov + + linux-static: + executor: ubuntu-16_04 + environment: + # STUPID yml interprets unquoted ON as a boolean + # https://stackoverflow.com/questions/53648244/specifying-the-string-value-yes-in-a-yaml-property + BUILD_STATIC: "ON" + CMAKE_CXX_FLAGS: --coverage + LCOV_EXTRA_OPTS: --gcov-tool /usr/bin/gcov-4.8 + PLATFORM_GL_API: GLX + steps: + - install-base-linux: + extra: libsdl2-dev libglfw3-dev + - install-gcc-4_8 + - install-cmake-3_4 + - install-python-3_6 + - install-pybind11 + - build: + script: unix-desktop.sh + - lcov + + macos-gl: + # 10.2 and below has pybind11 2.2, which is just too old (we removed + # support for that in aae98e0f02e927f993713afc154da1f3673ebb3e, July 2019) + executor: xcode-10_3 + environment: + CMAKE_CXX_FLAGS: --coverage + PLATFORM_GL_API: CGL + steps: + - install-base-macos: + extra: sdl2 glfw numpy pybind11 + - build: + script: unix-desktop.sh + - lcov + + macos-static: + # 10.2 and below has pybind11 2.2, which is just too old (we removed + # support for that in aae98e0f02e927f993713afc154da1f3673ebb3e, July 2019) + executor: xcode-10_3 + environment: + # STUPID yml interprets unquoted ON as a boolean + BUILD_STATIC: "ON" + CMAKE_CXX_FLAGS: --coverage + PLATFORM_GL_API: CGL + steps: + - install-base-macos: + extra: sdl2 glfw numpy pybind11 + - build: + script: unix-desktop.sh + - lcov + +workflows: + version: 2 + build: + jobs: + - linux-gl + - linux-gles2 + - linux-gles3 + - linux-static + - macos-gl + - macos-static diff --git a/package/ci/codecov.yml b/package/ci/codecov.yml index ff3e2a6..5f3e91b 100644 --- a/package/ci/codecov.yml +++ b/package/ci/codecov.yml @@ -1,9 +1,12 @@ fixes: # The src/python/magnum/__init__.py is copied to cmake's build dir together -# with # setup.py next to the C++ binaries and the test is done from here. +# with setup.py next to the C++ binaries and the test is done from here. # Python's coverage.py reports an absolute path to it, which means a simple -# "build/src/python/::src/python/" won't suffice. This is hardcoded to Travis -# Linux / macOS and AppVeyor build paths so let's hope these won't change. +# "build/src/python/::src/python/" won't suffice. This is hardcoded to Travis, +# CircleCI Linux / macOS and AppVeyor build paths so let's hope these won't +# change. - "/home/travis/build/mosra/magnum-bindings/build/src/python/::src/python/" - "/Users/travis/build/mosra/magnum-bindings/build/src/python/::src/python/" +- "/root/project/build/src/python/::src/python/" +- "/Users/distiller/project/build/src/python/::src/python/" - "C:/projects/magnum-bindings/build/src/python/::src/python/" diff --git a/package/ci/setup-pybind11.sh b/package/ci/setup-pybind11.sh deleted file mode 100755 index 553d896..0000000 --- a/package/ci/setup-pybind11.sh +++ /dev/null @@ -1,13 +0,0 @@ -set -e - -wget --no-clobber https://github.com/pybind/pybind11/archive/v2.3.0.tar.gz && tar -xzf v2.3.0.tar.gz - -cd pybind11-2.3.0 - -mkdir -p build && cd build -cmake .. \ - -DCMAKE_INSTALL_PREFIX=$HOME/pybind11 \ - -DPYBIND11_PYTHON_VERSION=3.6 \ - -DPYBIND11_TEST=OFF \ - -G Ninja -ninja install diff --git a/package/ci/travis.yml b/package/ci/travis.yml index 37a7e32..1717bc2 100644 --- a/package/ci/travis.yml +++ b/package/ci/travis.yml @@ -106,7 +106,6 @@ cache: install: - if [ "$TRAVIS_OS_NAME" == "linux" ]; then export CXX=g++-4.8; fi - if [ "$BUILD_STATIC" != "ON" ]; then export BUILD_STATIC=OFF; fi -- if [ "$BUILD_STATIC" == "ON" ]; then export STATIC_PLUGIN_PATH=-DMAGNUM_PLUGINS_DIR=$HOME/deps/lib/magnum; fi - if [ "$TRAVIS_OS_NAME" == "linux" ] && ( [ "$TARGET" == "desktop" ] || [ "$TARGET" == "desktop-sanitizers" ] ); then export PLATFORM_GL_API=GLX; fi - if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop-gles" ]; then export PLATFORM_GL_API=EGL; fi # Download CMake 3.4.3 to ensure we're still compatible with it (Travis has @@ -144,13 +143,13 @@ install: - if [ "$TRAVIS_OS_NAME" == "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install lcov; fi script: -- if [ "$TARGET" == "desktop" ] && ( [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ] ); then ./package/ci/travis-desktop.sh; fi -- if [ "$TARGET" == "desktop-gles" ] && ( [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ] ); then ./package/ci/travis-desktop-gles.sh; fi +- if [ "$TARGET" == "desktop" ] && ( [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ] ); then ./package/ci/unix-desktop.sh; fi +- if [ "$TARGET" == "desktop-gles" ] && ( [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ] ); then ./package/ci/unix-desktop-gles.sh; fi # Travis somehow is not able to gather all output, try to force it using this - sync after_success: -# Keep in sync with package/archlinux/PKGBUILD-coverage, please +# Keep in sync with PKGBUILD-coverage and codecov.yml, please - if [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ]; then lcov $LCOV_EXTRA_OPTS --directory . --capture --output-file coverage.info > /dev/null; fi - if [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ]; then lcov $LCOV_EXTRA_OPTS --extract coverage.info "*/src/python/*" "*/src/Corrade/*" "*/src/Magnum/*" --output-file coverage.info; fi diff --git a/package/ci/travis-desktop-gles.sh b/package/ci/unix-desktop-gles.sh similarity index 77% rename from package/ci/travis-desktop-gles.sh rename to package/ci/unix-desktop-gles.sh index dace356..fe68707 100755 --- a/package/ci/travis-desktop-gles.sh +++ b/package/ci/unix-desktop-gles.sh @@ -26,10 +26,8 @@ cmake .. \ -DCMAKE_INSTALL_RPATH=$HOME/deps/lib \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_DEPRECATED=OFF \ - -DEGL_LIBRARY=$HOME/swiftshader/libEGL.so \ - -DOPENGLES2_LIBRARY=$HOME/swiftshader/libGLESv2.so \ - -DOPENGLES3_LIBRARY=$HOME/swiftshader/libGLESv2.so \ - -DCMAKE_INSTALL_RPATH=$HOME/swiftshader \ + -DCMAKE_PREFIX_PATH="$HOME/swiftshader;$HOME/pybind11" \ + -DCMAKE_INSTALL_RPATH=$HOME/swiftshader/lib \ -DTARGET_GLES=ON \ -DTARGET_GLES2=$TARGET_GLES2 \ -DWITH_AUDIO=OFF \ @@ -71,11 +69,8 @@ cmake .. \ -DCMAKE_CXX_FLAGS="--coverage" \ -DCMAKE_INSTALL_PREFIX=$HOME/deps \ -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_PREFIX_PATH=$HOME/pybind11 \ - -DEGL_LIBRARY=$HOME/swiftshader/libEGL.so \ - -DOPENGLES2_LIBRARY=$HOME/swiftshader/libGLESv2.so \ - -DOPENGLES3_LIBRARY=$HOME/swiftshader/libGLESv2.so \ - -DCMAKE_INSTALL_RPATH=$HOME/swiftshader \ + -DCMAKE_PREFIX_PATH="$HOME/swiftshader;$HOME/pybind11" \ + -DCMAKE_INSTALL_RPATH=$HOME/swiftshader/lib \ -DPYBIND11_PYTHON_VERSION=3.6 \ -DWITH_PYTHON=ON \ -DBUILD_TESTS=ON \ @@ -86,7 +81,7 @@ CORRADE_TEST_COLOR=ON ctest -V # Verify the setuptools install cd src/python -python3 setup.py install --root="$TRAVIS_BUILD_DIR/install" --prefix=/usr +python3 setup.py install --root="$CIRCLE_WORKING_DIRECTORY/install" --prefix=/usr # Run tests & gather coverage cd ../../../src/python/corrade @@ -99,4 +94,4 @@ cp .coverage ../.coverage.magnum # Test docstring validity cd ../../../doc/python -PYTHONPATH="$TRAVIS_BUILD_DIR/build/src/python" python3 -m doctest -v *.rst +PYTHONPATH="$CIRCLE_WORKING_DIRECTORY/build/src/python" python3 -m doctest -v *.rst diff --git a/package/ci/travis-desktop.sh b/package/ci/unix-desktop.sh similarity index 84% rename from package/ci/travis-desktop.sh rename to package/ci/unix-desktop.sh index 6eae6c9..63c9330 100755 --- a/package/ci/travis-desktop.sh +++ b/package/ci/unix-desktop.sh @@ -27,7 +27,7 @@ cmake .. \ -DCMAKE_INSTALL_RPATH=$HOME/deps/lib \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_DEPRECATED=OFF \ - -DBUILD_STATIC=$BUILD_STATIC $STATIC_PLUGIN_PATH \ + -DBUILD_STATIC=$BUILD_STATIC \ -DWITH_AUDIO=OFF \ -DWITH_DEBUGTOOLS=OFF \ -DWITH_GL=ON \ @@ -44,6 +44,13 @@ cmake .. \ -DWITH_WINDOWLESS${PLATFORM_GL_API}APPLICATION=ON \ -DWITH_ANYIMAGEIMPORTER=ON \ -G Ninja + +# In case of a static build there's no way for the test to know the plugin +# install directory so we have to hardcode it +if [ "$BUILD_STATIC" == "ON" ]; then + cmake . -DMAGNUM_PLUGINS_DIR=$HOME/deps/lib/magnum +fi + ninja install cd ../.. @@ -80,7 +87,7 @@ CORRADE_TEST_COLOR=ON ctest -V # Verify the setuptools install cd src/python -python3 setup.py install --root="$TRAVIS_BUILD_DIR/install" --prefix=/usr +python3 setup.py install --root="$CIRCLE_WORKING_DIRECTORY/install" --prefix=/usr # Run tests & gather coverage cd ../../../src/python/corrade @@ -93,4 +100,4 @@ cp .coverage ../.coverage.magnum # Test docstring validity cd ../../../doc/python -PYTHONPATH="$TRAVIS_BUILD_DIR/build/src/python" python3 -m doctest -v *.rst +PYTHONPATH="$CIRCLE_WORKING_DIRECTORY/build/src/python" python3 -m doctest -v *.rst