Skip to content

workflows bugfix removed unused code #15

workflows bugfix removed unused code

workflows bugfix removed unused code #15

Workflow file for this run

name: Vcpkg Windows
on:
push:
branches:
- main
- gh-actions
# I will not remove the build folders before a job execution it's not necessary and
# it will be faster this way. I can still remove them manually if needed or
# if something goes wrong.
jobs:
vcpkg-windows:
name: Vcpkg Windows
# Self-hosted runner is Windows 11 (Release Preview channel - 23H2)
runs-on: [self-hosted, windows]
# runs-on: windows-2022
strategy:
matrix:
build-type:
- key: debug
name: Debug
- key: release
name: Release
qt:
# GitHub Free Plan is not enough for this (no money 💵)
# - key: qt5
# name: Qt5
# version: 5.15.2
# vcpkg-qt: qt5-base
# vcpkg-qt-features: qt5-base[core]
# vcpkg-tinyorm: tinyorm-qt5
# vcpkg-tinyorm-features: tinyorm-qt5[core,tom-example]
- key: qt6
name: Qt6
version: 6.5.3
vcpkg-qt: qtbase
vcpkg-qt-features: qtbase[core,sql-sqlite]
vcpkg-tinyorm: tinyorm
vcpkg-tinyorm-features: tinyorm[core,sql-sqlite,tom-example]
steps:
- uses: actions/checkout@v4
with:
path: main
# I don't install everything to the TinyRunnerWorkPath as in all other workflows, I leave it
# this way because I tried to refactor it to the env.TinyRunnerWorkPath and it looks terrible
- name: TinyORM prepare environment
run: |
$runnerWorkPath = Resolve-Path -Path '${{ runner.workspace }}/..'
"TinyRunnerWorkPath=$runnerWorkPath" >> $env:GITHUB_ENV
# Starts with the merydeye-
$isSelfHostedRunner = '${{ runner.name }}'.StartsWith('merydeye-') ? $true : $false
"TinyIsSelfHostedRunner=$isSelfHostedRunner" >> $env:GITHUB_ENV
$parallel = $isSelfHostedRunner ? 8 : 2
"TinyParallel=$parallel" >> $env:GITHUB_ENV
$tinyormPath = Resolve-Path -Path ./main
"TinyORMPath=$tinyormPath" >> $env:GITHUB_ENV
- name: Ninja install latest version
if: env.TinyIsSelfHostedRunner == 'true'
uses: seanmiddleditch/gha-setup-ninja@master
with:
destination: ${{ env.TinyRunnerWorkPath }}/ninja-build
- name: CMake and Ninja install latest versions
if: env.TinyIsSelfHostedRunner == 'false'
uses: lukka/get-cmake@latest
with:
useLocalCache: true
useCloudCache: false
- name: Visual Studio 2022 pwsh shell setup
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
# Must be after the ilammy/msvc-dev-cmd@v1 because vcvars64 overrides the VCPKG_ROOT
- name: vcpkg prepare environment
run: |
"VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" >> $env:GITHUB_ENV
'VCPKG_DEFAULT_TRIPLET=x64-windows' >> $env:GITHUB_ENV
'VCPKG_MAX_CONCURRENCY=${{ env.TinyParallel }}' >> $env:GITHUB_ENV
$vcpkgPath = Resolve-Path -Path '${{ env.TinyORMPath }}/cmake/vcpkg'
$portsPath = Join-Path -Path $vcpkgPath -ChildPath 'ports'
"VCPKG_OVERLAY_PORTS=$portsPath" >> $env:GITHUB_ENV
$tripletsPath = Join-Path -Path $vcpkgPath -ChildPath 'triplets'
"VCPKG_OVERLAY_TRIPLETS=$tripletsPath" >> $env:GITHUB_ENV
# Binary caching
'VCPKG_BINARY_SOURCES=clear;x-gha,readwrite' >> $env:GITHUB_ENV
- name: vcpkg prepare binary caching
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Self-hosted runner prepare environment
if: env.TinyIsSelfHostedRunner == 'true'
run: |
'C:\Program Files\CMake\bin' >> $env:GITHUB_PATH
'E:\c_libs\vcpkg-runner' >> $env:GITHUB_PATH
- name: CMake print version
run: |
cmake.exe --version
# The following two steps are not needed below they only test if the vcpkg classic mode works
# correctly
- name: vcpkg install ${{ matrix.qt.vcpkg-qt }} (classic mode)
if: matrix.build-type.key == 'debug'
run: |
vcpkg.exe install ${{ matrix.qt.vcpkg-qt-features }}
- name: vcpkg install ${{ matrix.qt.vcpkg-tinyorm }} (classic mode)
if: matrix.build-type.key == 'debug'
run: |
vcpkg.exe install ${{ matrix.qt.vcpkg-tinyorm-features }}
# Prepare TinyORM-HelloWorld project
- name: HelloWorld checkout
uses: actions/checkout@v4
with:
repository: silverqx/TinyORM-HelloWorld
path: HelloWorld
- name: HelloWorld move HelloWorld.sqlite3 (to parent folder)
working-directory: HelloWorld
run: |
Copy-Item -Path ./HelloWorld.sqlite3 -Destination '${{ runner.workspace }}' -Force
- name: TinyORM create folder for build trees
run: |
$buildTreesPath = '../TinyORM-builds-cmake'
if (-not (Test-Path $buildTreesPath)) {
New-Item -Type Directory $buildTreesPath
}
- name: HelloWorld create folder for build trees
run: |
$buildTreesPath = '../HelloWorld-builds-cmake'
if (-not (Test-Path $buildTreesPath)) {
New-Item -Type Directory $buildTreesPath
}
# VcpkgManifest method with the VCPKG_APPLOCAL_DEPS (no install or deployment)
# ---
- name: 🪡 VcpkgManifest method with the VCPKG_APPLOCAL_DEPS (no install or deployment) 🪡
run: |
Write-Output 'no-op'
- name: HelloWorld prepare VcpkgManifest method (vcpkg.json)
working-directory: HelloWorld
run: >-
Copy-Item -Path ./vcpkg.json.VcpkgManifest.${{ matrix.qt.name }}.example
-Destination ./vcpkg.json
- name: HelloWorld prepare VcpkgManifest method (update REF and SHA512)
working-directory: ${{ env.TinyORMPath }}
run: |
. ./tools/private/Common-Deploy.ps1
$portfilePath = Resolve-Path -Path './cmake/vcpkg/ports/tinyorm/portfile.cmake'
$vcpkgRef = '${{ github.ref_name }}'
Edit-VcpkgRefAndHash -Project 'silverqx/TinyORM' -Ref $vcpkgRef -PortFile $portfilePath `
-EnableRetries
# Don't use ccache for the VcpkgManifest method as the vcpkg has its own binary caching
- name: HelloWorld cmake configure (vcpkgmanifest-msvc-${{ matrix.build-type.key }})
working-directory: HelloWorld
run: >-
cmake.exe
-S .
-B '${{ runner.workspace }}/HelloWorld-builds-cmake/build-vcpkgmanifest-msvc-${{ matrix.build-type.key }}'
-G Ninja
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
-D CMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON
-D CMAKE_BUILD_TYPE:STRING=${{ matrix.build-type.name }}
-D VCPKG_APPLOCAL_DEPS:BOOL=ON
-D RESOLVE_TINYORM:STRING=VcpkgManifest
- name: HelloWorld cmake build ✨ (vcpkgmanifest-msvc-${{ matrix.build-type.key }})
working-directory: >-
../HelloWorld-builds-cmake/build-vcpkgmanifest-msvc-${{ matrix.build-type.key }}
run: |
cmake.exe --build . --target all --parallel ${{ env.TinyParallel }}
# Related issue: https://github.com/microsoft/vcpkg/issues/33539
- name: HelloWorld finish VCPKG_APPLOCAL_DEPS (Debug)
if: matrix.qt.key == 'qt6' && matrix.build-type.key == 'debug'
working-directory: >-
../HelloWorld-builds-cmake/build-vcpkgmanifest-msvc-${{ matrix.build-type.key }}
run: |
Copy-Item -Path ./vcpkg_installed/x64-windows/debug/bin/sqlite3.dll -Destination .
Copy-Item -Path ./vcpkg_installed/x64-windows/debug/Qt6 -Destination . -Recurse -Force
- name: HelloWorld finish VCPKG_APPLOCAL_DEPS (Release)
if: matrix.qt.key == 'qt6' && matrix.build-type.key == 'release'
working-directory: >-
../HelloWorld-builds-cmake/build-vcpkgmanifest-msvc-${{ matrix.build-type.key }}
run: |
Copy-Item -Path ./vcpkg_installed/x64-windows/bin/sqlite3.dll -Destination .
Copy-Item -Path ./vcpkg_installed/x64-windows/Qt6 -Destination . -Recurse -Force
# Qt5 has a problem too, it's deployed but to the wrong folder, the Release build is ok
- name: HelloWorld finish VCPKG_APPLOCAL_DEPS (Debug)
if: matrix.qt.key == 'qt5' && matrix.build-type.key == 'debug'
working-directory: >-
../HelloWorld-builds-cmake/build-vcpkgmanifest-msvc-${{ matrix.build-type.key }}
run: |
if (-not (Test-Path ./debug)) {
New-Item -type Directory ./debug
}
Copy-Item -Path ./plugins -Destination ./debug -Recurse -Force
- name: HelloWorld execute (SQLite) 🏁
working-directory: >-
../HelloWorld-builds-cmake/build-vcpkgmanifest-msvc-${{ matrix.build-type.key }}
run: |
.\HelloWorld.exe
env:
TINYORM_HELLOWORLD_DB_SQLITE_DATABASE: ../../HelloWorld.sqlite3
# The FetchContent and Manual methods below need Qt installed and to be accessible on the system
- name: Qt v${{ matrix.qt.version }} install base components
if: env.TinyIsSelfHostedRunner == 'false'
uses: jurplel/install-qt-action@v3
with:
archives: qtbase
version: ${{ matrix.qt.version }}
arch: win64_msvc2019_64
cache: true
setup-python: false
extra: --external 7z.exe
dir: ${{ env.TinyRunnerWorkPath }}
- name: ${{ matrix.qt.name }} prepare environment
if: env.TinyIsSelfHostedRunner == 'true'
run: |
'C:\Qt\${{ matrix.qt.version }}\msvc2019_64\bin' >> $env:GITHUB_PATH
# Prepare ccache
#
# The TinyORM build in the Manual method and the FetchContent method are using the ccache,
# packages build through the FetchContent CMake module are also using the ccache, they respect
# the CMAKE_CXX_COMPILER_LAUNCHER option.
# Don't use the default CCACHE_DIR path on self-hosted runners
- name: Ccache prepare environment
if: env.TinyIsSelfHostedRunner == 'true'
run: |
$ccacheDirPath = Join-Path -Path '${{ runner.workspace }}' -ChildPath ccache
"CCACHE_DIR=$ccacheDirPath" >> $env:GITHUB_ENV
- name: Ccache initialize
if: env.TinyIsSelfHostedRunner == 'false'
id: ccache-initialize-cache
run: |
Write-Output '::group::Install'
choco install ccache --yes
Write-Output '::endgroup::'
Write-Output '::group::get-config cache_dir'
$cachePath = ccache.exe --get-config cache_dir
"CachePath=$cachePath" >> $env:GITHUB_OUTPUT
"ImageOS=$env:ImageOS" >> $env:GITHUB_OUTPUT
Write-Output '::endgroup::'
- name: Ccache restore cache 🕺
if: env.TinyIsSelfHostedRunner == 'false'
uses: actions/cache@v3
with:
path: ${{ env.cache_path }}
key: ${{ runner.os }}-${{ env.image_os }}-ccache-${{ env.cache_name }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-${{ env.image_os }}-ccache-${{ env.cache_name }}-
env:
cache_name: vcpkg-windows-${{ matrix.qt.key }}-${{ matrix.build-type.key }}
cache_path: ${{ steps.ccache-initialize-cache.outputs.CachePath }}
image_os: ${{ steps.ccache-initialize-cache.outputs.ImageOS }}
- name: Ccache prepare configuration 🥳
run: |
# ~ 70 * 3 + 100
ccache.exe --set-config max_size=500M
ccache.exe --set-config sloppiness=pch_defines,time_macros
- name: Ccache print version and configuration
run: |
Write-Output '::group::Print version'
ccache.exe --version
Write-Output '::endgroup::'
Write-Output '::group::Print ccache config'
ccache.exe --show-config
Write-Output '::endgroup::'
# Manual method linking against the TinyORM build tree (no install or deployment)
# ---
- name: 🪡 Manual method linking against the TinyORM build tree (no install or deployment) 🪡
run: |
Write-Output 'no-op'
- name: Ccache clear statistics
run: |
ccache.exe --zero-stats
# CMAKE_DISABLE_PRECOMPILE_HEADERS=ON is correct (Windows ccache doesn't work well with PCH)
- name: TinyORM cmake configure (manual-msvc-${{ matrix.build-type.key }})
working-directory: ${{ env.TinyORMPath }}
run: >-
cmake.exe
-S .
-B '${{ runner.workspace }}/TinyORM-builds-cmake/build-manual-msvc-${{ matrix.build-type.key }}'
-G Ninja
-D CMAKE_CXX_COMPILER_LAUNCHER:FILEPATH='ccache.exe'
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
-D CMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON
-D CMAKE_BUILD_TYPE:STRING=${{ matrix.build-type.name }}
-D CMAKE_EXPORT_PACKAGE_REGISTRY:BOOL=OFF
-D VCPKG_APPLOCAL_DEPS:BOOL=OFF
-D VERBOSE_CONFIGURE:BOOL=ON
-D MATCH_EQUAL_EXPORTED_BUILDTREE:BOOL=ON
-D MYSQL_PING:BOOL=OFF
-D BUILD_TESTS:BOOL=OFF
-D ORM:BOOL=ON
-D TOM:BOOL=OFF
-D TOM_EXAMPLE:BOOL=OFF
- name: TinyORM cmake build ✨ (manual-msvc-${{ matrix.build-type.key }})
working-directory: >-
../TinyORM-builds-cmake/build-manual-msvc-${{ matrix.build-type.key }}
run: |
cmake.exe --build . --target all --parallel ${{ env.TinyParallel }}
- name: Ccache print statistics
run: |
ccache.exe --show-stats -vv
# Build and execute the HelloWorld console application
- name: HelloWorld prepare Manual method (vcpkg.json)
working-directory: HelloWorld
run: |
Copy-Item -Path ./vcpkg.json.Manual.example -Destination ./vcpkg.json
# CMAKE_DISABLE_PRECOMPILE_HEADERS=ON is correct (no need to use PCH for one TU)
- name: HelloWorld cmake configure (manual-msvc-${{ matrix.build-type.key }})
working-directory: HelloWorld
run: >-
cmake.exe
-S .
-B '${{ runner.workspace }}/HelloWorld-builds-cmake/build-manual-msvc-${{ matrix.build-type.key }}'
-G Ninja
-D CMAKE_PREFIX_PATH:PATH='${{ runner.workspace }}/TinyORM-builds-cmake/build-manual-msvc-${{ matrix.build-type.key }}'
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
-D CMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON
-D CMAKE_BUILD_TYPE:STRING=${{ matrix.build-type.name }}
-D VCPKG_APPLOCAL_DEPS:BOOL=OFF
-D RESOLVE_TINYORM:STRING=Manual
- name: HelloWorld cmake build ✨ (manual-msvc-${{ matrix.build-type.key }})
working-directory: >-
../HelloWorld-builds-cmake/build-manual-msvc-${{ matrix.build-type.key }}
run: |
cmake.exe --build . --target all --parallel ${{ env.TinyParallel }}
- name: HelloWorld execute (SQLite) 🏁
working-directory: >-
../HelloWorld-builds-cmake/build-manual-msvc-${{ matrix.build-type.key }}
run: |
$env:Path = '..\..\TinyORM-builds-cmake\build-manual-msvc-${{ matrix.build-type.key }};' + $env:Path
.\HelloWorld.exe
env:
TINYORM_HELLOWORLD_DB_SQLITE_DATABASE: ../../HelloWorld.sqlite3
# FetchContent method (with install or deployment)
# ---
- name: 🪡 FetchContent method (with install or deployment) 🪡
run: |
Write-Output 'no-op'
- name: HelloWorld prepare FetchContent method (vcpkg.json)
working-directory: HelloWorld
run: |
Copy-Item -Path ./vcpkg.json.FetchContent.example -Destination ./vcpkg.json
- name: HelloWorld prepare FetchContent method (update GIT_TAG)
working-directory: HelloWorld
run: |
$toolsPath = Resolve-Path -Path '${{ env.TinyORMPath }}/tools/private'
$gitTag = 'origin/${{ github.ref_name }}'
& "$toolsPath/Edit-FetchContentGitTag.ps1" -CMakeLists ./CMakeLists.txt -GitTag $gitTag
- name: Ccache clear statistics
run: |
ccache.exe --zero-stats
# CMAKE_DISABLE_PRECOMPILE_HEADERS=ON is correct (Windows ccache doesn't work well with PCH)
- name: HelloWorld cmake configure (fetchcontent-msvc-${{ matrix.build-type.key }})
working-directory: HelloWorld
run: >-
cmake.exe
-S .
-B '${{ runner.workspace }}/HelloWorld-builds-cmake/build-fetchcontent-msvc-${{ matrix.build-type.key }}'
-G Ninja
-D CMAKE_CXX_COMPILER_LAUNCHER:FILEPATH='ccache.exe'
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
-D CMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON
-D CMAKE_BUILD_TYPE:STRING=${{ matrix.build-type.name }}
-D CMAKE_INSTALL_PREFIX:PATH='${{ runner.workspace }}/HelloWorld-FetchContent-Install/${{ matrix.build-type.name }}'
-D CMAKE_EXPORT_PACKAGE_REGISTRY:BOOL=OFF
-D VCPKG_APPLOCAL_DEPS:BOOL=OFF
-D VERBOSE_CONFIGURE:BOOL=ON
-D MYSQL_PING:BOOL=OFF
-D BUILD_TESTS:BOOL=OFF
-D ORM:BOOL=ON
-D TOM:BOOL=OFF
-D TOM_EXAMPLE:BOOL=OFF
-D RESOLVE_TINYORM:STRING=FetchContent
# Also install it, to test the deployment process
- name: HelloWorld cmake build and install ✨ (fetchcontent-msvc-${{ matrix.build-type.key }})
working-directory: >-
../HelloWorld-builds-cmake/build-fetchcontent-msvc-${{ matrix.build-type.key }}
run: |
cmake.exe --build . --target install --parallel ${{ env.TinyParallel }}
- name: Ccache print statistics
run: |
ccache.exe --show-stats -vv
- name: HelloWorld execute (SQLite) 🏁
working-directory: ../HelloWorld-FetchContent-Install/${{ matrix.build-type.name }}/bin
run: |
.\HelloWorld.exe
env:
TINYORM_HELLOWORLD_DB_SQLITE_DATABASE: ../../../HelloWorld.sqlite3