Skip to content

Commit

Permalink
CI: checkout before vcpkg install (checkout may clean the folder)
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Apr 25, 2024
1 parent 14a5915 commit 02ad577
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 17 deletions.
23 changes: 23 additions & 0 deletions .github/ci_vcpkg_package_tests/run_ci_vcpkg_package_tests.py
@@ -1,3 +1,4 @@
import logging
import subprocess
import platform
import os
Expand Down Expand Up @@ -45,6 +46,28 @@ def run_test_with_rendering_backend(rendering_backend: str) -> bool:
if platform.system() == "Windows":
copy_mesa_libs_to_current_dir()

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']})
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):
r = possible_vcpkg_program
break
if len(r) == 0:
print(f"Could not find vcpkg program, tried {possible_vcpkg_roots}")
sys.exit(1)
return r

vcpkg_program = find_vcpkg_program()

if "VCPKG_ROOT" in os.environ:
vcpkg_root = os.environ["VCPKG_ROOT"]
elif "VCPKG_INSTALLATION_ROOT" in os.environ:
Expand Down
Expand Up @@ -25,6 +25,10 @@ jobs:


steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: install glfw & sdl requirements
if : ${{ matrix.config.os == 'ubuntu-latest' }}
shell: bash
Expand All @@ -35,18 +39,12 @@ jobs:
uses: johnwason/vcpkg-action@v6
id: vcpkg
with:
pkgs: 'nlohmann-json' # unrelated package, just to make the action happy
triplet: ${{ matrix.config.vcpkg_triplet }}
cache-key: ${{ matrix.config.os }}
revision: master
token: ${{ github.token }}
github-binarycache: true


- uses: actions/checkout@v4
with:
submodules: true

# - name: Setup interactive tmate session
# uses: mxschmitt/action-tmate@v3

Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/VcpkgPackage.yml
Expand Up @@ -26,15 +26,19 @@ jobs:
fail-fast: false
matrix:
config:
# - os: ubuntu-latest
# vcpkg_triplet: x64-linux-release
- os: ubuntu-latest
vcpkg_triplet: x64-linux-release
- os: macos-latest
vcpkg_triplet: x64-osx-release
# - os: windows-latest
# vcpkg_triplet: x64-windows-release
- os: windows-latest
vcpkg_triplet: x64-windows-release


steps:
- uses: actions/checkout@v4
with:
submodules: false

- name: install glfw & sdl requirements
if : ${{ matrix.config.os == 'ubuntu-latest' }}
shell: bash
Expand All @@ -45,17 +49,12 @@ jobs:
uses: johnwason/vcpkg-action@v6
id: vcpkg
with:
pkgs: 'nlohmann-json' # unrelated package, just to make the action happy
triplet: ${{ matrix.config.vcpkg_triplet }}
cache-key: ${{ matrix.config.os }}
revision: master
token: ${{ github.token }}
github-binarycache: true

- uses: actions/checkout@v4
with:
submodules: false

#
# Install utilities to be able to run a graphical OpenGL application
#
Expand All @@ -74,8 +73,8 @@ jobs:
# Extract the archive using 7-zip which is preinstalled on the GitHub Actions Windows runner
7z x mesa3d-23.1.9-release-msvc.7z -omesa3d
- name: Setup interactive tmate session
uses: mxschmitt/action-tmate@v3
# - name: Setup interactive tmate session
# uses: mxschmitt/action-tmate@v3

# Run the test
- name: run test
Expand Down

0 comments on commit 02ad577

Please sign in to comment.