Merge pull request #1182 from fabratu/20240201_fix_build_wheels #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################################################## | |
# Build configurations | |
# ==================== | |
# | |
# full | |
# ---- | |
# Description: Basic build with all components (TLX, C++, Cython). Has to be tested on every fully | |
# supported platform. Close to user-experience, except that warnings are also treated | |
# as errors during build and TLX is provided as externally build library (normal | |
# installation builds both NetworKit and TLX in one step). | |
# Script: scripts/full.sh | |
# Build-type: Release | |
# Variants: native = Build for native architecture | |
# | |
# | |
# core | |
# ---- | |
# Description: Builds the C++ code into one shared library. Has also sanity checks and debugging. | |
# Since this only modifies the C++ building-process, Cython + Python-tests are removed in | |
# order to increase speed. | |
# Script: scripts/core.sh | |
# Build-type: Debug | |
# Variants: release = Release-build (only used on Windows, since "full" is not supported) | |
# native = Build for native architecture (only used on Windows, since "full" is not supported) | |
# non-monolithic = Each C++ module is a library | |
# C++20 = Check for (latest) C++20 conformance | |
# | |
# | |
# clang-tidy | |
# ---------- | |
# Description: Uses clang-tidy for several static analysis checks. These involve bug prone programming | |
# errors, possible modernizations and performance optiomizations. | |
# Script: scripts/clang_tidy.sh | |
# Config: .clang-tidy | |
# Build-type: Debug | |
# | |
# | |
# coverage | |
# -------- | |
# Description: Enables code-coverage, address- & leak-sanitizers and tests in order to create cpp-coveralls data. | |
# Script: scripts/core_sanitizers_coverage.sh | |
# Build type: Debug | |
# | |
# | |
# documentation: | |
# -------------- | |
# Description: Builds documentation of both C++ and Python-code. The result is automatically deployed | |
# when a pull request is merged. | |
# Script: scripts/documentation.sh | |
# Build-type: Debug | |
# | |
# | |
# Jobs: | |
# ===== | |
# 0. Rationale: | |
# - Main platform is Linux, which is therefore used for most of the tests. | |
# - Basic user experience (full) should be tested on all supported platforms (Linux, macOS, Windows) | |
# with the default compiler. | |
# - For further user-centric tests, "full (native)" should be tested with default compiler for | |
# vectorization support. | |
# - At least one debug build, so either core or one of its variants, should be done on each platform | |
# to check for problems like possible race conditions. | |
# - At least on one platform: code styling/static-analysis (clang-tidy, code-style), coverage, | |
# documentation and all core-variants, minimum supported version of compilers / Python | |
# - Remark: Currently Windows does not support a full/native build, therefore core builds are used. | |
# | |
# 1. Linux: | |
# - Latest version (gcc/Python): full, full (native) | |
# - Latest version (clang/Python): core | |
# - Minimum version (gcc/Python, clang/Python): full | |
# - Additional: core (non-monolithic), core (C++20), clang-tidy, code-style, coverage, | |
# documentation | |
# | |
# 2. macOS: | |
# - Latest version (apple-clang): full, full (native) | |
# - Latest version (gcc/Python, clang/Python): core | |
# | |
# 3. Windows | |
# - Latest version (msvc): core, core (release), core (native) | |
# | |
# | |
# Job naming | |
# ========== | |
# <OS> [opt.]<OS-VERSION> (<COMPILER>, [opt.]<PYTHON VERSION>): <BUILD CONFIGURATION> | |
######################################################################################################## | |
name: build | |
on: [push, pull_request] | |
# Default parameters for all builds. | |
env: | |
OMP_NUM_THREADS: 2 | |
CXX_STANDARD: 17 | |
MONOLITH: ON | |
TLX_PATH: /home/runner/work/networkit/networkit/tlx | |
TLX_PATH_WIN: /d/a/networkit/networkit/tlx | |
NATIVE: OFF | |
jobs: | |
macos-build-latest-version-apple-clang: | |
name: "macOS ${{ matrix.os }} (apple-clang, CPython 3.12): ${{ matrix.build-configuration }}" | |
runs-on: macos-${{ matrix.os }} | |
env: | |
CC: cc | |
CXX: c++ | |
strategy: | |
matrix: | |
os: ['13'] | |
build-configuration: ['full', 'full (native)'] | |
steps: | |
- name: Install prerequisites | |
run: | | |
brew install libomp | |
brew install ninja | |
- name: Setup Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Checkout networkit | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Checkout tlx | |
uses: actions/checkout@v4 | |
with: | |
repository: tlx/tlx | |
path: tlx | |
- name: Prepare environment and run checks | |
run: ${{ github.workspace }}/.github/workflows/scripts/full.sh | |
shell: bash | |
env: | |
TLX_PATH: /Users/runner/work/networkit/networkit/tlx | |
NATIVE: ${{ matrix.os == 'full (native)' }} | |
macos-build-latest-version-misc: | |
name: "macOS ${{ matrix.os }} (${{ matrix.compiler }}): core" | |
runs-on: macos-${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ['13'] | |
compiler: ['clang-17', 'gcc-13'] | |
steps: | |
- name: Install prerequisites | |
run: | | |
brew install libomp | |
brew install ninja | |
- name: Install compiler llvm | |
if: matrix.compiler == 'clang-17' | |
run: | | |
brew reinstall llvm@17 | |
brew link --overwrite llvm@17 | |
- name: Install compiler gcc | |
if: matrix.compiler == 'gcc-13' | |
run: | | |
brew reinstall gcc@13 | |
brew link --overwrite gcc@13 | |
- name: Checkout networkit | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Prepare environment and run checks | |
run: ${{ github.workspace }}/.github/workflows/scripts/cpp_only.sh | |
shell: bash | |
env: | |
CC: ${{ matrix.compiler == 'clang-16' && '/usr/local/opt/llvm@17/bin/clang' || 'gcc-13' }} | |
CXX: ${{ matrix.compiler == 'clang-16' && '/usr/local/opt/llvm@17/bin/clang++' || 'g++-13' }} | |
linux-build-latest: | |
name: "Linux (gcc-12${{ startsWith(matrix.build-configuration, 'full') && ', CPython 3.12' || '' }}): ${{ matrix.build-configuration }}" | |
runs-on: ubuntu-22.04 | |
env: | |
CC: gcc-13 | |
CXX: g++-13 | |
strategy: | |
matrix: | |
build-configuration: ['full', 'full (native)', 'core (non-monolithic)', 'core (C++20)'] | |
steps: | |
- name: Install prerequisites | |
run: | | |
sudo add-apt-repository 'deb http://mirrors.kernel.org/ubuntu jammy main universe' | |
sudo apt-get update | |
sudo apt-get install ninja-build | |
- name: Setup Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Checkout networkit | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Checkout tlx | |
if: ${{ startsWith(matrix.build-configuration, 'full') }} | |
uses: actions/checkout@v4 | |
with: | |
repository: tlx/tlx | |
path: tlx | |
- name: Prepare environment and run checks | |
run: ${{ github.workspace }}/.github/workflows/scripts/$SCRIPT | |
shell: bash | |
env: | |
NATIVE: ${{ matrix.build-configuration == 'full (native)' }} | |
MONOLITH: ${{ matrix.build-configuration != 'core (non-monolithic)' }} | |
SCRIPT: ${{ startsWith(matrix.build-configuration, 'core') && 'cpp_only.sh' || 'full.sh'}} | |
CXX_STANDARD: ${{ matrix.build-configuration == 'core (C++20)' && '20' || env.CXX_STANDARD }} | |
linux-build-misc: | |
name: "Linux (${{ matrix.compiler }}): core" | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
compiler: ['clang-17'] | |
steps: | |
- name: Install prerequisites | |
run: | | |
curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
echo "deb http://apt.llvm.org/focal llvm-toolchain-focal-17 main" | sudo tee /etc/apt/sources.list.d/llvm17.list | |
sudo apt-get update | |
sudo apt-get install clang-17 libomp-17-dev ninja-build | |
- name: Checkout networkit | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Checkout tlx | |
uses: actions/checkout@v4 | |
with: | |
repository: tlx/tlx | |
path: tlx | |
- name: Prepare environment and run checks | |
run: ${{ github.workspace }}/.github/workflows/scripts/cpp_only.sh | |
shell: bash | |
env: | |
CC: clang-17 | |
CXX: clang++-17 | |
linux-pep-518-install: | |
name: "Linux: Release build using pyproject.toml" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout networkit | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Build and install NetworKit using pyproject.toml | |
run: pip install . | |
- name: Run minimal function test | |
run: | | |
mkdir ./tmp && cd ./tmp | |
python3 -c "import networkit" | |
linux-build-min-support: | |
name: "Linux (${{ matrix.compiler }}, CPython 3.8): full" | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
compiler: ['gcc-8', 'clang-7'] | |
steps: | |
- name: Install prerequisites | |
run: | | |
sudo apt-get update | |
sudo apt-get install ninja-build | |
sudo apt-get install clang-7 clang++-7 | |
sudo apt-get install gcc-8 g++-8 | |
- name: Setup Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8' | |
- name: Checkout networkit | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Checkout tlx | |
uses: actions/checkout@v4 | |
with: | |
repository: tlx/tlx | |
path: tlx | |
- name: Prepare environment and run checks | |
run: ${{ github.workspace }}/.github/workflows/scripts/full.sh | |
shell: bash | |
env: | |
CC: ${{ matrix.compiler == 'gcc-8' && 'gcc-8' || 'clang-7' }} | |
CXX: ${{ matrix.compiler == 'gcc-8' && 'g++-8' || 'clang++-7' }} | |
linux-build-clang-tidy: | |
name: "Linux (clang-16): clang-tidy" | |
runs-on: ubuntu-20.04 | |
env: | |
CC: clang-17 | |
CXX: clang++-17 | |
steps: | |
- name: Install prerequisites | |
run: | | |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc | |
echo "deb http://apt.llvm.org/focal llvm-toolchain-focal-17 main" | sudo tee /etc/apt/sources.list.d/llvm17.list | |
sudo apt-get update | |
sudo apt-get install python3.8 libomp-17-dev clang-17 clang-tidy-17 ninja-build | |
- name: Checkout networkit | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Prepare environment and run checks | |
run: ${{ github.workspace }}/.github/workflows/scripts/clang_tidy.sh | |
shell: bash | |
linux-build-core-sanitizers-coverage: | |
name: "Linux (gcc-10, CPython 3.12): coverage" | |
runs-on: ubuntu-20.04 | |
env: | |
CC: gcc-10 | |
CXX: g++-10 | |
COVERALLS_DUMP_FILE: coveralls.dump | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
COVERALLS_SVC_NUM: ${{ github.run_number }} | |
NETWORKIT_BUILD_TESTS: ON | |
steps: | |
- name: Install prerequisites | |
run: | | |
sudo apt-get update | |
sudo apt-get install ninja-build | |
- name: Setup Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Prepare environment and run checks | |
run: ${{ github.workspace }}/.github/workflows/scripts/core_sanitizers_coverage.sh | |
shell: bash | |
timeout-minutes: 180 | |
- name: Create C++ coverage | |
run: | | |
cd ${{ github.workspace }} | |
. pyenv/bin/activate | |
cd core_build | |
gcovr -e '.*test/.*' -e '.*CMakeFiles.*' -e '.*/extlibs/.*' -e '.*/scripts/.*' -e '.*/pyenv/.*' -e '.*/include/tlx/.*' --coveralls -r .. > networkit_cpp.json | |
gcovr -e '.*test/.*' -e '.*CMakeFiles.*' -e '.*/extlibs/.*' -e '.*/scripts/.*' -e '.*/pyenv/.*' -e '.*/include/tlx/.*' -r .. | |
- name: Create Python coverage and merge files | |
run: | | |
cd ${{ github.workspace }} | |
. pyenv/bin/activate | |
coverage run -m unittest discover -v networkit/test | |
coverage report | |
coveralls --merge=core_build/networkit_cpp.json --output=$COVERALLS_DUMP_FILE | |
- name: Upload coverage | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: | | |
cd ${{ github.workspace }} | |
. pyenv/bin/activate | |
python3 ${{ github.workspace }}/.github/workflows/scripts/upload_coverage.py | |
windows-build-msvc: | |
name: "Windows (msvc 14.38): ${{ matrix.build-configuration }}" | |
runs-on: windows-2022 | |
strategy: | |
matrix: | |
build-configuration: ['core'] | |
steps: | |
- name: Checkout networkit | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup devCmd (vstools) | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Prepare environment and run checks | |
shell: bash | |
run: | | |
mkdir build && cd build | |
cmake -GNinja -DNETWORKIT_STATIC=ON -DNETWORKIT_BUILD_TESTS=ON -DNETWORKIT_MONOLITH=ON -DNETWORKIT_CXX_STANDARD=${{ env.CXX_STANDARD }} -DNETWORKIT_WARNINGS=ON -DCMAKE_BUILD_TYPE=Debug -DNETWORKIT_SANITY_CHECKS=ON .. | |
ninja | |
ctest -V -C Debug | |
windows-build-latest: | |
name: "Windows (msvc 14.38, CPython 3.12): ${{ matrix.build-configuration }}" | |
runs-on: windows-2022 | |
strategy: | |
matrix: | |
build-configuration: ['full', 'full (native)'] | |
steps: | |
# Note: 3.12.X has no compatible numpy headers for Windows yet. | |
- name: Setup Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Checkout networkit | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Checkout tlx | |
uses: actions/checkout@v4 | |
with: | |
repository: tlx/tlx | |
path: tlx | |
- name: Setup devCmd (vstools) | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Prepare environment and run checks | |
shell: bash | |
run: | | |
cd tlx && mkdir build && cd build | |
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ env.TLX_PATH_WIN }} .. | |
ninja && ninja install | |
cd ../.. | |
python -m venv pyenv | |
. ./pyenv/Scripts/activate | |
pip install cython ipython ipywidgets==7.7.1 jupyter jupyterlab-widgets==1.1.1 numpy setuptools | |
mkdir build && cd build | |
cmake -GNinja -DNETWORKIT_BUILD_TESTS=ON -DNETWORKIT_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DNETWORKIT_CXX_STANDARD=${{ env.CXX_STANDARD }} -DNETWORKIT_WARNINGS=ON -DNETWORKIT_WARNINGS_AS_ERRORS=ON -DNETWORKIT_EXT_TLX=${{ env.TLX_PATH_WIN }} -DNETWORKIT_NATIVE=${{ env.NATIVE }} .. | |
ninja | |
ctest -V -C Release | |
cd .. | |
python setup.py build_ext --inplace --external-tlx=${{ env.TLX_PATH_WIN }} | |
pip install -e . | |
python -c 'import networkit' | |
pip install -r requirements.txt | |
python -m unittest discover -v networkit/test/ | |
pip install ipycytoscape plotly seaborn | |
python notebooks/test_notebooks.py "notebooks" | |
env: | |
NATIVE: ${{ matrix.os == 'full (native)' }} | |
documentation-build: | |
name: "Linux (gcc-11, CPython 3.12): documentation" | |
runs-on: ubuntu-20.04 | |
env: | |
CC: gcc-11 | |
CXX: g++-11 | |
steps: | |
- name: Install prerequisites | |
run: | | |
sudo add-apt-repository 'deb http://mirrors.kernel.org/ubuntu jammy main universe' | |
sudo apt-get update | |
sudo apt-get install gcc-11 g++-11 ninja-build | |
sudo apt-get install doxygen pandoc | |
- name: Setup Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Checkout networkit | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Prepare environment and run checks | |
id: build | |
continue-on-error: true | |
run: ${{ github.workspace }}/.github/workflows/scripts/documentation.sh | |
shell: bash | |
- name: Deploy networkit.github.io | |
if: steps.build.outcome == 'success' && github.event_name == 'push' && github.ref == 'refs/heads/master' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
personal_token: ${{ secrets.SECRET_DEPLOY_GITHUB_PAGES }} | |
external_repository: networkit/dev-docs | |
publish_branch: master | |
publish_dir: ./core_build/htmldocs | |
force_orphan: true | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
style-guide-compliance-build: | |
name: "Linux (default): code-style" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install prerequisites | |
run: | | |
curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
echo "deb http://apt.llvm.org/focal llvm-toolchain-focal-17 main" | sudo tee /etc/apt/sources.list.d/llvm17.list | |
sudo apt-get update | |
sudo apt-get install clang-format-17 python3-yaml | |
- name: Checkout networkit | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Prepare environment and run checks | |
run: | | |
set -e | |
./check_code.sh -v | |
env: | |
NETWORKIT_OVERRIDE_CLANG_FORMAT: "clang-format-17" |