From 162cd9eb5971cb5d8e073a8002c1f64907696fbe Mon Sep 17 00:00:00 2001 From: Kang Lin Date: Tue, 20 Feb 2024 12:01:17 +0800 Subject: [PATCH] CI: modify ci --- .github/workflows/android.yml | 82 ++++++++----------- .github/workflows/build.yml | 14 ++-- .github/workflows/macos.yml | 54 ++++++------- .github/workflows/mingw.yml | 22 ++--- .github/workflows/msvc.yml | 124 ++++++++++------------------ .github/workflows/ubuntu.yml | 49 ++++++++--- appveyor.yml | 148 +++++++++------------------------- 7 files changed, 189 insertions(+), 304 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index f047e78..0e11cd2 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -13,23 +13,18 @@ jobs: strategy: matrix: BUILD_TYPE: [Release] - qt_arch: [android_arm64_v8a, android_armv7, android_x86_64] + qt_arch: [android_arm64_v8a, android_x86_64] qt_version: [6.6.1] include: - BUILD_TYPE: Release qt_arch: android_arm64_v8a - qt_version: 6.6.1 - VCPKG_TARGET_TRIPLET: arm-android + VCPKG_TARGET_TRIPLET: arm64-android + config_arch: arm64_v8a - BUILD_TYPE: Release - qt_arch: android_armv7 - qt_version: 6.6.1 - VCPKG_TARGET_TRIPLET: arm-android - - - BUILD_TYPE: Release - qt_version: 6.6.1 qt_arch: android_x86_64 VCPKG_TARGET_TRIPLET: x64-android + config_arch: x86_64 runs-on: ubuntu-latest @@ -37,11 +32,11 @@ jobs: artifact_name: build_android SOURCE_DIR: ${{github.workspace}}/.cache/source TOOSL_DIR: ${{github.workspace}}/.cache/tools - INSTALL_DIR: ${{github.workspace}}/.cache/install_${{matrix.BUILD_TYPE}} + INSTALL_DIR: ${{github.workspace}}/.cache/install + ChineseChessControl_VERSION: "v2.0.11" + VCPKGGITCOMMITID: a1a1cbc975abf909a6c8985a6a2b8fe20bbd9bd6 ANDROID_PLATFORM: android-23 ANDROID_NATIVE_API_LEVEL: 23 - ChineseChessControl_VERSION: "v2.0.11" - VCPKGGITCOMMITID: 6359372f3ca1e6072e302e1d7238f31b259c5b51 qt_modules: 'qtimageformats qtmultimedia qtscxml qtwebchannel qtwebsockets qtwebview' # Map the job outputs to step outputs @@ -61,16 +56,26 @@ jobs: cmake -E make_directory ${{env.INSTALL_DIR}} cmake -E make_directory ${{github.workspace}}/build - - name: Cache Qt + - name: Cache installed #if: false - id: cache-qt - uses: actions/cache@v1 # not v2! + uses: actions/cache@v2 + id: cache-installed + with: + path: | + ${{env.INSTALL_DIR}} + key: cache-installed-android-qt${{matrix.qt_version}}-${{matrix.qt_arch}}-${{matrix.BUILD_TYPE}} + + - name: run vcpkg + uses: lukka/run-vcpkg@v11 with: - path: ${{env.TOOSL_DIR}}/qt - key: qt${{matrix.qt_version}}_${{matrix.qt_arch}} + # Indicates whether to only setup vcpkg (i.e. installing it and setting the environment variables VCPKG_ROOT, RUNVCPK_VCPKG_ROOT), without installing any port. + #setupOnly: # optional + #vcpkgGitURL: https://github.com/KangLin/vcpkg.git + vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}} + vcpkgDirectory: ${{ runner.workspace }}/vcpkg/ - name: Install Qt of gcc_64 - uses: jurplel/install-qt-action@v3.2.1 + uses: jurplel/install-qt-action@v3 with: dir: '${{env.TOOSL_DIR}}/qt' # optional version: '${{matrix.qt_version}}' @@ -78,10 +83,11 @@ jobs: target: 'desktop' arch: 'gcc_64' set-env: false - cached: '${{ steps.cache-qt.outputs.cache-hit }}' # optional, default is false + cache: true + cache-key-prefix: cached_qt - name: Install Qt of android - uses: jurplel/install-qt-action@v3.2.1 + uses: jurplel/install-qt-action@v3 with: # Directory to install Qt dir: '${{env.TOOSL_DIR}}/qt' # optional @@ -95,37 +101,14 @@ jobs: arch: '${{matrix.qt_arch}}' # optional # Additional Qt modules to install modules: '${{env.qt_modules}}' # optional. See: https://ddalcino.github.io/aqt-list-server/ - # Whether or not to actually download Qt - cached: '${{ steps.cache-qt.outputs.cache-hit }}' # optional, default is false - -# - name: run-vcpkg -# uses: lukka/run-vcpkg@v7.4 -# with: -# # Indicates whether to only setup vcpkg (i.e. installing it and setting the environment variables VCPKG_ROOT, RUNVCPK_VCPKG_ROOT), without installing any port. -# #setupOnly: # optional -# #vcpkgGitURL: https://github.com/KangLin/vcpkg.git -# vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}} -# vcpkgDirectory: ${{ runner.workspace }}/vcpkg/ -# # Since the cache must be invalidated when content of the vcpkg.json file changes, let's -# # compute its hash and append this to the computed cache's key. -# appendedCacheKey: android-qt${{matrix.qt_version}}-${{matrix.VCPKG_TARGET_TRIPLET}}-${{matrix.BUILD_TYPE}}-${{env.VCPKGGITCOMMITID}} -# additionalCachedPaths: $VCPKG_ROOT/installed -# vcpkgTriplet: '${{ matrix.VCPKG_TARGET_TRIPLET }}' -# vcpkgArguments: 'zlib openssl' - - - name: Cache installed - uses: actions/cache@v3 - id: cache-installed - with: - path: | - ${{env.INSTALL_DIR}} - key: cache-installed-android-qt${{matrix.qt_version}}-${{matrix.VCPKG_TARGET_TRIPLET}}-${{matrix.BUILD_TYPE}} + cache: true + cache-key-prefix: cached_qt - name: git clone RabbitCommon working-directory: ${{env.SOURCE_DIR}} run: | git clone https://github.com/KangLin/RabbitCommon.git - + - name: build ChineseChessControl working-directory: ${{github.workspace}}/build env: @@ -136,6 +119,9 @@ jobs: run: | sudo chmod 777 ${Qt6_DIR}/bin/qt-cmake ${Qt6_DIR}/bin/qt-cmake .. \ + -DCMARK_SHARED=OFF \ + -DCMARK_TESTS=OFF \ + -DCMARK_STATIC=ON \ -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} \ -DQT_HOST_PATH=${Qt6_DIR}/../gcc_64 \ -DANDROID_PLATFORM=${{env.ANDROID_PLATFORM}} \ @@ -144,10 +130,10 @@ jobs: -DQT_ENABLE_VERBOSE_DEPLOYMENT=OFF \ -DQt6LinguistTools_DIR=${Qt6_DIR}/../gcc_64/lib/cmake/Qt6LinguistTools \ -DCMAKE_INSTALL_PREFIX=`pwd`/install - cmake --build . --config ${{matrix.BUILD_TYPE}} --target all - cmake --build . --config ${{matrix.BUILD_TYPE}} --target install + cmake --build . --config ${{matrix.BUILD_TYPE}} --target all APK_FILE=`find . -name "android-*.apk"` cp $APK_FILE ChineseChessControl_${{env.ChineseChessControl_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk + cmake --build . --config ${{matrix.BUILD_TYPE}} --target install 7z a ChineseChessControl_${{env.ChineseChessControl_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.zip install/* - name: Update artifact diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c366ecd..2034c96 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -# 作者:康林 +# 作者:康林 name: build @@ -80,10 +80,14 @@ jobs: echo "文件签名:" >> ${{github.workspace}}/Note.md for file in * do - #echo $file - if [ -f $file ] && [ "${file##*.}" != "xml" ]; then - md5sum $file > $file.md5sum - cat $file.md5sum >> ${{github.workspace}}/Note.md + echo "$file" + if [ -f $file ]; then + if [ "${file##*.}" != "xml" ] && [ "${file##*.}" != "json" ]; then + md5sum $file > $file.md5sum + cat $file.md5sum >> ${{github.workspace}}/Notes.md + fi + else + rm -fr $file fi done diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 80737e9..13b83c0 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -18,11 +18,13 @@ jobs: BUILD_TYPE: [Release, Debug] qt_version: [6.5.1, 5.15.2, 5.12.12] qt_arch: [clang_64] + VCPKG_TARGET_TRIPLET: [x64-osx] include: - qt_version: 6.5.1 qt_modules: 'qtscxml qtmultimedia qtimageformats' - qt_version: 5.15.2 + - qt_version: 5.12.12 runs-on: macos-latest @@ -32,10 +34,10 @@ jobs: SOURCE_DIR: ${{github.workspace}}/.cache/source TOOSL_DIR: ${{github.workspace}}/.cache/tools INSTALL_DIR: ${{github.workspace}}/.cache/install_macos - ChineseChessControl_VERSION: "2.0.11" - artifact_name: build_macos qt_modules: 'qtwebengine ${{ matrix.qt_modules }}' - VCPKGGITCOMMITID: 6359372f3ca1e6072e302e1d7238f31b259c5b51 + VCPKGGITCOMMITID: a1a1cbc975abf909a6c8985a6a2b8fe20bbd9bd6 + artifact_name: build_macos + ChineseChessControl_VERSION: "2.0.11" # Map the job outputs to step outputs outputs: @@ -45,7 +47,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v3 with: - submodules: true + submodules: recursive - name: Make directories run: | @@ -60,43 +62,28 @@ jobs: with: path: | ${{env.INSTALL_DIR}} - key: Cache-macos-installed-qt${{matrix.qt_version}}-${{matrix.BUILD_TYPE}} + key: Cache-installed-macos - - name: run-vcpkg - uses: lukka/run-vcpkg@v7 + - name: run vcpkg + uses: lukka/run-vcpkg@v11 with: vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}} vcpkgDirectory: ${{runner.workspace}}/vcpkg/ - # Since the cache must be invalidated when content of the vcpkg.json file changes, let's - # compute its hash and append this to the computed cache's key. - appendedCacheKey: cache-vcpkg-msvc-${{matrix.triplet}}-qt${{matrix.qt_version}}-${{matrix.BUILD_TYPE}}-${{env.VCPKGGITCOMMITID}} - vcpkgTriplet: '${{matrix.triplet}}' - vcpkgArguments: 'zlib openssl' - - - name: Cache Qt - id: cache-qt - uses: actions/cache@v1 # not v2! - with: - path: ${{env.TOOSL_DIR}}/qt - key: qt${{matrix.qt_version}}-${{matrix.qt_arch}} - name: Install Qt - # You may pin to the exact commit or the version. - # uses: jurplel/install-qt-action@a962fb91949c8e846a3e4a944d50e7ef5cc3a28a - uses: jurplel/install-qt-action@v3.2.1 + uses: jurplel/install-qt-action@v3 with: - # Directory to install Qt - dir: ${{env.TOOSL_DIR}}/qt # optional - # Version of Qt to install - version: ${{matrix.qt_version}} # optional, default is 5.15.2 + dir: '${{env.TOOSL_DIR}}/qt' # optional + version: '${{matrix.qt_version}}' # optional, default is 5.15.2 + arch: '${{matrix.qt_arch}}' # optional modules: '${{env.qt_modules}}' # optional. See: https://ddalcino.github.io/aqt-list-server/ - cache: ${{steps.cache-qt.outputs.cache-hit}} # optional, default is false + cache: true + cache-key-prefix: cached_qt - name: git clone RabbitCommon working-directory: ${{env.SOURCE_DIR}} - run: | - git clone https://github.com/KangLin/RabbitCommon.git - + run: git clone https://github.com/KangLin/RabbitCommon.git + - name: build ChineseChessControl working-directory: ${{github.workspace}}/build env: @@ -108,8 +95,12 @@ jobs: -DCMARK_STATIC=ON \ -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} \ -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install \ - -DCMAKE_PREFIX_PATH=${{env.INSTALL_DIR}}/lib/cmake + -DCMAKE_PREFIX_PATH=${{env.INSTALL_DIR}}/lib/cmake \ + -DVCPKG_VERBOSE=ON \ + -DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON \ + -DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake cmake --build . --config ${{ matrix.BUILD_TYPE }} --target install + 7z a ChineseChessControl_${{env.LunarCalendar_VERSION}}_macos_qt${{matrix.qt_version}}_${{ matrix.BUILD_TYPE }}.zip ./install/* cmake --build . --config ${{ matrix.BUILD_TYPE }} --target package - name: Update artifact @@ -119,6 +110,7 @@ jobs: name: ${{ env.artifact_name }} path: | ${{github.workspace}}/build/chinesechesscontrol_*.tar.gz + ${{github.workspace}}/build/ChineseChessControl_${{env.LunarCalendar_VERSION}}_macos_qt${{matrix.qt_version}}_${{ matrix.BUILD_TYPE }}.zip # - name: Upload To Github Release # if: ${{ matrix.BUILD_TYPE == 'Release' && startsWith(github.ref, 'refs/tags/') }} diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index 76d8608..a5c06e4 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -1,4 +1,4 @@ -name: build_mingw +name: mingw on: workflow_call: @@ -9,11 +9,9 @@ on: jobs: build_mingw: - name: build mingw strategy: matrix: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: [Release, Debug] defaults: @@ -26,8 +24,8 @@ jobs: SOURCE_DIR: ${{github.workspace}}\.cache\source TOOSL_DIR: ${{github.workspace}}\.cache\tools INSTALL_DIR: ${{github.workspace}}\.cache\install_mingw - ChineseChessControl_VERSION: "v2.0.11" artifact_name: build_mingw + ChineseChessControl_VERSION: "v2.0.11" # Map the job outputs to step outputs outputs: @@ -55,19 +53,14 @@ jobs: mingw-w64-x86_64-make ^ mingw-w64-x86_64-nsis ^ mingw-w64-x86_64-gcc ^ - mingw-w64-x86_64-qt5 ^ + mingw-w64-x86_64-qt6 ^ + mingw-w64-x86_64-qt6-multimedia ^ + mingw-w64-x86_64-qt6-svg ^ mingw-w64-x86_64-qtwebkit ^ mingw-w64-x86_64-zlib ^ + mingw-w64-x86_64-7zip ^ git base-devel - - name: Cache installed - uses: actions/cache@v3 - id: cache-installed - with: - path: | - ${{env.INSTALL_DIR}} - key: cache-installed-mingw - - name: git clone RabbitCommon working-directory: ${{env.SOURCE_DIR}} run: | @@ -87,7 +80,8 @@ jobs: -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^ -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install ^ -DCMAKE_PREFIX_PATH=${{env.INSTALL_DIR}} ^ - -DCMAKE_CXX_COMPILER_ARCHITECTURE_ID=x86_64 + -DINSTALL_QT=ON ^ + -DBUILD_APP=ON cmake --build . --config ${{ matrix.BUILD_TYPE }} - name: Package diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index aa8be0f..5cc4b99 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -1,4 +1,4 @@ -name: build_msvc +name: msvc on: workflow_call: @@ -13,50 +13,40 @@ jobs: strategy: matrix: BUILD_TYPE: [Release, Debug] - qt_version: [6.6.1, 6.5.2, 5.15.2, 5.12.12] - + qt_version: [6.6.1, 5.15.2, 5.12.12] include: - - triplet: x64-windows - qt_version: 6.6.1 - qt_arch: win64_msvc2019_64 - CMAKE_GENERATOR_PLATFORM: x64 + - qt_version: 6.6.1 + triplet: x64-windows VCPKG_PLATFORM_TOOLSET: v142 - qt_modules: 'qtscxml qtmultimedia qtimageformats qtwebchannel qtwebsockets qtwebview qtpositioning' - update_artifact: true - - - triplet: x64-windows - qt_version: 6.5.2 qt_arch: win64_msvc2019_64 CMAKE_GENERATOR_PLATFORM: x64 - VCPKG_PLATFORM_TOOLSET: v142 - qt_modules: 'qtscxml qtmultimedia qtimageformats qtwebchannel qtwebsockets qtwebview qtpositioning' + qt_modules: qtscxml qtwebchannel qtwebsockets qtwebview qtpositioning - - triplet: x64-windows - qt_version: 5.15.2 - qt_arch: win32_msvc2019 - CMAKE_GENERATOR_PLATFORM: Win32 + - qt_version: 5.15.2 + triplet: x64-windows VCPKG_PLATFORM_TOOLSET: v142 - update_artifact: true + qt_arch: win64_msvc2019_64 + CMAKE_GENERATOR_PLATFORM: x64 - - triplet: x86-windows - qt_version: 5.12.12 + - qt_version: 5.12.12 + triplet: x86-windows + VCPKG_PLATFORM_TOOLSET: v141 qt_arch: win32_msvc2017 CMAKE_GENERATOR_PLATFORM: Win32 - VCPKG_PLATFORM_TOOLSET: v141 runs-on: windows-latest env: + ChineseChessControl_VERSION: "v2.0.11" artifact_name: build_msvc SOURCE_DIR: ${{github.workspace}}\.cache\source TOOSL_DIR: ${{github.workspace}}\.cache\tools - INSTALL_DIR: ${{github.workspace}}\.cache\install_msvc_${{matrix.triplet}}_${{matrix.BUILD_TYPE}} + INSTALL_DIR: ${{github.workspace}}\.cache\install_msvc_installed_qt${{matrix.qt_version}}_${{matrix.qt_arch}}-${{matrix.triplet}}_${{matrix.BUILD_TYPE}} CMAKE_GENERATOR: "Visual Studio 17 2022" - CMAKE_GENERATOR_PLATFORM: ${{matrix.CMAKE_GENERATOR_PLATFORM}} VCPKG_PLATFORM_TOOLSET: ${{matrix.VCPKG_PLATFORM_TOOLSET}} - ChineseChessControl_VERSION: "v2.0.11" - VCPKGGITCOMMITID: 6359372f3ca1e6072e302e1d7238f31b259c5b51 - qt_modules: 'qtwebengine ${{matrix.qt_modules}}' + CMAKE_GENERATOR_PLATFORM: ${{matrix.CMAKE_GENERATOR_PLATFORM}} + VCPKGGITCOMMITID: a1a1cbc975abf909a6c8985a6a2b8fe20bbd9bd6 + qt_modules: qtwebengine ${{matrix.qt_modules}} # Map the job outputs to step outputs outputs: @@ -70,7 +60,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v3 with: - submodules: true + submodules: recursive - name: make directory run: | @@ -78,73 +68,36 @@ jobs: cmake -E make_directory ${{env.TOOSL_DIR}} cmake -E make_directory ${{env.INSTALL_DIR}} cmake -E make_directory ${{github.workspace}}/build + cmake -E make_directory ${{github.workspace}}/build_app + cmake -E make_directory ${{github.workspace}}/build_package - name: Cache installed - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache-installed with: path: | ${{env.INSTALL_DIR}} - key: msvc_cache_installed_qt${{matrix.qt_version}} + key: cache-installed-msvc - - name: run-vcpkg - uses: lukka/run-vcpkg@v7 + - name: run vcpkg + uses: lukka/run-vcpkg@v11 with: vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}} vcpkgDirectory: ${{runner.workspace}}/vcpkg/ - # Since the cache must be invalidated when content of the vcpkg.json file changes, let's - # compute its hash and append this to the computed cache's key. - appendedCacheKey: cache-vcpkg-msvc-${{matrix.triplet}}-qt${{matrix.qt_version}}-${{matrix.BUILD_TYPE}}-${{env.VCPKGGITCOMMITID}} - vcpkgTriplet: '${{matrix.triplet}}' - vcpkgArguments: 'zlib openssl' - - - name: Cache Qt - id: cache-qt - uses: actions/cache@v1 # not v2! - with: - path: ${{env.TOOSL_DIR}}/qt - key: qt${{matrix.qt_version}}-${{matrix.qt_arch}} - name: Install Qt - # You may pin to the exact commit or the version. - # uses: jurplel/install-qt-action@a962fb91949c8e846a3e4a944d50e7ef5cc3a28a - uses: jurplel/install-qt-action@v3.2.1 + uses: jurplel/install-qt-action@v3 with: - # Directory to install Qt - dir: ${{env.TOOSL_DIR}}/qt # optional - # Version of Qt to install - version: ${{matrix.qt_version}} # optional, default is 5.15.2 - # Host platform - #host: linux # optional - # Target platform for build - #target: desktop # optional, default is desktop - # Architecture for Windows/Android - arch: ${{matrix.qt_arch}} # optional - # Whether or not to install Qt dependencies on Linux - #install-deps: true # optional, default is true - # Additional Qt modules to install + dir: '${{env.TOOSL_DIR}}/qt' # optional + version: '${{matrix.qt_version}}' # optional, default is 5.15.2 + arch: '${{matrix.qt_arch}}' # optional modules: '${{env.qt_modules}}' # optional. See: https://ddalcino.github.io/aqt-list-server/ - # Force a Qt mirror in case the default is not working - #mirror: # optional - # Whether or not to actually download Qt - cache: ${{ steps.cache-qt.outputs.cache-hit }} # optional, default is false - # Whether or not to automatically run setup-python to find a valid python version. - #setup-python: false # optional, default is true - # Qt tools to download--specify comma-separated argument lists which are themselves separated by spaces: ,, - #tools: # optional - # Whether or not to actually install Qt or just the tools from the tools argument - #tools-only: false # optional, default is false - # Version of aqtinstall to use in case of issues - #aqtversion: # optional, default is ==0.10.0 - # Version of py7zr to use in case of issues - #py7zrversion: # optional, default is ==0.11.0 - # Any extra arguments to append to the back - #extra: # optional - + cache: true + cache-key-prefix: cached_qt + - name: git clone RabbitCommon working-directory: ${{env.SOURCE_DIR}} - run: | - git clone https://github.com/KangLin/RabbitCommon.git + run: git clone https://github.com/KangLin/RabbitCommon.git - name: build ChineseChessControl working-directory: ${{github.workspace}}/build @@ -161,10 +114,11 @@ jobs: -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install ^ -DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake ^ -DVCPKG_VERBOSE=ON ^ - -DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON + -DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON ^ + -DVCPKG_APPLOCAL_DEPS=ON cmake --build . --config ${{matrix.BUILD_TYPE}} - - name: Package + - name: Package program if: ${{ matrix.BUILD_TYPE == 'Release' }} working-directory: ${{github.workspace}}\build run: | @@ -178,10 +132,14 @@ jobs: copy /Y ${{env.INSTALL_DIR}}\lib\*.dll install\bin copy /Y ${{env.RUNVCPKG_VCPKG_ROOT}}\installed\${{env.RUNVCPKG_VCPKG_TRIPLET_OUT}}\bin\*.dll install\bin makensis Install.nsi + + - name: Package develop library + working-directory: ${{github.workspace}}\build + run: | cmake --install . --config ${{matrix.BUILD_TYPE}} --prefix=%CD%\install_develop --component=MFCDevelopment cmake --install . --config ${{matrix.BUILD_TYPE}} --prefix=%CD%\install_develop --component=QtDevelopment cmake --install . --config ${{matrix.BUILD_TYPE}} --prefix=%CD%\install_develop --component=Development - 7z a ChineseChessControl_${{env.ChineseChessControl_VERSION}}_${{matrix.qt_arch}}_Qt${{matrix.qt_version}}_Develop.zip %CD%\install_develop\. + 7z a ChineseChessControl_${{env.ChineseChessControl_VERSION}}_${{matrix.qt_arch}}_Qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}_Develop.zip %CD%\install_develop\. cmake --build . --config ${{ matrix.BUILD_TYPE }} --target package - name: Update artifact @@ -191,4 +149,4 @@ jobs: name: ${{ env.artifact_name }} path: | ${{github.workspace}}\build\chinesechesscontrol_*.exe - ${{github.workspace}}\build\ChineseChessControl_${{env.ChineseChessControl_VERSION}}_${{matrix.qt_arch}}_Qt${{matrix.qt_version}}_Develop.zip + ${{github.workspace}}\build\ChineseChessControl_${{env.ChineseChessControl_VERSION}}_${{matrix.qt_arch}}_Qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}_Develop.zip diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index b062bd5..21c034e 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -6,21 +6,22 @@ on: name: description: "The artifact name" value: ${{ jobs.build_ubuntu.outputs.name }} - + +env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + jobs: build_ubuntu: strategy: matrix: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: [Release, Debug] runs-on: ubuntu-latest env: - BUILD_TYPE: ${{ matrix.BUILD_TYPE }} SOURCE_DIR: ${{github.workspace}}/.cache/source TOOSL_DIR: ${{github.workspace}}/.cache/tools - INSTALL_DIR: ${{github.workspace}}/.cache/install_ubuntu_${{matrix.BUILD_TYPE}} + INSTALL_DIR: ${{github.workspace}}/.cache/install_ubuntu ChineseChessControl_VERSION: "2.0.11" artifact_name: build_ubuntu @@ -32,7 +33,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v3 with: - submodules: true + submodules: recursive - name: make_directory run: | @@ -40,14 +41,20 @@ jobs: cmake -E make_directory ${{env.TOOSL_DIR}} cmake -E make_directory ${{env.INSTALL_DIR}} cmake -E make_directory ${{github.workspace}}/build - - - name: apt helper action - uses: ryankurte/action-apt@v0.2.0 - with: - # architectures to pass to dpkg --add-architecture - #architectures: # optional - # apt packages to install - packages: xvfb xpra libglu1-mesa-dev libpulse-mainloop-glib0 cmake build-essential debhelper fakeroot graphviz doxygen qttools5-dev qttools5-dev-tools qtbase5-dev qtbase5-dev-tools qtmultimedia5-dev libqt5svg5-dev libqtermwidget5-0-dev qtwebengine5-dev + + - name: Install apt packages + run: | + sudo apt update + sudo apt upgrade + sudo apt install xvfb xpra \ + libglu1-mesa-dev libpulse-mainloop-glib0 \ + cmake build-essential \ + debhelper fakeroot graphviz \ + qt6-tools-dev qt6-tools-dev-tools \ + qt6-base-dev qt6-base-dev-tools \ + qt6-l10n-tools qt6-translations-l10n \ + qt6-scxml-dev qt6-webengine-dev qt6-webengine-dev-tools \ + qt6-multimedia-dev libqt6svg6-dev - name: Cache installed uses: actions/cache@v2 @@ -62,6 +69,22 @@ jobs: run: | git clone https://github.com/KangLin/RabbitCommon.git + - name: Build develop library + working-directory: ${{github.workspace}}/build + env: + RabbitCommon_DIR: ${{env.SOURCE_DIR}}/RabbitCommon + run: | + cmake ${{github.workspace}} \ + -DCMARK_SHARED=OFF \ + -DCMARK_TESTS=OFF \ + -DCMARK_STATIC=ON \ + -DINSTALL_QT=OFF \ + -DBUILD_APP=OFF \ + -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} \ + -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install \ + -DCMAKE_PREFIX_PATH=${{env.INSTALL_DIR}}/lib/cmake + cmake --build . --config ${{ matrix.BUILD_TYPE }} --target install + - name: build ChineseChessControl working-directory: ${{github.workspace}}/build env: diff --git a/appveyor.yml b/appveyor.yml index e67bd55..70e5b82 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,10 @@ version: 'v2.0.11.{build}' cache: - - Package - + - ..\other_source +# Clean cached +# https://www.appveyor.com/docs/build-cache/#cleaning-up-cache + environment: STOREPASS: secure: l9BZEU39F1a4vSkhwl0CHR+yh6CD1c7byGzMv+1NUa4= @@ -13,79 +15,17 @@ environment: ChineseChessControl_VERSION: "v2.0.11" matrix: - ##### msvc 2019 ######## - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - GENERATORS: "Visual Studio 16 2019" - BUILD_TARGERT: windows_msvc - TOOLCHAIN_VERSION: 16 - MSVC: 2019 - QT_ROOT: C:\Qt\6.4\msvc2019_64 - BUILD_ARCH: x64 - - ##### msvc 2017 ######## - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - GENERATORS: "Visual Studio 15 2017" - BUILD_TARGERT: windows_msvc - TOOLCHAIN_VERSION: 15 - MSVC: 2017 - QT_ROOT: C:\Qt\5.12\msvc2017 - BUILD_ARCH: x86 - - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - GENERATORS: "Visual Studio 15 2017 Win64" - BUILD_TARGERT: windows_msvc - TOOLCHAIN_VERSION: 15 - MSVC: 2017 - QT_ROOT: C:\Qt\5.12\msvc2017_64 - BUILD_ARCH: x64 - - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - GENERATORS: "Visual Studio 15 2017" - BUILD_TARGERT: windows_msvc - TOOLCHAIN_VERSION: 15 - MSVC: 2017 - QT_ROOT: C:\Qt\5.6\msvc2017 - BUILD_ARCH: x86 - ##### msvc 2015 ######## - - BUILD_TARGERT: windows_msvc - GENERATORS: "Visual Studio 14 2015" + - GENERATORS: "Visual Studio 14 2015" TOOLCHAIN_VERSION: 14 QT_ROOT: C:\Qt\5.6\msvc2015 BUILD_ARCH: x86 - - BUILD_TARGERT: windows_msvc - GENERATORS: "Visual Studio 14 2015 Win64" + - GENERATORS: "Visual Studio 14 2015 Win64" TOOLCHAIN_VERSION: 14 QT_ROOT: C:\Qt\5.12\msvc2015_64 BUILD_ARCH: x64 - ##### msvc 2013 ######## -# - BUILD_TARGERT: windows_msvc -# GENERATORS: "Visual Studio 12 2013" -# TOOLCHAIN_VERSION: 12 -# QT_ROOT: C:\Qt\5.6\msvc2013 -# BUILD_ARCH: x86 - -# - BUILD_TARGERT: windows_msvc -# GENERATORS: "Visual Studio 12 2013 Win64" -# TOOLCHAIN_VERSION: 12 -# QT_ROOT: C:\Qt\5.6\msvc2013_64 -# BUILD_ARCH: x64 - -# ##### mingw ######## -# - BUILD_TARGERT: windows_mingw -# GENERATORS: "MSYS Makefiles" -# TOOLCHAIN_VERSION: 492_32 -# QT_ROOT: C:\Qt\5.6\mingw49_32 -# BUILD_ARCH: x86 - -# - BUILD_TARGERT: windows_mingw -# GENERATORS: "MSYS Makefiles" -# TOOLCHAIN_VERSION: 530_32 -# QT_ROOT: C:\Qt\5.10\mingw53_32 -# BUILD_ARCH: x86 - matrix: fast_finish: false @@ -98,50 +38,53 @@ init: - if NOT "%QT_ROOT%" == "NO" for /f "delims=" %%i in ('%QT_ROOT%/bin/qmake -query QT_VERSION') do (set QT_VERSION=%%i) - echo QT_ROOT=%QT_ROOT% - echo QT_VERSION=%QT_VERSION% - - del C:\msys64\usr\bin\link.exe install: - - C:\msys64\autorebase.bat - - C:\msys64\usr\bin\pacman.exe -S --noconfirm unzip - #- if "%BUILD_TARGERT%"=="windows_mingw" set PATH=C:\Qt\Tools\mingw%TOOLCHAIN_VERSION%_32\bin;%PATH% - - if "%BUILD_TARGERT%" == "windows_mingw" set MSYSTEM=MINGW32 #设置编译系统为MINGW32 - -before_build: - cd %APPVEYOR_BUILD_FOLDER% - #- git submodule update --init --recursive + - git submodule update --init --recursive - git clone https://github.com/KangLin/RabbitCommon.git - set RabbitCommon_DIR=%APPVEYOR_BUILD_FOLDER%/RabbitCommon - - cd %APPVEYOR_BUILD_FOLDER% - #- C:\msys64\usr\bin\bash.exe %APPVEYOR_BUILD_FOLDER%\ci\build-install-tools-windows.sh - - set CMAKE_VERSION=3.26.4 - - if not exist cmake-%CMAKE_VERSION%-windows-i386 (curl -fsSL -o cmake-%CMAKE_VERSION%-windows-i386.zip https://github.com/Kitware/CMake/releases/download/v%CMAKE_VERSION%/cmake-%CMAKE_VERSION%-windows-i386.zip && 7z x cmake-%CMAKE_VERSION%-windows-i386.zip) - - cd cmake-%CMAKE_VERSION%-windows-i386 - - set PATH="%CD%/bin";%PATH% - -build_script: - set OTHER_SOURCE=%APPVEYOR_BUILD_FOLDER%\..\other_source - set INSTALL_DIR=%OTHER_SOURCE%\install_dir - - set VCPKG_DIR=%OTHER_SOURCE%\vcpkg - if not exist "%OTHER_SOURCE%" ( mkdir "%OTHER_SOURCE%" ) - - - cd %OTHER_SOURCE% - if not exist "%INSTALL_DIR%" (mkdir "%INSTALL_DIR%") + - cd %OTHER_SOURCE% - - if not exist vcpkg (git clone "https://github.com/microsoft/vcpkg.git" && cd "%VCPKG_DIR%" && git checkout -b 56765209ec0e92c58a5fd91aa09c46a16d660026 56765209ec0e92c58a5fd91aa09c46a16d660026 ) - - cd %VCPKG_DIR% - - bootstrap-vcpkg.bat - - vcpkg --triplet %BUILD_ARCH%-windows install zlib openssl - + - set CMAKE_VERSION=3.28.3 + - if not exist cmake-%CMAKE_VERSION%-windows-i386 (curl -fsSL -o cmake-%CMAKE_VERSION%-windows-i386.zip https://github.com/Kitware/CMake/releases/download/v%CMAKE_VERSION%/cmake-%CMAKE_VERSION%-windows-i386.zip && 7z x cmake-%CMAKE_VERSION%-windows-i386.zip) + - cd cmake-%CMAKE_VERSION%-windows-i386 + - set PATH="%CD%/bin";%PATH% + + - cd %OTHER_SOURCE% + - set VCPKG_DIR=%OTHER_SOURCE%\vcpkg + - if not exist %VCPKG_DIR% (git clone "https://github.com/microsoft/vcpkg.git" && cd "%VCPKG_DIR%" && git checkout -b a1a1cbc975abf909a6c8985a6a2b8fe20bbd9bd6 a1a1cbc975abf909a6c8985a6a2b8fe20bbd9bd6 && bootstrap-vcpkg.bat) + +before_build: + +build_script: - cd %APPVEYOR_BUILD_FOLDER% - mkdir build - cd build - - cmake .. -G"%GENERATORS%" -DQT_DIR=%QT_ROOT%/lib/cmake/Qt5 -DQt5_DIR=%QT_ROOT%/lib/cmake/Qt5 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%cd%/install" -DCMAKE_PREFIX_PATH="%INSTALL_DIR%" -DCMAKE_TOOLCHAIN_FILE="%VCPKG_DIR%/scripts/buildsystems/vcpkg.cmake" + - cmake %APPVEYOR_BUILD_FOLDER% ^ + -G"%GENERATORS%" ^ + -DCMARK_SHARED=OFF ^ + -DCMARK_TESTS=OFF ^ + -DCMARK_STATIC=ON ^ + -DQT_DIR=%QT_ROOT%/lib/cmake/Qt5 ^ + -DQt5_DIR=%QT_ROOT%/lib/cmake/Qt5 ^ + -DINSTALL_QT=ON ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_INSTALL_PREFIX="%cd%/install" ^ + -DCMAKE_PREFIX_PATH="%INSTALL_DIR%" ^ + -DCMAKE_TOOLCHAIN_FILE="%VCPKG_DIR%/scripts/buildsystems/vcpkg.cmake" ^ + -DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON ^ + -DVCPKG_APPLOCAL_DEPS=ON - cmake --build . --config Release - cmake --build . --config Release --target package artifacts: - - path: build_$(BUILD_TARGERT)\ChineseChessControl_Setup_*.exe + - path: build_$(BUILD_TARGERT)\ChineseChessControl*.exe test: off @@ -149,31 +92,16 @@ test: off deploy: - provider: GitHub #release: ChineseChessControl$(appveyor_build_version) - description: '中国象棋控件 变更详见[ChangeLog.md](ChangeLog.md)' + #description: '中国象棋控件 变更详见[ChangeLog.md](ChangeLog.md)' #token: https://github.com/settings/tokens #password encrypt: https://ci.appveyor.com/tools/encrypt auth_token: secure: 43H2qtl+UKweMvnOUVCGuNkAElipdJJcCIzQcyE+Idb/Jo4Nm1fta2zsNwYiaQP/ #draft: true - prerelease: true - force_update: true + #prerelease: true + #force_update: true on: - BUILD_TARGERT: windows_msvc #TOOLCHAIN_VERSION: 14 #QT_VERSION: 5.6.3 #BUILD_ARCH: x86 appveyor_repo_tag: true # deploy on tag push only - - - provider: GitHub - #release: ChineseChessControl$(appveyor_build_version) - description: '中国象棋控件 变更详见[ChangeLog.md](ChangeLog.md)' - #token: https://github.com/settings/tokens - #password encrypt: https://ci.appveyor.com/tools/encrypt - auth_token: - secure: 43H2qtl+UKweMvnOUVCGuNkAElipdJJcCIzQcyE+Idb/Jo4Nm1fta2zsNwYiaQP/ - #draft: true - prerelease: true - force_update: true - on: - BUILD_TARGERT: android - appveyor_repo_tag: true # deploy on tag push only