Skip to content

Remove placeholder edges from the flow network #295

Remove placeholder edges from the flow network

Remove placeholder edges from the flow network #295

Workflow file for this run

name: CI
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
jobs:
format-check:
name: Format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check for C/C++ programs
uses: jidicula/[email protected]
with:
clang-format-version: '14'
debug-build:
runs-on: ubuntu-latest
env:
snapshot_version: v1.3.0
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install OpenMP
run: sudo apt update && sudo apt install -y libomp-dev
- name: Install GDAL
run: sudo apt update && sudo apt install libgdal-dev
- name: Install doxygen
run: |
sudo apt update
sudo apt install doxygen
- name: Install Python build dependencies
run: |
pip install -r ${{github.workspace}}/docs/requirements.txt
- name: Cache snapshot data
id: cache-snapshots-debug
uses: actions/cache@v4
with:
path: test/snapshots
key: snapshots-${{ env.snapshot_version }}
- name: Download and extract snapshot data
if: steps.cache-snapshots-debug.outputs.cache-hit != 'true'
working-directory: test/snapshots
shell: bash
run: |
curl -L -o snapshot_data.tar.gz \
"https://github.com/TopoToolbox/snapshot_data/releases/download/$snapshot_version/snapshot_data.tar.gz"
tar -xzf snapshot_data.tar.gz
shasum -c --status sha256sum.txt
- name: Configure
run: >
cmake -B ${{github.workspace}}/build/debug
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DTT_BUILD_TESTS=ON
-DBUILD_SHARED_LIBS=OFF
-DTT_SANITIZE=ON
-DTT_BUILD_DOCS=ON
- name: Build library
run: cmake --build ${{github.workspace}}/build/debug --config Debug
- name: Test
run: ctest --test-dir ${{github.workspace}}/build/debug -C Debug --output-on-failure
- name: Upload test snapshot artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: snapshot_test_output
path: ${{github.workspace}}/build/debug/test/snapshots/
release-build:
runs-on: ${{ matrix.os }}
env:
snapshot_version: v1.3.0
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
c_compiler: [gcc, clang, cl]
include:
- c_compiler: gcc
cpp_compiler: g++
- c_compiler: clang
cpp_compiler: clang++
- c_compiler: cl
cpp_compiler: cl
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: macos-latest
c_compiler: cl
- os: macos-latest
c_compiler: gcc
- os: ubuntu-latest
c_compiler: cl
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install OpenMP on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: sudo apt update && sudo apt-get install -y libomp-dev
- name: Install OpenMP on macOS
if: matrix.os == 'macos-latest'
run: brew install libomp
- name: Set OpenMP_ROOT on macOS
if: matrix.os == 'macos-latest'
run: echo "OpenMP_ROOT=$(brew --prefix)/opt/libomp" >> $GITHUB_ENV
- name: Install GDAL on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: sudo apt update && sudo apt install libgdal-dev
## TODO: Install GDAL on Windows and macos
- name: Install ninja on windows
uses: seanmiddleditch/gha-setup-ninja@master
if: matrix.os == 'windows-latest'
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest'
- name: Set environment variables on Windows
if: matrix.os == 'windows-latest'
run: |
echo "CMAKE_GENERATOR=Ninja" >> "$env:GITHUB_ENV" &&
echo "CMAKE_CONFIGURATION_TYPES=Release" >> "$env:GITHUB_ENV"
- name: Cache snapshot data
if: matrix.os == 'ubuntu-latest'
id: cache-snapshots-release
uses: actions/cache@v4
with:
path: test/snapshots
key: snapshots-${{ env.snapshot_version }}
- name: Download and extract snapshot data
if: matrix.os == 'ubuntu-latest' && steps.cache-snapshots-release.outputs.cache-hit != 'true'
working-directory: test/snapshots
shell: bash
run: |
curl -L -o snapshot_data.tar.gz \
"https://github.com/TopoToolbox/snapshot_data/releases/download/$snapshot_version/snapshot_data.tar.gz"
tar -xzf snapshot_data.tar.gz
shasum -c --status sha256sum.txt
- name: Configure static library
run: >
cmake -B ${{github.workspace}}/build/static
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER=${{matrix.c_compiler}}
-DCMAKE_CXX_COMPILER=${{matrix.cpp_compiler}}
-DTT_BUILD_TESTS=ON
-DBUILD_SHARED_LIBS=OFF
--profiling-format=google-trace
--profiling-output ${{matrix.os}}_${{matrix.c_compiler}}_config_profile.json
- name: Build static library
run: cmake --build ${{github.workspace}}/build/static --config Release
- name: Test static library
run: ctest --test-dir ${{github.workspace}}/build/static -C Release --output-on-failure
- name: Validate JSON output of profiler
run: ${{github.workspace}}/build/static/test/random_dem | jq -e .
- name: Configure shared library
run: >
cmake -B ${{github.workspace}}/build/shared
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER=${{matrix.c_compiler}}
-DCMAKE_CXX_COMPILER=${{matrix.cpp_compiler}}
-DTT_BUILD_TESTS=ON
-DBUILD_SHARED_LIBS=ON
-DTT_SANITIZE=OFF
- name: Build shared library
run: cmake --build ${{github.workspace}}/build/shared --config Release
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{matrix.os}}_${{matrix.c_compiler}}_cmake_profiles
path: ${{matrix.os}}_${{matrix.c_compiler}}_config_profile.json