From 01da6acf566b346212c1db175cd24043f7e77889 Mon Sep 17 00:00:00 2001 From: Yuriy Puchkov Date: Mon, 28 Sep 2020 15:28:34 +0300 Subject: [PATCH] Fix - github CI/CD, SSL for Windows --- .github/workflows/Linux-pack.yml | 120 +++++++++++++++-------------- .github/workflows/Windows-pack.yml | 67 ++++++++++------ .github/workflows/build_cmake.yml | 4 +- CMakeLists.txt | 3 +- src/CMakeLists.txt | 26 +++++++ 5 files changed, 135 insertions(+), 85 deletions(-) diff --git a/.github/workflows/Linux-pack.yml b/.github/workflows/Linux-pack.yml index defb458e..4c06b749 100644 --- a/.github/workflows/Linux-pack.yml +++ b/.github/workflows/Linux-pack.yml @@ -2,15 +2,15 @@ name: Packaging(Linux) on: push: - branches: - - master + branches: + - master* paths-ignore: - 'README.md' - 'LICENSE' pull_request: branches: - - master + - master* paths-ignore: - 'README.md' - 'LICENSE' @@ -38,7 +38,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - ref: master +# ref: master_nc_merge_upstream_test - name: Set env & Print flameshot version shell: bash run: | @@ -68,6 +68,8 @@ jobs: - name: Packaging on ${{ matrix.dist }} if: matrix.dist == 'ubuntu-20.04' run: | + pwd + ls -la cp -r $GITHUB_WORKSPACE/data/debian $GITHUB_WORKSPACE bash $GITHUB_WORKSPACE/tools/packpack mv $GITHUB_WORKSPACE/build/${PRODUCT}_${VERSION}-${RELEASE}_amd64.deb $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist }}.amd64.deb @@ -99,7 +101,7 @@ jobs: uses: actions/checkout@v1 with: fetch-depth: 0 - ref: master +# ref: master_nc_merge_upstream_test - name: Set env & Print flameshot version shell: bash run: | @@ -147,7 +149,8 @@ jobs: mkdir -p $GITHUB_WORKSPACE/build sed -e "/cmake (>= 3.13~),/d" -i $GITHUB_WORKSPACE/debian/control dpkg-buildpackage -b - cp $GITHUB_WORKSPACE/../${PRODUCT}_${VERSION}-${RELEASE}_amd64.deb $GITHUB_WORKSPACE/build/${PRODUCT}_${VERSION}-${RELEASE}.ubuntu-18.04.amd64.deb + cp $GITHUB_WORKSPACE/../${PRODUCT}_*_amd64.deb $GITHUB_WORKSPACE/build/${PRODUCT}_${VERSION}-${RELEASE}.ubuntu-18.04.amd64.deb +# cp $GITHUB_WORKSPACE/../${PRODUCT}_${VERSION}-${RELEASE}_amd64.deb $GITHUB_WORKSPACE/build/${PRODUCT}_${VERSION}-${RELEASE}.ubuntu-18.04.amd64.deb - name: SHA256Sum of ubuntu-18.04 package(daily build) run: | sha256sum $GITHUB_WORKSPACE/build/${PRODUCT}_${VERSION}-${RELEASE}.ubuntu-18.04.amd64.deb @@ -172,7 +175,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - ref: master +# ref: master_nc_merge_upstream_test - name: Set env & Print flameshot version shell: bash run: | @@ -250,7 +253,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - ref: master +# ref: master_nc_merge_upstream_test - name: Set env & Print flameshot version shell: bash run: | @@ -325,55 +328,55 @@ jobs: echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/Flameshot-${VERSION}-${ARCH}.AppImage) echo "======no operation for you can see link in the log console=====" - flatpak-pack: - runs-on: ubuntu-20.04 - steps: - - name: Checkout Source code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: master - - name: Set env & Print flameshot version - shell: bash - run: | - last_committed_tag=$(git tag -l --sort=-v:refname | head -1) - git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count) - git_hash=$(git rev-parse --short HEAD) - echo "=======FLAMESHOT VERSION========" - echo ${last_committed_tag:1} - echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}" - echo "================================" - echo ::set-env name=VERSION::$(echo ${last_committed_tag:1}) - - name: Setup flatpak - run: | - sudo apt-get -y -qq update - sudo apt-get install -y flatpak flatpak-builder - - name: Setup Flathub - run: | - flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - flatpak install -y --noninteractive flathub org.kde.Sdk//5.15 org.kde.Platform//5.15 - - name: Packaging flatpak - run: | - BUNDLE="org.flameshot.flameshot_${VERSION}_${ARCH}.flatpak" - MANIFEST_PATH=$GITHUB_WORKSPACE/data/flatpak/org.flameshot.flameshot.yml - RUNTIME_REPO="https://flathub.org/repo/flathub.flatpakrepo" - APP_ID="org.flameshot.flameshot" - BRANCH="master" - - flatpak-builder --user --disable-rofiles-fuse --repo=repo --force-clean flatpak_app ${MANIFEST_PATH} --install-deps-from=flathub - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} ${BRANCH} - - name: SHA256Sum of flatpak package(daily build) - run: | - sha256sum $GITHUB_WORKSPACE/org.flameshot.flameshot_${VERSION}_${ARCH}.flatpak - sha256sum $GITHUB_WORKSPACE/org.flameshot.flameshot_${VERSION}_${ARCH}.flatpak > $GITHUB_WORKSPACE/org.flameshot.flameshot_${VERSION}_${ARCH}.flatpak.sha256sum - echo "================flatpak sha256sum download link====================" - echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/org.flameshot.flameshot_${VERSION}_${ARCH}.flatpak.sha256sum) - echo "========no operation for you can see link in the log console=======" - - name: Upload flatpak package(daily build) - run: | - echo "=====================flatpak download link=====================" - echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/org.flameshot.flameshot_${VERSION}_${ARCH}.flatpak) - echo "======no operation for you can see link in the log console=====" +# flatpak-pack: +# runs-on: ubuntu-20.04 +# steps: +# - name: Checkout Source code +# uses: actions/checkout@v2 +# with: +# fetch-depth: 0 +## ref: master_nc_merge_upstream_test +# - name: Set env & Print flameshot version +# shell: bash +# run: | +# last_committed_tag=$(git tag -l --sort=-v:refname | head -1) +# git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count) +# git_hash=$(git rev-parse --short HEAD) +# echo "=======FLAMESHOT VERSION========" +# echo ${last_committed_tag:1} +# echo "Details: ${last_committed_tag}+git${git_revno}.${git_hash}" +# echo "================================" +# echo ::set-env name=VERSION::$(echo ${last_committed_tag:1}) +# - name: Setup flatpak +# run: | +# sudo apt-get -y -qq update +# sudo apt-get install -y flatpak flatpak-builder +# - name: Setup Flathub +# run: | +# flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo +# flatpak install -y --noninteractive flathub org.kde.Sdk//5.15 org.kde.Platform//5.15 +# - name: Packaging flatpak +# run: | +# BUNDLE="org.flameshot.flameshot_${VERSION}_${ARCH}.flatpak" +# MANIFEST_PATH=$GITHUB_WORKSPACE/data/flatpak/org.flameshot.flameshot.yml +# RUNTIME_REPO="https://flathub.org/repo/flathub.flatpakrepo" +# APP_ID="org.flameshot.flameshot" +# BRANCH="master_nc_merge_upstream_test" +# +# flatpak-builder --user --disable-rofiles-fuse --repo=repo --force-clean flatpak_app ${MANIFEST_PATH} --install-deps-from=flathub +# flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} ${BRANCH} +# - name: SHA256Sum of flatpak package(daily build) +# run: | +# sha256sum $GITHUB_WORKSPACE/org.flameshot.flameshot_${VERSION}_${ARCH}.flatpak +# sha256sum $GITHUB_WORKSPACE/org.flameshot.flameshot_${VERSION}_${ARCH}.flatpak > $GITHUB_WORKSPACE/org.flameshot.flameshot_${VERSION}_${ARCH}.flatpak.sha256sum +# echo "================flatpak sha256sum download link====================" +# echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/org.flameshot.flameshot_${VERSION}_${ARCH}.flatpak.sha256sum) +# echo "========no operation for you can see link in the log console=======" +# - name: Upload flatpak package(daily build) +# run: | +# echo "=====================flatpak download link=====================" +# echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh $GITHUB_WORKSPACE/org.flameshot.flameshot_${VERSION}_${ARCH}.flatpak) +# echo "======no operation for you can see link in the log console=====" snap-pack: runs-on: ubuntu-20.04 @@ -382,7 +385,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - ref: master +# ref: master_nc_merge_upstream_test - name: Set env & Print flameshot version shell: bash run: | @@ -411,3 +414,4 @@ jobs: echo "=======================snap download link======================" echo $(sh $GITHUB_WORKSPACE/scripts/upload_services/${UPLOAD_SERVICE}.sh ${{ steps.snapcraft.outputs.snap }}) echo "======no operation for you can see link in the log console=====" + diff --git a/.github/workflows/Windows-pack.yml b/.github/workflows/Windows-pack.yml index b40952ed..badf9b19 100644 --- a/.github/workflows/Windows-pack.yml +++ b/.github/workflows/Windows-pack.yml @@ -2,15 +2,15 @@ name: Packaging(Windows) on: push: - branches: - - master + branches: + - master* paths-ignore: - 'README.md' - 'LICENSE' pull_request: branches: - - master + - master* paths-ignore: - 'README.md' - 'LICENSE' @@ -22,6 +22,14 @@ jobs: windows-pack: name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }} runs-on: windows-2019 + env: + VCINSTALLDIR: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/ + Qt5_DIR: ${{ github.workspace }}\build\Qt\${{ matrix.qt_ver }}\${{ matrix.config.qt_arch_install }}\lib\cmake\Qt5\ + QTDIR: ${{ github.workspace }}\build\Qt\${{ matrix.qt_ver }}\${{ matrix.config.qt_arch_install }}\ + # 2020.07 + VCPKG_VERSION: 56fffbe49dfb4dd8fae0940f272c5fd2b86be991 + VCPKG_PACKAGES: openssl-windows + OPENSSL_ROOT_DIR: ${{ github.workspace }}\vcpkg\installed\${{ matrix.config.vcpkg_triplet }}\ strategy: fail-fast: false matrix: @@ -29,33 +37,28 @@ jobs: qt_target: [desktop] config: - { - arch: x86, - generator: "-G'Visual Studio 16 2019' -A Win32", - vcpkg_triplet: x86-windows, - qt_arch: win32_msvc2019, - qt_arch_install: msvc2019, - pak_arch: win32 - } + arch: x86, + generator: "-G'Visual Studio 16 2019' -A Win32", + vcpkg_triplet: x86-windows, + qt_arch: win32_msvc2019, + qt_arch_install: msvc2019, + pak_arch: win32 + } - { - arch: x64, - generator: "-G'Visual Studio 16 2019' -A x64", - vcpkg_triplet: x64-windows, - qt_arch: win64_msvc2019_64, - qt_arch_install: msvc2019_64, - pak_arch: win64 - } + arch: x64, + generator: "-G'Visual Studio 16 2019' -A x64", + vcpkg_triplet: x64-windows, + qt_arch: win64_msvc2019_64, + qt_arch_install: msvc2019_64, + pak_arch: win64 + } type: [portable, installer] - env: - VCINSTALLDIR: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/ - Qt5_DIR: ${{ github.workspace }}\build\Qt\${{ matrix.qt_ver }}\${{ matrix.config.qt_arch_install }}\lib\cmake\Qt5\ - QTDIR: ${{ github.workspace }}\build\Qt\${{ matrix.qt_ver }}\${{ matrix.config.qt_arch_install }}\ - steps: - name: Checkout Source code uses: actions/checkout@v2 - with: + with: fetch-depth: 0 - ref: master +# ref: master - name: Set env & Print flameshot version shell: bash @@ -69,6 +72,15 @@ jobs: echo "================================" echo ::set-env name=VERSION::$(echo ${last_committed_tag:1}) + - name: Restore from cache and run vcpkg + uses: lukka/run-vcpkg@v4 + with: + vcpkgArguments: ${{env.VCPKG_PACKAGES}} + vcpkgDirectory: '${{ github.workspace }}\vcpkg' + appendedCacheKey: ${{ matrix.config.vcpkg_triplet }} + vcpkgGitCommitId: ${{ env.VCPKG_VERSION }} + vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }} + - name: Cache Qt id: cache-qt uses: actions/cache@v1 @@ -91,6 +103,8 @@ jobs: shell: pwsh run: | cmake .. ${{matrix.config.generator}} ` + -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" ` + -DENABLE_OPENSSL=ON ` -DCMAKE_BUILD_TYPE=Release ` -DRUN_IN_PLACE=${{ contains(matrix.type, 'portable') }} @@ -156,3 +170,8 @@ jobs: echo "=================Windows portable download link================" echo $(python $GITHUB_WORKSPACE/scripts/upload_services/transferwee.py upload $GITHUB_WORKSPACE/build/Package/flameshot-${VERSION}-${{ matrix.config.pak_arch }}.zip) echo "=====no operation for you can see link in the log console=====" + - name: Artifact Upload + uses: actions/upload-artifact@v2 + with: + name: Windows-artifact + path: ${{ github.workspace }}/build/Package/* diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index ca731941..4e316edc 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -2,12 +2,12 @@ name: Building(CMake) on: push: - branches: [ master ] + branches: [ master, master_nc_merge_upstream_test ] paths-ignore: - 'README.md' - 'LICENSE' pull_request: - branches: [ master ] + branches: [ master, master_nc_merge_upstream_test ] paths-ignore: - 'README.md' - 'LICENSE' diff --git a/CMakeLists.txt b/CMakeLists.txt index acbdc2e5..c66dd17e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.13) # This can be read from ${PROJECT_NAME} after project() is called project( flameshot - VERSION 0.8.1 + VERSION 0.8.1.1 LANGUAGES CXX) set(PROJECT_NAME_CAPITALIZED "Flameshot") @@ -17,6 +17,7 @@ set(RUN_IN_PLACE ${DEFAULT_RUN_IN_PLACE} CACHE BOOL "Run directly in source directory structure") +option(GENERATE_TS "Regenerate translation source files" OFF) option(GENERATE_TS "Regenerate translation source files" OFF) include(cmake/StandardProjectSettings.cmake) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 96928ac6..ad01d426 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -117,6 +117,21 @@ target_link_libraries( Qt5::Network Qt5::Widgets) +set(USE_OPENSSL FALSE) +if(ENABLE_OPENSSL) + find_package(OpenSSL) + if (OPENSSL_FOUND) + message(STATUS "OpenSSL support enabled.") + set(USE_OPENSSL TRUE) + endif() +else() + mark_as_advanced(CLEAR OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR) +endif() + +if(NOT USE_OPENSSL) + message(WARNING "OpenSSL is required to upload screenshot to imgur") +endif() + target_compile_definitions(flameshot PRIVATE APP_PREFIX="${CMAKE_INSTALL_PREFIX}") target_compile_definitions(flameshot PRIVATE APP_VERSION="v${PROJECT_VERSION}") target_compile_definitions(flameshot PRIVATE IMGUR_CLIENT_ID="313baf0c7b4d3ff") @@ -202,6 +217,17 @@ if(WIN32) DESTINATION bin ) + if (ENABLE_OPENSSL) + if (EXISTS $ENV{OPENSSL_ROOT_DIR}/bin) + install(DIRECTORY $ENV{OPENSSL_ROOT_DIR}/bin/ + DESTINATION bin + FILES_MATCHING PATTERN "*.dll" + ) + else() + message(WARNING "Unable to find OpenSSL dlls.") + endif() + endif() + else() message("Unable to find executable QTDIR/bin/windeployqt.") endif()