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

CI caching improvements #1016

Merged
merged 5 commits into from
Oct 11, 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
7 changes: 4 additions & 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 All @@ -71,6 +69,9 @@ runs:
- name: build ziti-edge-tunnel (linux)
if: runner.os == 'Linux'
uses: ./.github/actions/openziti-tunnel-build-action
env:
# map vcpkg cache so container uses the same directory as the rest of the workflow
"VCPKG_BINARY_SOURCES": "clear;files,/github/workspace/vcpkg_cache,readwrite"
with:
arch: ci-${{ inputs.preset }}
config: ${{ inputs.config }}
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,12 @@ 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}"

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
(
cd "${VCPKG_ROOT}"
git checkout master
git pull
./bootstrap-vcpkg.sh -disableMetrics
)

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

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

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,13 @@ for SAFE in \
git config --global --add safe.directory ${SAFE}
done

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

(
[[ -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,13 @@ for SAFE in \
git config --global --add safe.directory ${SAFE}
done

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

[[ -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,13 @@ for SAFE in \
git config --global --add safe.directory ${SAFE}
done

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

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

strategy:
fail-fast: false
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/cpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ 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) }}
# 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;files,${{ github.workspace }}/vcpkg_cache,readwrite"
steps:
- name: Debug action
uses: hmarr/debug-action@v3
Expand Down Expand Up @@ -92,9 +93,17 @@ jobs:
run: |
mv -v ./.github/actions/openziti-tunnel-build-action/${DISTRO_LABEL}/* ./.github/actions/openziti-tunnel-build-action/

- uses: actions/cache@v4
with:
key: deps-cpack-${{ matrix.arch.rpm }}-${{ matrix.distro.name }}-${{ matrix.distro.version }}-${{ hashFiles('./vcpkg.json') }}
path: ./vcpkg_cache

# entrypoint.sh uses the value of arch to select the cmake preset
- name: build binary and package
uses: ./.github/actions/openziti-tunnel-build-action
env:
# map vcpkg cache so container uses the same directory as the rest of the workflow
"VCPKG_BINARY_SOURCES": "clear;files,/github/workspace/vcpkg_cache,readwrite"
with:
arch: ${{ matrix.arch.cmake }}
config: RelWithDebInfo
Expand Down
Loading