Skip to content

Commit

Permalink
Download resources when they do not exist in source folder
Browse files Browse the repository at this point in the history
IB-8136, open-eid/DigiDoc4-Client#1274

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Jun 30, 2024
1 parent 8cf8b7c commit 8e968a2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: CI
on: [push, pull_request]
env:
BUILD_NUMBER: ${{ github.run_number }}
CMAKE_BUILD_PARALLEL_LEVEL: 3
CMAKE_BUILD_PARALLEL_LEVEL: 4
jobs:
macos:
name: Build on macOS
runs-on: macos-latest
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
MACOSX_DEPLOYMENT_TARGET: 12.0
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
steps:
- name: Checkout
Expand All @@ -24,18 +24,18 @@ jobs:
ubuntu:
name: Build on Ubuntu to ${{ matrix.container }}
runs-on: ubuntu-latest
container: ${{ matrix.container }}
container: ubuntu:${{ matrix.container }}
strategy:
matrix:
container: ['ubuntu:20.04', 'ubuntu:22.04']
container: ['20.04', '22.04', '24.04']
env:
DEBIAN_FRONTEND: noninteractive
steps:
- name: Install dependencies
if: matrix.container == 'ubuntu:20.04'
if: matrix.container == '20.04'
run: apt update -qq && apt install --no-install-recommends -y git ca-certificates build-essential pkg-config cmake libpcsclite-dev libssl-dev qttools5-dev-tools qttools5-dev
- name: Install dependencies
if: matrix.container != 'ubuntu:20.04'
if: matrix.container != '20.04'
run: apt update -qq && apt install --no-install-recommends -y git ca-certificates build-essential pkg-config cmake libpcsclite-dev libssl-dev libgl-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -57,15 +57,15 @@ jobs:
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: openssl
vcpkgGitCommitId: 1f619be01b436b796dab797dd1e1721c5676f8ac
vcpkgGitCommitId: 18b028fe785e707265fa0e35590b7537ae1d12ea
vcpkgTriplet: x64-windows
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.6.1
version: 6.7.1
arch: win64_msvc2019_64
- name: Build
run: |
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo `
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -B build -S .
cmake --build build
22 changes: 14 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,19 @@ if( CONFIG_URL )
if( LAST_CHECK_DAYS )
set_source_files_properties(Configuration.cpp PROPERTIES COMPILE_DEFINITIONS LAST_CHECK_DAYS=${LAST_CHECK_DAYS})
endif()
file( DOWNLOAD ${CONFIG_URL} ${CMAKE_CURRENT_BINARY_DIR}/config.json )
string( REPLACE ".json" ".rsa" RSA_URL ${CONFIG_URL} )
file( DOWNLOAD ${RSA_URL} ${CMAKE_CURRENT_BINARY_DIR}/config.rsa )
string( REPLACE ".json" ".pub" PUB_URL ${CONFIG_URL} )
file( DOWNLOAD ${PUB_URL} ${CMAKE_CURRENT_BINARY_DIR}/config.pub )
configure_file( config.qrc config.qrc COPYONLY )
qt_add_resources(CONFIG_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/config.qrc)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/config.json AND
EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/config.rsa AND
EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/config.pub)
qt_add_resources(CONFIG_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/config.qrc)
else()
file(DOWNLOAD ${CONFIG_URL} ${CMAKE_CURRENT_BINARY_DIR}/config.json)
string(REPLACE ".json" ".rsa" RSA_URL ${CONFIG_URL} )
file(DOWNLOAD ${RSA_URL} ${CMAKE_CURRENT_BINARY_DIR}/config.rsa)
string(REPLACE ".json" ".pub" PUB_URL ${CONFIG_URL} )
file(DOWNLOAD ${PUB_URL} ${CMAKE_CURRENT_BINARY_DIR}/config.pub)
configure_file(config.qrc config.qrc COPYONLY)
qt_add_resources(CONFIG_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/config.qrc)
endif()
target_compile_definitions(qdigidoccommon PUBLIC CONFIG_URL="${CONFIG_URL}")
target_sources(qdigidoccommon PRIVATE ${CONFIG_SOURCES} Configuration.cpp )
target_sources(qdigidoccommon PRIVATE ${CONFIG_SOURCES} Configuration.cpp)
endif()

0 comments on commit 8e968a2

Please sign in to comment.