CI: modify VCPKG_MANIFEST_DIR in msvc.yml #188
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build_msvc | ||
on: | ||
workflow_call: | ||
outputs: | ||
name: | ||
description: "The artifact name" | ||
value: ${{ jobs.build_msvc.outputs.name }} | ||
jobs: | ||
build_msvc: | ||
strategy: | ||
matrix: | ||
BUILD_TYPE: [Release, Debug] | ||
qt_version: [6.6.2, 5.15.2, 5.12.12] | ||
include: | ||
- qt_version: 6.6.2 | ||
VCPKG_TARGET_TRIPLET: x64-windows | ||
VCPKG_PLATFORM_TOOLSET: v142 | ||
qt_arch: win64_msvc2019_64 | ||
CMAKE_GENERATOR_PLATFORM: x64 | ||
qt_modules: qtscxml qtserialport qtwebchannel qtwebsockets qtwebview qtpositioning | ||
- qt_version: 5.15.2 | ||
VCPKG_TARGET_TRIPLET: x64-windows | ||
VCPKG_PLATFORM_TOOLSET: v142 | ||
qt_arch: win64_msvc2019_64 | ||
CMAKE_GENERATOR_PLATFORM: x64 | ||
VCPKG_MANIFEST_DIR: "\vcpkg\manifests" | ||
- qt_version: 5.12.12 | ||
VCPKG_TARGET_TRIPLET: x86-windows | ||
VCPKG_PLATFORM_TOOLSET: v141 | ||
qt_arch: win32_msvc2017 | ||
CMAKE_GENERATOR_PLATFORM: Win32 | ||
VCPKG_MANIFEST_DIR: "\vcpkg\manifests" | ||
runs-on: windows-latest | ||
env: | ||
SOURCE_DIR: ${{github.workspace}}\.cache\source | ||
TOOSL_DIR: ${{github.workspace}}\.cache\tools | ||
INSTALL_DIR: ${{github.workspace}}\.cache\install_${{matrix.qt_arch}}_${{matrix.BUILD_TYPE}} | ||
CMAKE_GENERATOR: "Visual Studio 17 2022" | ||
VCPKG_PLATFORM_TOOLSET: ${{matrix.VCPKG_PLATFORM_TOOLSET}} | ||
VCPKG_MANIFEST_DIR: "${{github.workspace}}${{matrix.VCPKG_MANIFEST_DIR}}" | ||
CMAKE_GENERATOR_PLATFORM: ${{matrix.CMAKE_GENERATOR_PLATFORM}} | ||
SerialPortAssistant_VERSION: v0.5.21 | ||
VCPKGGITCOMMITID: a1a1cbc975abf909a6c8985a6a2b8fe20bbd9bd6 | ||
VCPKG_TARGET_TRIPLET: ${{matrix.VCPKG_TARGET_TRIPLET}} | ||
qt_modules: qtwebengine ${{matrix.qt_modules}} | ||
artifact_name: build_msvc | ||
# Map the job outputs to step outputs | ||
outputs: | ||
name: ${{ env.artifact_name }} | ||
defaults: | ||
run: | ||
shell: cmd | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- name: Make directories | ||
run: | | ||
cmake -E make_directory ${{github.workspace}}/build | ||
cmake -E make_directory ${{env.SOURCE_DIR}} | ||
cmake -E make_directory ${{env.TOOSL_DIR}} | ||
cmake -E make_directory ${{env.INSTALL_DIR}} | ||
- name: Cache installed | ||
uses: actions/cache@v3 | ||
id: cache-installed | ||
with: | ||
path: | | ||
${{env.INSTALL_DIR}} | ||
key: cache-installed-msvc-${{ matrix.qt_arch}} | ||
- name: run-vcpkg | ||
uses: lukka/run-vcpkg@v11 | ||
with: | ||
vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}} | ||
vcpkgDirectory: ${{runner.workspace}}/vcpkg/ | ||
- name: Install Qt | ||
uses: jurplel/install-qt-action@v3 | ||
with: | ||
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: 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 SerialPortAssistant | ||
working-directory: ${{github.workspace}}/build | ||
env: | ||
RabbitCommon_DIR: ${{env.SOURCE_DIR}}/RabbitCommon | ||
run: | | ||
cmake ${{github.workspace}} ^ | ||
-A ${{matrix.CMAKE_GENERATOR_PLATFORM}} ^ | ||
-T ${{matrix.VCPKG_PLATFORM_TOOLSET}} ^ | ||
-DCMARK_SHARED=OFF ^ | ||
-DCMARK_TESTS=OFF ^ | ||
-DCMARK_STATIC=ON ^ | ||
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^ | ||
-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 ^ | ||
-DVCPKG_APPLOCAL_DEPS=ON ^ | ||
-DINSTALL_QT=ON | ||
cmake --build . --config ${{matrix.BUILD_TYPE}} | ||
- name: Package | ||
working-directory: ${{github.workspace}}/build | ||
if: ${{ matrix.BUILD_TYPE == 'Release' }} | ||
run: | | ||
cmake --install . --config ${{matrix.BUILD_TYPE}} --component=Application | ||
cmake --install . --config ${{matrix.BUILD_TYPE}} --component=Runtime | ||
cmake --install . --config ${{matrix.BUILD_TYPE}} --component=DependLibraries | ||
copy /Y vcpkg_installed\${{matrix.VCPKG_TARGET_TRIPLET}}\bin\*.dll install\bin | ||
makensis Install.nsi | ||
copy /Y SerialPortAssistant_Setup_${{env.SerialPortAssistant_VERSION}}.exe SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe | ||
- name: Update configure file | ||
if: ${{ matrix.BUILD_TYPE == 'Release' && matrix.qt_version == '6.6.2' }} | ||
working-directory: ${{github.workspace}}\build | ||
run: | | ||
.\install\bin\SerialPortAssistant.exe ^ | ||
-f "${{github.workspace}}\build\update_${{matrix.qt_arch}}_${{matrix.qt_version}}.json" ^ | ||
--foc 1 ^ | ||
-p ${{github.workspace}}\build\SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{ matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe ^ | ||
-m "${{env.SerialPortAssistant_VERSION}}" ^ | ||
-u "https://github.com/KangLin/SerialPortAssistant/releases/download/${{env.SerialPortAssistant_VERSION}}/SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{ matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe ;https://sourceforge.net/projects/rabbitSerialPortAssistant/files/${{env.SerialPortAssistant_VERSION}}/SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{ matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe" | ||
- name: Update artifact | ||
if: ${{ matrix.BUILD_TYPE == 'Release' && matrix.qt_version == '6.6.2' }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.artifact_name }} | ||
path: | | ||
${{github.workspace}}\build\SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{ matrix.qt_arch}}_qt${{matrix.qt_version}}_Setup.exe | ||
${{github.workspace}}\build\update_${{matrix.qt_arch}}_${{matrix.qt_version}}.json | ||
# - name: Upload To Github Release | ||
# if: ${{ matrix.BUILD_TYPE == 'Release' && '5.12.12' == matrix.qt_version && startsWith(github.ref, 'refs/tags/') }} | ||
# uses: softprops/action-gh-release@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# prerelease: true | ||
## body: | | ||
## [:cn: 修改日志](ChangeLog_zh_CN.md) [:us: Change log](ChangeLog.md) | ||
# files: | | ||
# ${{github.workspace}}\build\SerialPortAssistant_Setup_${{env.SerialPortAssistant_VERSION}}.exe | ||
# ${{github.workspace}}\build\update_windows.xml | ||
# |