Skip to content

Commit

Permalink
CMake modernization, automate release generation from tags and refact…
Browse files Browse the repository at this point in the history
…or CI (#115)

* CMake: Bumps the minimum CMake version to 3.13
* CMake: Add BUILD_SHARED_LIBS matrix for ON and OFF using similar config for macos-latest, windows-latest, and ubuntu-latest
* CMake: Modernize CMake configuration to prevent flag/feature leaking
* CMake: Adds CPack configuration so `package_source` target is available for dist generation
* CMake: Updates FindPROJ.cmake with GDAL's recent version
* CMake: add BUILD_MAN and BUILD_DOC options
* CMake: Windows PDB install with BUILD_SHARED_LIBS
* CMake: Remove FindGeoTIFF.cmake
* Removes 16 year old dead `makefile.mpw`
* Removes 6 year old dead `makefile.vc`
* CI: Generates release artifacts and attaches them to every build
* CI: Creates a release and attaches release artifacts for every tag of the OSGeo/libgeotiff repository
* CI: [Attests](https://github.com/actions/attest-build-provenance) the release artifacts if the `github.repository_owner == OSGeo`
* CI: Remove Appveyor config
  • Loading branch information
hobu authored May 28, 2024
1 parent d2c72db commit ff1f6d8
Show file tree
Hide file tree
Showing 13 changed files with 423 additions and 622 deletions.
69 changes: 0 additions & 69 deletions .appveyor.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: build
channels:
- conda-forge
dependencies:
- conda
- mamba
- compilers
- ninja
- cmake
- proj
- ccache
- libtiff
- zlib
- libjpeg-turbo

78 changes: 0 additions & 78 deletions .github/workflows/ci-windows.yml

This file was deleted.

134 changes: 134 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@

name: Build
on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
build:
name: ${{ matrix.os }} with BUILD_SHARED_LIBS=${{matrix.shared}}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
shared: [ON, OFF]
permissions:
contents: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest'
- name: Support longpaths
run: git config --system core.longpaths true
if: matrix.os == 'windows-latest'
- uses: mamba-org/setup-micromamba@v1
with:
init-shell: bash
environment-file: ./.github/environment.yml
environment-name: "build"
cache-environment: true
cache-downloads: true

- name: Setup
shell: bash -l {0}
run: |
mkdir build
working-directory: ./libgeotiff

- name: CMake
shell: bash -l {0}
env:
BUILD_SHARED_LIBS: ${{ matrix.shared }}

run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export CC=cl.exe
export CXX=cl.exe
fi
cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS \
-DBUILD_TESTING=ON \
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DWITH_ZLIB=ON \
-DWITH_JPEG=ON \
-DWITH_TIFF=ON \
-DTIFF_NAMES=tiff \
-DPROJ_NAMES=proj \
-DJPEG_NAMES=libjpeg \
..
working-directory: ./libgeotiff/build

- name: Compile
shell: bash -l {0}
run: |
ninja
working-directory: ./libgeotiff/build

- name: Generate source distribution
shell: bash -l {0}
if: matrix.os == 'ubuntu-latest'
run: |
cmake --build . --config Release --target package_source
extensions=".tar.gz .tar.bz2"
for ext in $extensions
do
for filename in $(ls *$ext)
do
`md5sum $filename > $filename.md5`
`sha256sum $filename > $filename.sha256sum`
`sha512sum $filename > $filename.sha512sum`
done
done
working-directory: ./libgeotiff/build
- name: Attest
uses: actions/attest-build-provenance@v1
if: matrix.os == 'ubuntu-latest' && matrix.shared == 'ON' && startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'OSGeo'
with:
subject-path: './libgeotiff/build/libgeotiff-*'
- uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest' && matrix.shared == 'ON'
name: Gather source distribution artifact
with:
name: source-package-${{matrix.os}}
if-no-files-found: error
path: |
./libgeotiff/build/libgeotiff-*
release:
name: Gather and attach release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/download-artifact@v4
name: Download release artifact
with:
name: source-package-ubuntu-latest
path: release

- uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
name: Publish release as draft
with:
make_latest: false
fail_on_unmatched_files: true
prerelease: true
generate_release_notes: true
draft: true
files: |
release/libgeotiff-*
Loading

0 comments on commit ff1f6d8

Please sign in to comment.