Skip to content

Commit

Permalink
CI Windows annoyances with backslashes
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Apr 25, 2024
1 parent f5b5c9a commit d4348ca
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
15 changes: 9 additions & 6 deletions .github/ci_vcpkg_package_tests/run_ci_vcpkg_package_tests.py
Expand Up @@ -49,19 +49,22 @@ def run_test_with_rendering_backend(rendering_backend: str) -> bool:
def find_vcpkg_program() -> str:
possible_vcpkg_roots = [f"{REPO_DIR}/vcpkg"]
if "VCPKG_ROOT" in os.environ:
logging.info(f"Found VCPKG_ROOT in environment variables: {os.environ['VCPKG_ROOT']}")
print(f"Found VCPKG_ROOT in environment variables: {os.environ['VCPKG_ROOT']}")
possible_vcpkg_roots.append(os.environ["VCPKG_ROOT"])
if "VCPKG_INSTALLATION_ROOT" in os.environ:
logging.info(f"Found VCPKG_INSTALLATION_ROOT in environment variables: {os.environ['VCPKG_INSTALLATION_ROOT']}")
possible_vcpkg_roots.append(os.environ["VCPKG_INSTALLATION_ROOT"])

r = ""
for possible_vcpkg_root in possible_vcpkg_roots:
possible_vcpkg_program = os.path.join(possible_vcpkg_root, "vcpkg")
if os.path.exists(possible_vcpkg_program) or os.path.exists(possible_vcpkg_program + ".exe"):
r = possible_vcpkg_program
logging.info(f"Found vcpkg program at {r}")
break
possible_vcpkg_programs = [f"{possible_vcpkg_root}/vcpkg", f"{possible_vcpkg_root}/vcpkg.exe"]
for possible_vcpkg_program in possible_vcpkg_programs:
if os.path.isfile(possible_vcpkg_program):
r = possible_vcpkg_program
print(f"Found vcpkg program at {r}")
break
if len(r) > 0:
break
if len(r) == 0:
logging.error(f"Could not find vcpkg program, tried {possible_vcpkg_roots}")
sys.exit(1)
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/VcpkgDeps.yml
Expand Up @@ -53,7 +53,11 @@ jobs:
# This will read the dependencies from the vcpkg.json file,
# and the CMake preset from CMakePresets.json
run: |
export VCPKG_ROOT=${{ github.workspace }}/vcpkg
echo "Replacing annoying windows backslashes with forward slashes in VCPKG_ROOT"
echo "before VCPKG_ROOT=$VCPKG_ROOT"
VCPKG_ROOT=$(python -c "print('${{ github.workspace }}/vcpkg'.replace('\\\\', '/'))")
echo "after VCPKG_ROOT=$VCPKG_ROOT"
export VCPKG_ROOT
mkdir build
cd build
cmake .. --preset build_vcpkg_default -DCMAKE_BUILD_TYPE=Release
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/VcpkgPackage.yml
Expand Up @@ -80,6 +80,10 @@ jobs:
- name: run test
shell: bash
run: |
export VCPKG_ROOT=${{ github.workspace }}/vcpkg
echo "Replacing annoying windows backslashes with forward slashes in VCPKG_ROOT"
echo "before VCPKG_ROOT=$VCPKG_ROOT"
VCPKG_ROOT=$(python -c "print('${{ github.workspace }}/vcpkg'.replace('\\\\', '/'))")
echo "after VCPKG_ROOT=$VCPKG_ROOT"
export VCPKG_ROOT
cd .github/ci_vcpkg_package_tests
python run_ci_vcpkg_package_tests.py

0 comments on commit d4348ca

Please sign in to comment.