Skip to content

Commit

Permalink
control vcpkg cache directory
Browse files Browse the repository at this point in the history
  • Loading branch information
scareything committed Oct 11, 2024
1 parent 0f049b8 commit a3bced6
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 17 deletions.
4 changes: 1 addition & 3 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ runs:
- uses: actions/cache@v4
with:
key: deps-${{ inputs.preset }}-${{ hashFiles('./vcpkg.json') }}
path: |
./vcpkg/packages
./build/vcpkg_installed
path: ./vcpkg_cache

- uses: lukka/[email protected] # pin version to avoid failed glibc dependency on ubuntu 20 runners. go back to @latest when ubuntu 22+ is adopted for runner os.
if: runner.os != 'Linux'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,20 @@ for SAFE in \
git config --global --add safe.directory ${SAFE}
done

export VCPKG_ROOT="${PWD}/vcpkg"
# ${VCPKG_ROOT}/packages will have been populated from outside of the container, by a different user. tell git it's ok.
git config --global --add safe.directory "${VCPKG_ROOT}"
(
cd "${VCPKG_ROOT}"
git checkout master
git pull
./bootstrap-vcpkg.sh -disableMetrics
)

if [ ! -d "${VCPKG_ROOT}/ports" ]; then
# the packages/ directory may have been populated from cache by now
# but git clone refuses to clone into a non-empty directory, so get
# vcpkg without using clone
git init "${VCPKG_ROOT}"
(cd "${VCPKG_ROOT}"; git remote add -f origin https://github.com/microsoft/vcpkg; git checkout master)
"${VCPKG_ROOT}/bootstrap-vcpkg.sh" -disableMetrics
fi
# set VCPKG_BINARY_SOURCES to the container-mapped path that the rest of the workflow is using
export VCPKG_BINARY_SOURCES="clear;file,${PWD}/vcpkg_cache"

echo "======== here comes the env"
env
pwd
ls
echo "======== that is all"
echo "======== here comes the df"
df
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ for SAFE in \
git config --global --add safe.directory ${SAFE}
done

(
cd "${VCPKG_ROOT}"
git checkout master
git pull
./bootstrap-vcpkg.sh -disableMetrics
)

# set VCPKG_BINARY_SOURCES to the container-mapped path that the rest of the workflow is using
export VCPKG_BINARY_SOURCES="clear;file,${PWD}/vcpkg_cache"

cmake -E make_directory ./build
(
[[ -d ./build ]] && rm -r ./build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ for SAFE in \
git config --global --add safe.directory ${SAFE}
done

(
cd "${VCPKG_ROOT}"
git checkout master
git pull
./bootstrap-vcpkg.sh -disableMetrics
)

# set VCPKG_BINARY_SOURCES to the container-mapped path that the rest of the workflow is using
export VCPKG_BINARY_SOURCES="clear;file,${PWD}/vcpkg_cache"

(
[[ -d ./build ]] && rm -r ./build
cmake -E make_directory ./build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ for SAFE in \
git config --global --add safe.directory ${SAFE}
done

(
cd "${VCPKG_ROOT}"
git checkout master
git pull
./bootstrap-vcpkg.sh -disableMetrics
)

# set VCPKG_BINARY_SOURCES to the container-mapped path that the rest of the workflow is using
export VCPKG_BINARY_SOURCES="clear;file,${PWD}/vcpkg_cache"

[[ -d ./build ]] && rm -r ./build
cmake \
-E make_directory \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ for SAFE in \
git config --global --add safe.directory ${SAFE}
done

(
cd "${VCPKG_ROOT}"
git checkout master
git pull
./bootstrap-vcpkg.sh -disableMetrics
)

# set VCPKG_BINARY_SOURCES to the container-mapped path that the rest of the workflow is using
export VCPKG_BINARY_SOURCES="clear;file,${PWD}/vcpkg_cache"

[[ -d ./build ]] && rm -r ./build
cmake \
-E make_directory \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ${{ matrix.os }}
name: build ${{ matrix.preset }}
env:
"_VCPKG_BINARY_SOURCES": "clear;file,${{ github.workspace }}/vcpkg_cache,readwrite"
"VCPKG_BINARY_SOURCES": "clear;file,${{ github.workspace }}/vcpkg_cache,readwrite"

strategy:
fail-fast: false
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/cpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ jobs:
needs: set_matrix
name: ${{ matrix.arch.rpm }} ${{ matrix.distro.name }} ${{ matrix.distro.version }}
runs-on: ubuntu-20.04
# build image name it from matrix values name:version unless override container is specified
container: ${{ matrix.distro.container || format('{0}:{1}', matrix.distro.name, matrix.distro.version) }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.set_matrix.outputs.matrix) }}
env:
ZITI_DEB_TEST_REPO: ${{ vars.ZITI_DEB_TEST_REPO || 'zitipax-openziti-deb-test' }}
ZITI_RPM_TEST_REPO: ${{ vars.ZITI_RPM_TEST_REPO || 'zitipax-openziti-rpm-test' }}
"VCPKG_BINARY_SOURCES": "clear;file,${{ github.workspace }}/vcpkg_cache,readwrite"
steps:
- name: Debug action
uses: hmarr/debug-action@v3
Expand Down

0 comments on commit a3bced6

Please sign in to comment.