Skip to content

Commit

Permalink
Merge pull request #300 from Krakonos/gh-actions
Browse files Browse the repository at this point in the history
Updated and fixed gh actions builds
  • Loading branch information
Krakonos authored Sep 6, 2024
2 parents da76627 + d2c7011 commit 5509675
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 25 deletions.
53 changes: 38 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
steps:
- run: git config --global core.autocrlf input
shell: bash
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: msys2/setup-msys2@v2
Expand All @@ -22,6 +22,11 @@ jobs:
shell: msys2 {0}
run: |
./ci/travis-windows-script.sh
- uses: actions/upload-artifact@v4
name: Upload artifacts to github
with:
name: binaries-win64
path: build/merkaartor-*.exe
- name: Upload artifacts
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
Expand All @@ -32,33 +37,46 @@ jobs:
./build/upload-artifacts.sh
macosx:
runs-on: macos-latest
runs-on: macos-13
strategy:
matrix:
QT_MAJOR: [5, 6]
QT_MAJOR: [6]
name: MacOS X / Qt${{ matrix.QT_MAJOR }}
env:
QT_MAJOR: ${{ matrix.QT_MAJOR }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
channels: conda-forge,anaconda,defaults
auto-activate-base: true
- name: Conda info
shell: bash -el {0}
run: |
brew list
brew install gdal exiv2 proj qt${{ matrix.QT_MAJOR }} cmake inih
brew unlink exiv2
brew install --HEAD exiv2
brew link qt${{ matrix.QT_MAJOR }}
conda install gdal exiv2 proj qtbase=6.7.2 qttools qt5compat cmake pkg-config poppler # poppler is required for gdal, but missing as a dependency
git clone https://github.com/qt/qtnetworkauth.git && cd qtnetworkauth
git checkout v6.7.2
mkdir build && cd build
cmake ..
make install
- name: Build
shell: bash -el {0}
run: |
./ci/travis-osx-script.sh
- name: Upload artifacts
- uses: actions/upload-artifact@v4
name: Upload artifacts to github
with:
name: binaries-osx
path: build/merkaartor-*.dmg
- name: Upload artifacts to cloudsmith
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
if: (matrix.QT_MAJOR == 6) && (contains('refs/heads/master refs/heads/gh-actions', github.ref) || startsWith(github.ref, 'refs/tags/'))
run: |
pip3 install cloudsmith-cli
pip3 install cloudsmith-cli --break-system-packages
./build/upload-artifacts.sh
linux-qt5:
Expand All @@ -75,7 +93,7 @@ jobs:
SNAPSHOT: ${{ matrix.SNAPSHOT }}
CMAKE_UNITY_BUILD: ${{ matrix.CMAKE_UNITY_BUILD }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
Expand All @@ -96,7 +114,7 @@ jobs:
SNAPSHOT: ${{ matrix.SNAPSHOT }}
CMAKE_UNITY_BUILD: ${{ matrix.CMAKE_UNITY_BUILD }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
Expand All @@ -111,7 +129,7 @@ jobs:
runs-on: ubuntu-22.04
name: Linux / AppImage
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
Expand All @@ -127,6 +145,11 @@ jobs:
make -j3
make DESTDIR=AppDir install
appimage-builder --skip-tests
- uses: actions/upload-artifact@v4
name: Upload artifacts to github
with:
name: binaries-linux
path: build/merkaartor-*.AppImage
- name: Upload artifacts
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
Expand Down
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ message(STATUS " * Qt version found: ${QT_VERSION}")
if (${QT_VERSION_MAJOR} EQUAL 6)
list(APPEND MERKAARTOR_QT_LIBS Core5Compat)
endif()
if (APPLE)
# macdeployqt does not properly bundle dbus
# see https://bugreports.qt.io/browse/QTBUG-127075
list(APPEND MERKAARTOR_QT_LIBS DBus)
endif()

find_package(Qt${QT_VERSION_MAJOR} COMPONENTS ${MERKAARTOR_QT_LIBS} ${MERKAARTOR_QT_TOOLS} CONFIG REQUIRED)
set(MERKAARTOR_LINK_LIBS ${MERKAARTOR_QT_LIBS})
Expand Down Expand Up @@ -547,8 +552,6 @@ message(STATUS "")
list(APPEND MERKAARTOR_LINK_LIBS ${PKGCONFIG_DEPS_LIBRARIES})
link_directories(${PKGCONFIG_DEPS_LIBRARY_DIRS})



##############################################
# Create the Merkaartor binary
##############################################
Expand Down Expand Up @@ -632,7 +635,7 @@ configure_file("${PROJECT_SOURCE_DIR}/cmake/AppImageBuilder.yml.in" "${PROJECT_B
# Mac OS X specific deploy scripts
##############################################
if (APPLE)
find_program(MACDEPLOYQT macdeployqt)
find_program(MACDEPLOYQT macdeployqt6)
message("Found macdeployqt: ${MACDEPLOYQT}")
configure_file("${PROJECT_SOURCE_DIR}/cmake/deploy-osx.cmake.in" "${PROJECT_BINARY_DIR}/deploy-osx.cmake" @ONLY)
set (CPACK_PRE_BUILD_SCRIPTS "${PROJECT_BINARY_DIR}/deploy-osx.cmake")
Expand Down
17 changes: 13 additions & 4 deletions ci/travis-osx-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@
set -ev

mkdir build && cd build
QT_PREFIX=`brew --prefix qt${QT_MAJOR}`
cmake .. -G"Unix Makefiles" -DCMAKE_PREFIX_PATH="$QT_PREFIX" -DCMAKE_BUILD_TYPE=Release -DEXTRA_TESTS=OFF
conda info
echo $PATH
ls /Users/runner/miniconda3/condabin
cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DEXTRA_TESTS=OFF
make -j4
make test
make package
make test ARGS=--output-on-failure
for i in {0..10}; do
# make package seems to fail due to race conditions:
# https://github.com/actions/runner-images/issues/7522
# https://gitlab.kitware.com/cmake/cmake/-/issues/25671
make package && break
echo "Failed attempt #${i}. Retrying..."
done
echo "Passed on attempt #${i}."
2 changes: 1 addition & 1 deletion ci/travis-windows-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ set -e
mkdir build && cd build
cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DEXTRA_TESTS=OFF
make -j4
make test
make test ARGS=--output-on-failure
make package
1 change: 1 addition & 0 deletions cmake/AppImageBuilder.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ AppDir:
- libqt6core5compat6
- libqt6networkauth6
- qt6-qpa-plugins
- libprotobuf23

files:
exclude:
Expand Down
7 changes: 6 additions & 1 deletion cmake/deploy-osx.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ foreach (_variableName ${_variableNames})
endforeach()
#message("Prefix is: ${CMAKE_INSTALL_PREFIX}")
#execute_process(COMMAND ls ${CMAKE_INSTALL_PREFIX})
set(TMP_APPDIR "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/@[email protected]")

execute_process(COMMAND find "${CPACK_TEMPORARY_INSTALL_DIRECTORY}")
execute_process(COMMAND ${MACDEPLOYQT} "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/@[email protected]")
message("Running macdeployqt on ${TMP_APPDIR}")
execute_process(COMMAND ${MACDEPLOYQT} "${TMP_APPDIR}" -verbose=3)
execute_process(COMMAND install_name_tool -add_rpath "@executable_path/../Frameworks" "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/@[email protected]/Contents/MacOS/merkaartor")
execute_process(COMMAND otool -l "${CPACK_TEMPORARY_INSTALL_DIRECTORY}/@[email protected]/Contents/MacOS/merkaartor")
message("Done bundling.")
execute_process(COMMAND find "${CPACK_TEMPORARY_INSTALL_DIRECTORY}")
3 changes: 2 additions & 1 deletion cmake/deploy-windows.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ message("Working on binary: ${MERKAARTOR_BINARY}")

# Copy whole packages of gdal and proj, as they need other files than dlls to work!
# Also copy openssl directly, as it appears to be preinstalled by github actions in system paths and ignored by the toling below
execute_process(COMMAND pacman -Qlq mingw-w64-x86_64-openssl mingw-w64-x86_64-gdal mingw-w64-x86_64-proj OUTPUT_VARIABLE DEP_PKGS_FILES OUTPUT_STRIP_TRAILING_WHITESPACE)
# Also copy opencl-icd, as is overridden by the system files
execute_process(COMMAND pacman -Qlq mingw-w64-x86_64-openssl mingw-w64-x86_64-opencl-icd mingw-w64-x86_64-gdal mingw-w64-x86_64-proj OUTPUT_VARIABLE DEP_PKGS_FILES OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE "\n" ";" DEP_PKGS_FILES_LIST ${DEP_PKGS_FILES})
foreach(DEP_PKGS_FILE IN LISTS DEP_PKGS_FILES_LIST)
if (${DEP_PKGS_FILE} MATCHES "/include/|/man/|/doc/|/$|.a$|.pc$|.cmake$")
Expand Down

0 comments on commit 5509675

Please sign in to comment.