diff --git a/.github/workflows/conda.yaml b/.github/workflows/conda.yaml new file mode 100644 index 00000000..d2074cbc --- /dev/null +++ b/.github/workflows/conda.yaml @@ -0,0 +1,72 @@ +name: Conda + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +on: push + +jobs: + + Update-conda-package-version: + + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Set Env variable with project version + run: | + echo "VERSION=$(grep "project(" CMakeLists.txt | grep -E -o -e "[0-9\.]+")" >> $GITHUB_ENV + + - name: Print project version + run: | + echo "Project version: $VERSION" + + - name: Update conda package version + run: | + sed -i '/version: /c\ version: \"'$VERSION'\"' conda/meta.yaml + + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Change to conda package version + file_pattern: 'conda/meta.yaml' + + # build: + # needs: Update-conda-package-version + + # runs-on: ubuntu-latest + + # defaults: + # run: + # shell: bash -l {0} + + # permissions: + # contents: write + + # env: + # CONDA_PKG_DIR: ~/conda_pkgs_dir + # GH_TOKEN: ${{ github.token }} + + # steps: + + # - name: Checkout + # uses: actions/checkout@v4 + + # - name: Setup conda + # uses: conda-incubator/setup-miniconda@v3 + # with: + # use-mamba: true + # python-version: 3.12 + # environment-file: conda/conda-env.yaml + # activate-environment: dev-viewshed + + # - name: Build library + # run: | + # conda build conda diff --git a/.github/workflows/create_releases.yaml b/.github/workflows/create_releases.yaml index aed9464a..f3a5776a 100644 --- a/.github/workflows/create_releases.yaml +++ b/.github/workflows/create_releases.yaml @@ -1,4 +1,8 @@ -name: Prepare Deb Release, Docker Release, Release to PPA +name: Prepare Deb Release, Docker Release + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true on: workflow_run: diff --git a/.github/workflows/test_library.yaml b/.github/workflows/test_library.yaml index 7614a0e4..4855d5cb 100644 --- a/.github/workflows/test_library.yaml +++ b/.github/workflows/test_library.yaml @@ -1,5 +1,10 @@ name: Tests for Library +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + + on: [push, pull_request] env: @@ -9,7 +14,7 @@ jobs: Tests-Viewshed-library: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: DEBIAN_FRONTEND: "noninteractive" @@ -97,17 +102,51 @@ jobs: cmake --build build --config Release --target build_tests cmake --build build --config Release --target run_tests - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: - version: '5.15.2' - host: 'linux' - - - name: Clean Build + Tests-Viewshed-library-with-Qt: + + runs-on: ubuntu-22.04 + + env: + DEBIAN_FRONTEND: "noninteractive" + QT_QPA_PLATFORM: "offscreen" + XDG_RUNTIME_DIR: "/tmp" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + steps: + + - name: Update and Upgrade run: | - rm -rf build - mkdir build + sudo apt update + sudo apt install ninja-build doxygen libgtest-dev libgmock-dev clang + + - name: Install GDAL + run: | + sudo add-apt-repository ppa:ubuntugis/ppa + sudo apt update + sudo apt-get -y install gdal-bin libgdal-dev + - uses: robinraju/release-downloader@v1 + with: + repository: "JanCaha/cpp-simplerasters" + latest: true + fileName: "*.deb" + tarBall: false + zipBall: false + + - name: Install and remove artifact + run: | + sudo apt install ./simplerasters*.deb + rm simplerasters* + + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + + - name: Install Qt + run: | + sudo apt install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools + - name: Configure run: | cmake \ @@ -134,6 +173,4 @@ jobs: - name: Test Install run: | cmake --build build --config Release --target all - sudo cmake --build build --config Release --target install - - + sudo cmake --build build --config Release --target install \ No newline at end of file diff --git a/conda/meta.yaml b/conda/meta.yaml new file mode 100644 index 00000000..2aeba8a6 --- /dev/null +++ b/conda/meta.yaml @@ -0,0 +1,37 @@ +package: + name: libviewshed + version: "4.1.0" + +source: + path: .. + +build: + number: 0 + script: + - cmake -B build -S {{SRC_DIR}} -G Ninja -DCMAKE_BUILD_TYPE=Release -DPACK_DEB:bool=off -DBUILD_DOCUMENTATION:bool=off -DBUILD_TESTS:bool=off -DCELL_EVENT_DATA_FLOAT:bool=on -DOUTPUT_RASTER_DATA_FLOAT:bool=on -DNEEDS_QT:bool=off + - cmake --build build --config Release + - cmake --install build --prefix {{PREFIX}} + +requirements: + build: + - { { compiler('c') } } + - { { compiler('cxx') } } + host: + - cmake + - ninja + - libgdal + - libsimplerasters + run: + - libgdal + - libsimplerasters + +about: + home: https://github.com/JanCaha/cpp-viewshed-library + license: MIT + summary: "C++ Viewshed library based on GDAL and Qt" + +extra: + recipe-maintainers: + - JanCaha + channels: + - conda-forge