CI: modify ci #83
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: 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.1, 5.15.2, 5.12.12] | ||
include: | ||
- qt_version: 6.6.1 | ||
VCPKG_TARGET_TRIPLET: x64-windows | ||
VCPKG_PLATFORM_TOOLSET: v142 | ||
qt_arch: win64_msvc2019_64 | ||
CMAKE_GENERATOR_PLATFORM: x64 | ||
qt_modules: qtscxml qtmultimedia qtwebengine 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 | ||
qt_modules: qtwebengine | ||
- qt_version: 5.15.2 | ||
VCPKG_TARGET_TRIPLET: x86-windows | ||
VCPKG_PLATFORM_TOOLSET: v142 | ||
qt_arch: win32_msvc2019 | ||
CMAKE_GENERATOR_PLATFORM: Win32 | ||
qt_modules: qtwebengine | ||
- qt_version: 5.12.12 | ||
VCPKG_TARGET_TRIPLET: x86-windows | ||
VCPKG_PLATFORM_TOOLSET: v141 | ||
qt_arch: win32_msvc2017 | ||
CMAKE_GENERATOR_PLATFORM: Win32 | ||
qt_modules: qtwebengine | ||
runs-on: windows-latest | ||
env: | ||
SOURCE_DIR: ${{github.workspace}}\.cache\source | ||
TOOSL_DIR: ${{github.workspace}}\.cache\tools | ||
INSTALL_DIR: ${{github.workspace}}\.cache\install | ||
CMAKE_GENERATOR: "Visual Studio 17 2022" | ||
VCPKG_PLATFORM_TOOLSET: ${{matrix.VCPKG_PLATFORM_TOOLSET}} | ||
CMAKE_GENERATOR_PLATFORM: ${{matrix.CMAKE_GENERATOR_PLATFORM}} | ||
Calendar_VERSION: v1.0.18 | ||
VCPKGGITCOMMITID: a1a1cbc975abf909a6c8985a6a2b8fe20bbd9bd6 | ||
qt_modules: ${{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: recursive | ||
- name: make directory | ||
run: | | ||
cmake -E make_directory ${{env.SOURCE_DIR}} | ||
cmake -E make_directory ${{env.TOOSL_DIR}} | ||
cmake -E make_directory ${{env.INSTALL_DIR}} | ||
cmake -E make_directory ${{github.workspace}}/build | ||
- name: Cache installed | ||
uses: actions/cache@v3 | ||
id: cache-installed | ||
with: | ||
path: | | ||
${{env.INSTALL_DIR}} | ||
key: cache-installed-msvc-qt${{matrix.qt_version}}_${{matrix.qt_arch}}_${{matrix.BUILD_TYPE}} | ||
- 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: install-qt-action | ||
- name: git clone RabbitCommon | ||
working-directory: ${{env.SOURCE_DIR}} | ||
run: git clone https://github.com/KangLin/RabbitCommon.git | ||
- name: Build Calendar | ||
env: | ||
RabbitCommon_DIR: ${{env.SOURCE_DIR}}/RabbitCommon | ||
run: | | ||
cmake -E make_directory ${{github.workspace}}/build | ||
cd ${{github.workspace}}/build | ||
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 ^ | ||
-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 }} | ||
cmake --build . --config ${{ matrix.BUILD_TYPE }} --target install | ||
- name: Package | ||
# if: ${{ matrix.BUILD_TYPE == 'Release' }} | ||
working-directory: ${{github.workspace}}\build | ||
run: | | ||
copy /Y ${{env.INSTALL_DIR}}\bin\*.dll install\bin | ||
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 | ||
7z a Calendar_${{env.Calendar_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.zip .\install\* | ||
makensis Install.nsi | ||
copy Calendar_Setup_${{env.Calendar_VERSION}}.exe Calendar_${{env.Calendar_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}.exe | ||
- name: Update configure file | ||
if: ${{ matrix.BUILD_TYPE == 'Release' }} | ||
working-directory: ${{github.workspace}}\build | ||
run: | | ||
.\install\bin\CalendarApp.exe ^ | ||
-f "${{github.workspace}}\build\update_${{matrix.qt_arch}}_${{matrix.qt_version}}.json" ^ | ||
--foc 1 ^ | ||
--pf ${{github.workspace}}\build\Calendar_${{env.Calendar_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}.exe ^ | ||
-m "${{env.Calendar_VERSION}}" ^ | ||
-u "https://github.com/KangLin/Calendar/releases/download/${{env.Calendar_VERSION}}/Calendar_${{env.Calendar_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}.exe;https://sourceforge.net/projects/rabbitcalendar/files/${{env.Calendar_VERSION}}/Calendar_${{env.Calendar_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}.exe" | ||
- name: Update xml file | ||
if: ${{ matrix.BUILD_TYPE == 'Release' && matrix.qt_version == '5.12.12' }} | ||
working-directory: ${{github.workspace}}\build | ||
run: | | ||
mv update_${{matrix.qt_arch}}_${{matrix.qt_version}}.json.xml update_windows.xml | ||
- name: Update artifact | ||
if: ${{ matrix.BUILD_TYPE == 'Release'}} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.artifact_name }} | ||
path: | | ||
${{github.workspace}}\build\Calendar_${{env.Calendar_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}.exe | ||
${{github.workspace}}\build\update_${{matrix.qt_arch}}_${{matrix.qt_version}}.json | ||
${{github.workspace}}\build\update_windows.xml |