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

perf: simplify checks with the automated installation of vcpkg #80

Merged
merged 5 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 14 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,17 @@ jobs:
- OFF

include:
- presets:
os:
name: windows-latest
type: windows
compiler:
name: msvc
type: msvc
arch:
name: x64
type: x64
- presets: {os: {name: windows-latest, type: windows}, compiler: {name: msvc, type: msvc}}
arch: {name: x64, type: x64}
vcpkg: true
export_mode: ON
- presets: {os: {name: ubuntu-latest, type: linux}, compiler: {name: gcc-11, type: gcc}}
arch: {name: x64, type: x64}
vcpkg: false
export_mode: OFF
exclude:
- export_mode: ON
- vcpkg: false

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -149,6 +146,11 @@ jobs:
python: true
opencppcoverage: ${{ contains(matrix.presets.os.type, 'windows' )}}

- name: Disable pre-installedd vcpkg for testing automaical vcpkg installation
if: ${{ matrix.vcpkg == false }}
run: |
echo "VCPKG_INSTALLATION_ROOT=" >> $GITHUB_ENV

- name: Lcov for coverage
if: contains(matrix.presets.compiler.type, 'gcc') && contains(matrix.presets.os.type, 'linux')
run: |
Expand All @@ -171,7 +173,6 @@ jobs:
timeout 10s bash -c "while [ ! -f ~/.wine/system.reg ] ; do echo 'waiting for wine registry to be created' ; sleep 1 ; done" && echo "wine registry created"
sed -i '/"PATH"/ s|"$|;Z:/usr/lib/gcc/x86_64-w64-mingw32/10-posix;Z:/usr/x86_64-w64-mingw32/lib"|g' ~/.wine/system.reg && echo "wine registry updated"


- name: Configure CMake
run: |
cmake -S . --preset=${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }} -DCMAKE_BUILD_TYPE=Debug -DCODE_COVERAGE=ON -DBUILD_TESTING=ON ${{ matrix.presets.os.type == 'linux' && '-DUSE_SANITIZER=OFF' || '' }} ${{ matrix.export_mode == 'ON' && '-DVCPKG_EXPORT_MODE=ON' || '' }}
Expand All @@ -190,8 +191,8 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
directory: out/build/${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }}/code_coverage
files: ./coverage.xml, ./coverage.info, ./coverage.json
flags: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ matrix.vcpkg }}${{ matrix.export_mode == 'ON' && '-export' || '' }}
name: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ matrix.vcpkg }}${{ matrix.export_mode == 'ON' && '-export' || '' }}-coverage
flags: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}${{ matrix.vcpkg == true && '-vcpkg' || '' }}${{ matrix.export_mode == 'ON' && '-export' || '' }}
name: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}${{ matrix.vcpkg == true && '-vcpkg' || '' }}${{ matrix.export_mode == 'ON' && '-export' || '' }}-coverage

pass:
if: always()
Expand Down
3 changes: 2 additions & 1 deletion cmake/vcpkg/bootstrap/vcpkg_bootstrap.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ endfunction()

# find root
function(_vcpkg_find_root cache_dir_name out_vcpkg_root)
if(DEFINED ENV{VCPKG_INSTALLATION_ROOT})
if(DEFINED ENV{VCPKG_INSTALLATION_ROOT}
AND NOT "$ENV{VCPKG_INSTALLATION_ROOT}" STREQUAL "")
set(root "$ENV{VCPKG_INSTALLATION_ROOT}")
elseif("${__vcpkg_bootstrap_host}" STREQUAL "Windows")
set(root "$ENV{LOCALAPPDATA}/vcpkg/projects/${cache_dir_name}/cache")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,17 @@ jobs:
- OFF

include:
- presets:
os:
name: windows-latest
type: windows
compiler:
name: msvc
type: msvc
arch:
name: x64
type: x64
- presets: {os: {name: windows-latest, type: windows}, compiler: {name: msvc, type: msvc}}
arch: {name: x64, type: x64}
vcpkg: true
export_mode: ON
- presets: {os: {name: ubuntu-latest, type: linux}, compiler: {name: gcc-11, type: gcc}}
arch: {name: x64, type: x64}
vcpkg: false
export_mode: OFF
exclude:
- export_mode: ON
- vcpkg: false

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -149,6 +146,11 @@ jobs:
python: true
opencppcoverage: ${{ contains(matrix.presets.os.type, 'windows' )}}

- name: Disable pre-installedd vcpkg for testing automaical vcpkg installation
if: ${{ matrix.vcpkg == false }}
run: |
echo "VCPKG_INSTALLATION_ROOT=" >> $GITHUB_ENV

- name: Lcov for coverage
if: contains(matrix.presets.compiler.type, 'gcc') && contains(matrix.presets.os.type, 'linux')
run: |
Expand All @@ -171,7 +173,6 @@ jobs:
timeout 10s bash -c "while [ ! -f ~/.wine/system.reg ] ; do echo 'waiting for wine registry to be created' ; sleep 1 ; done" && echo "wine registry created"
sed -i '/"PATH"/ s|"$|;Z:/usr/lib/gcc/x86_64-w64-mingw32/10-posix;Z:/usr/x86_64-w64-mingw32/lib"|g' ~/.wine/system.reg && echo "wine registry updated"


- name: Configure CMake
run: |
cmake -S . --preset=${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }} -DCMAKE_BUILD_TYPE=Debug -DCODE_COVERAGE=ON -DBUILD_TESTING=ON ${{ matrix.presets.os.type == 'linux' && '-DUSE_SANITIZER=OFF' || '' }} ${{ matrix.export_mode == 'ON' && '-DVCPKG_EXPORT_MODE=ON' || '' }}
Expand All @@ -190,8 +191,8 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
directory: out/build/${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }}/code_coverage
files: ./coverage.xml, ./coverage.info, ./coverage.json
flags: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ matrix.vcpkg }}${{ matrix.export_mode == 'ON' && '-export' || '' }}
name: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ matrix.vcpkg }}${{ matrix.export_mode == 'ON' && '-export' || '' }}-coverage
flags: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}${{ matrix.vcpkg == true && '-vcpkg' || '' }}${{ matrix.export_mode == 'ON' && '-export' || '' }}
name: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}${{ matrix.vcpkg == true && '-vcpkg' || '' }}${{ matrix.export_mode == 'ON' && '-export' || '' }}-coverage

pass:
if: always()
Expand Down
3 changes: 2 additions & 1 deletion template/cmake/vcpkg/bootstrap/vcpkg_bootstrap.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ endfunction()

# find root
function(_vcpkg_find_root cache_dir_name out_vcpkg_root)
if(DEFINED ENV{VCPKG_INSTALLATION_ROOT})
if(DEFINED ENV{VCPKG_INSTALLATION_ROOT}
AND NOT "$ENV{VCPKG_INSTALLATION_ROOT}" STREQUAL "")
set(root "$ENV{VCPKG_INSTALLATION_ROOT}")
elseif("${__vcpkg_bootstrap_host}" STREQUAL "Windows")
set(root "$ENV{LOCALAPPDATA}/vcpkg/projects/${cache_dir_name}/cache")
Expand Down
Loading