Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CMakePresets #20

Merged
merged 25 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bd5cf51
Create cmake workflows
SchaichAlonso Oct 19, 2023
ffd7d73
Add CI workflow presets
SchaichAlonso Oct 19, 2023
b568d54
Use CMakePreset workflows
SchaichAlonso Oct 19, 2023
e37bcc6
Try to get a ninja
SchaichAlonso Oct 19, 2023
8e156e7
Try harder
SchaichAlonso Oct 19, 2023
508b1ff
Restore JUnit format
SchaichAlonso Oct 19, 2023
c20f233
Try forcing cl.exe usage on windows
SchaichAlonso Oct 19, 2023
fdf852e
Update build-and-test.yml
SchaichAlonso Oct 19, 2023
7833545
Revert "Try forcing cl.exe usage on windows"
SchaichAlonso Oct 19, 2023
f04c0c7
The error message smells like build-type selection bugs in qt
SchaichAlonso Oct 19, 2023
0366423
Enter-VsDevShell defaults to x86 [...]
SchaichAlonso Oct 20, 2023
36a485e
Setup configuration for testPresets
SchaichAlonso Oct 20, 2023
6df4170
Print DevShells
SchaichAlonso Oct 20, 2023
228f17c
Introduce c++20 dependency
SchaichAlonso Oct 20, 2023
7ac1b9a
Try merging the configure and build workflows
SchaichAlonso Oct 20, 2023
37941e0
Merge the test job, too
SchaichAlonso Oct 20, 2023
6dc86a7
Add ninjamulti generator and fix ninja to be ninjasingle
SchaichAlonso Oct 20, 2023
9d248d3
Update readme with new instructions
SchaichAlonso Oct 20, 2023
511cade
Use free runners. The big ones are only needed to seed nuget.
SchaichAlonso Oct 20, 2023
7bea6e2
Get rid of the unused shell scripts
SchaichAlonso Oct 20, 2023
5c94ade
Revert "Use free runners. The big ones are only needed to seed nuget."
SchaichAlonso Oct 20, 2023
834549a
[skip ci] Add Unix Makefile presets and reorder the file
SchaichAlonso Oct 20, 2023
fc120a1
Add make flows
SchaichAlonso Oct 20, 2023
dd0a6e3
Add visual studio 2022 project file CI runs
SchaichAlonso Oct 20, 2023
fcffaca
Build only the more common presets on pull requests
SchaichAlonso Oct 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 194 additions & 0 deletions .github/workflows/all-presets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
name: All Presets

on:
push:
branches: [ "main" ]
workflow_dispatch:

env:
VCPKG_BINARY_SOURCES: clear;nuget,GitHub,readwrite;nugettimeout,3600

jobs:
build:
strategy:
fail-fast: false
matrix:
generator: ['ninja', 'ninjamulti']
vcpkg_target_triplet: ['x64-windows', 'x64-windows-static', 'x64-linux']
build_type: ['debug', 'release']
include:
- vcpkg_target_triplet: 'x64-linux'
mono: 'mono'
os: 'ubuntu-22.04'
- vcpkg_target_triplet: 'x64-windows'
mono: ''
os: 'windows-2022'
VsDevShellArch: 'amd64'
- vcpkg_target_triplet: 'x64-windows-static'
mono: ''
os: 'windows-2022'
VsDevShellArch: 'amd64'

- generator: 'make'
vcpkg_target_triplet: 'x64-linux'
build_type: 'debug'
mono: 'mono'
os: 'ubuntu-22.04'
- generator: 'make'
vcpkg_target_triplet: 'x64-linux'
build_type: 'release'
mono: 'mono'
os: 'ubuntu-22.04'
- generator: 'vs2022'
vcpkg_target_triplet: 'x64-windows'
build_type: 'debug'
mono: ''
os: 'windows-2022'
VsDevShellArch: 'amd64'
- generator: 'vs2022'
vcpkg_target_triplet: 'x64-windows'
build_type: 'release'
mono: ''
os: 'windows-2022'
VsDevShellArch: 'amd64'
- generator: 'vs2022'
vcpkg_target_triplet: 'x64-windows-static'
build_type: 'debug'
mono: ''
os: 'windows-2022'
VsDevShellArch: 'amd64'
- generator: 'vs2022'
vcpkg_target_triplet: 'x64-windows-static'
build_type: 'release'
mono: ''
os: 'windows-2022'
VsDevShellArch: 'amd64'

permissions:
contents: read
packages: write

runs-on: ${{ matrix.os }}-8-cores

env:
VCPKG_TARGET_TRIPLET: ${{ matrix.vcpkg_target_triplet }}

steps:
- name: Update ubuntu repository
if: ${{ matrix.os == 'ubuntu-22.04' }}
shell: bash
run: sudo apt-get update

- name: Install ubuntu icu dependencies
if: ${{ matrix.os == 'ubuntu-22.04' }}
shell: bash
run: sudo apt-get install autoconf-archive

- name: Install ubuntu qtbase dependencies (documented)
if: ${{ matrix.os == 'ubuntu-22.04' }}
shell: bash
run: sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev

- name: Install ubuntu qtbase dependencies (undocumented)
if: ${{ matrix.os == 'ubuntu-22.04' }}
shell: bash
run: sudo apt-get install libgl1-mesa-dev mesa-common-dev

- name: Install ubuntu Ninja
if: ${{ matrix.os == 'ubuntu-22.04' }}
shell: bash
run: sudo sudo apt-get install ninja-build

- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Bootstrap VCPKG
shell: bash
run: ./vcpkg/bootstrap-vcpkg.sh

- name: Setup NuGet
shell: bash
run: |
${{matrix.mono}} $((./vcpkg/vcpkg fetch nuget) | tail -n 1) sources add \
-source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
-storepasswordincleartext \
-name "GitHub" \
-username "${{ github.repository_owner }}" \
-password "${{ secrets.GITHUB_TOKEN }}"
${{matrix.mono}} $((./vcpkg/vcpkg fetch nuget) | tail -n 1) setapikey "${{ secrets.GITHUB_TOKEN }}" \
-source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
${{matrix.mono}} $((./vcpkg/vcpkg fetch nuget) | tail -n 1) sources

- name: Print VsDevShells
if: ${{ matrix.os == 'windows-2022' }}
shell: pwsh
run: |
& "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -requires "Microsoft.VisualStudio.Component.Windows11SDK.*"

- name: CMake Workflow (VsDevShell)
if: ${{ matrix.os == 'windows-2022' }}
shell: pwsh
run: |
$vsInstallationPath=(& "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -requires "Microsoft.VisualStudio.Component.Windows11SDK.*" -property "installationPath")
Import-Module "${vsInstallationPath}/Common7/Tools/Microsoft.VisualStudio.DevShell.dll"
# invoking vcvarsall leaves the shell in another directory...
pushd .
Enter-VsDevShell -VsInstallPath ${vsInstallationPath} -Arch ${{ matrix.VsDevShellArch }}
popd
cmake --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }}
cmake --build --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }}
ctest --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }}

- name: CMake Workflow (non VsDevShell)
if: ${{ matrix.os != 'windows-2022' }}
shell: pwsh
run: |
cmake --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }}
cmake --build --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }}
ctest --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }}

- name: Archive VCPKG Log Files
if: always()
uses: actions/upload-artifact@v3
with:
name: buildlogs
path: |
vcpkg/buildtrees/*/*.txt
vcpkg/buildtrees/*/*.log

- name: Create Test Result Artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (${{ matrix.vcpkg_target_triplet }})
path: |
build/*.xml



publish-teshresults:
name: Publish Test Results
needs: build
if: >
always() &&
github.event.sender.login != 'dependabot[bot]' &&
( github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository )
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write

steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: artifacts

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
artifacts/**/*.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: TinyORM Tests
name: Typical Presets

on:
push:
Expand All @@ -15,36 +15,27 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ['windows-2022', 'ubuntu-22.04']
vcpkg_library_linkage: ['dynamic', 'static']
build_type: ['Debug', 'Release']
vcpkg_target_triplet: ['x64-windows', 'x64-linux']
build_type: ['release']
include:
- os: 'ubuntu-22.04'
- vcpkg_target_triplet: 'x64-linux'
mono: 'mono'
- os: 'windows-2022'
os: 'ubuntu-22.04'
generator: 'make'
- vcpkg_target_triplet: 'x64-windows'
mono: ''
- os: 'ubuntu-22.04'
vcpkg_library_linkage: 'static'
vcpkg_target_triplet: 'x64-linux'
- os: 'windows-2022'
vcpkg_library_linkage: 'dynamic'
vcpkg_target_triplet: 'x64-windows'
- os: 'windows-2022'
vcpkg_library_linkage: 'static'
vcpkg_target_triplet: 'x64-windows-static'
exclude:
- os: 'ubuntu-22.04'
vcpkg_library_linkage: 'dynamic'
os: 'windows-2022'
VsDevShellArch: 'amd64'
generator: 'vs2022'

permissions:
contents: read
packages: write

runs-on: ${{ matrix.os }}-8-cores
runs-on: ${{ matrix.os }}-8-cores

env:
VCPKG_TARGET_TRIPLET: ${{ matrix.vcpkg_target_triplet }}
BUILD_TYPE: ${{ matrix.build_type }}

steps:
- name: Update ubuntu repository
Expand All @@ -66,8 +57,12 @@ jobs:
if: ${{ matrix.os == 'ubuntu-22.04' }}
shell: bash
run: sudo apt-get install libgl1-mesa-dev mesa-common-dev


- name: Install ubuntu Ninja
if: ${{ matrix.os == 'ubuntu-22.04' }}
shell: bash
run: sudo sudo apt-get install ninja-build

- name: Checkout Repository
uses: actions/checkout@v3
with:
Expand All @@ -89,14 +84,34 @@ jobs:
${{matrix.mono}} $((./vcpkg/vcpkg fetch nuget) | tail -n 1) setapikey "${{ secrets.GITHUB_TOKEN }}" \
-source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
${{matrix.mono}} $((./vcpkg/vcpkg fetch nuget) | tail -n 1) sources

- name: Build

- name: Print VsDevShells
if: ${{ matrix.os == 'windows-2022' }}
shell: pwsh
run: ./build.ps1
run: |
& "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -requires "Microsoft.VisualStudio.Component.Windows11SDK.*"

- name: Run Tests
- name: CMake Workflow (VsDevShell)
if: ${{ matrix.os == 'windows-2022' }}
shell: pwsh
run: pwsh ./test.ps1
run: |
$vsInstallationPath=(& "${env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe" -requires "Microsoft.VisualStudio.Component.Windows11SDK.*" -property "installationPath")
Import-Module "${vsInstallationPath}/Common7/Tools/Microsoft.VisualStudio.DevShell.dll"
# invoking vcvarsall leaves the shell in another directory...
pushd .
Enter-VsDevShell -VsInstallPath ${vsInstallationPath} -Arch ${{ matrix.VsDevShellArch }}
popd
cmake --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }}
cmake --build --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }}
ctest --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }}

- name: CMake Workflow (non VsDevShell)
if: ${{ matrix.os != 'windows-2022' }}
shell: pwsh
run: |
cmake --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }}
cmake --build --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }}
ctest --preset ci-${{ matrix.generator }}-${{ matrix.vcpkg_target_triplet }}-${{ matrix.build_type }}

- name: Archive VCPKG Log Files
if: always()
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ else()
set(MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Sql Test)
qt_standard_project_setup()

Expand All @@ -26,5 +30,11 @@ target_link_libraries(TinyOrmQueryTest PRIVATE Qt::Core Qt::Sql Qt::Test TinyOrm
set_target_properties(TinyOrmQueryTest PROPERTIES MSVC_RUNTIME_LIBRARY ${MSVC_RUNTIME_LIBRARY})

enable_testing()

add_test(NAME QSqlQueryTest COMMAND QSqlQueryTest -o "${CMAKE_CURRENT_BINARY_DIR}/QSqlQueryTest.xml,junitxml" COMMAND_EXPAND_LISTS)
set_property(TEST QSqlQueryTest PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin")
set_property(TEST QSqlQueryTest APPEND PROPERTY ENVIRONMENT_MODIFICATION "QT_PLUGIN_PATH=set:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/Qt6/plugins")

add_test(NAME TinyOrmQueryTest COMMAND TinyOrmQueryTest -o "${CMAKE_CURRENT_BINARY_DIR}/TinyOrmQueryTest.xml,junitxml" COMMAND_EXPAND_LISTS)
set_property(TEST TinyOrmQueryTest PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin")
set_property(TEST TinyOrmQueryTest APPEND PROPERTY ENVIRONMENT_MODIFICATION "QT_PLUGIN_PATH=set:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/Qt6/plugins")
Loading