Use FROM --platform=$BUILDPLATFORM xxx as builder; #109
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 CCGL library on native C++11 with GDAL and run test with CMake | |
name: Build with GDAL | |
on: | |
push: | |
paths-ignore: | |
#- 'doc/**' | |
pull_request: | |
paths-ignore: | |
#- 'doc/**' | |
workflow_dispatch: | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Debug | |
jobs: | |
build-linux-ubuntu: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout CCGL | |
uses: actions/checkout@v3 | |
- name: Install GDAL | |
run: sudo apt-get update && sudo apt-get install -qq gdal-bin libgdal-dev | |
- name: Configure CMake | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUNITTEST=1 | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- -j 4 | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure | |
build-windows: | |
runs-on: windows-2019 | |
steps: | |
- name: Checkout CCGL | |
uses: actions/checkout@v3 | |
- name: Download GDAL | |
id: pwshdowngdal | |
shell: pwsh | |
run: | | |
cd ${{github.workspace}}\.github\workflows | |
./download_gdal.ps1 -gdalPath ${{github.workspace}}\gdallib | |
Get-ChildItem Env: | Where-Object {$_.Name -Match "^GDAL"} | %{ echo "$($_.Name)=$($_.Value)" >> $env:GITHUB_ENV } | |
- name: Configure CMake | |
shell: cmd | |
run: | | |
cmake -G "Visual Studio 16 2019" -A x64 -B ${{github.workspace}}/build ^ | |
-DGDAL_ROOT=${{ env.GDAL_ROOT }} ^ | |
-DUNITTEST=1 | |
- name: Build | |
shell: cmd | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- /m:4 | |
- name: Test | |
shell: cmd | |
working-directory: ${{github.workspace}}/build | |
run: | | |
set PATH=${{ env.GDAL_BIN }};%PATH% | |
ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure | |
build-mac: | |
runs-on: macos-latest | |
steps: | |
- name: Setup xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
- name: Install GDAL | |
run: brew list gdal &>/dev/null || brew install gdal | |
- name: Checkout CCGL | |
uses: actions/checkout@v3 | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUNITTEST=1 | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- -j 4 | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure |