Skip to content

Commit

Permalink
fix caching of deps in mac workflow (#41440)
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 9, 2021
1 parent b402544 commit d66b41a
Showing 1 changed file with 45 additions and 9 deletions.
54 changes: 45 additions & 9 deletions .github/workflows/macos-build.yml
Expand Up @@ -32,6 +32,9 @@ env:
QGIS_DEPS_VERSION: 0.6.0
CCACHE_DIR: /Users/runner/work/ccache
BUILD_DIR: /Users/runner/work/QGIS/build-QGIS
# apparently we cannot cache /opt directory as it fails to restore
# so we copy the deps in the home directory
DEPS_CACHE_DIR: /Users/runner/work/deps-cache

jobs:
mac_os_build:
Expand Down Expand Up @@ -65,33 +68,66 @@ jobs:
build-mac-ccache-${{ github.ref }}-
build-mac-ccache-refs/heads/master-
# Qt caching
- name: Cache Qt
id: cache-qt
uses: pat-s/always-upload-cache@v2.1.3
with:
path: /opt/Qt/${{ env.QT_VERSION }}
key: mac-qt-${{ env.QT_VERSION }}
path: ${{ env.DEPS_CACHE_DIR }}/Qt/${{ env.QT_VERSION }}
key: mac-qt-v4-${{ env.QT_VERSION }}

- name: Restore Qt
if: steps.cache-qt.outputs.cache-hit == 'true'
run: |
sudo mkdir -p /opt
sudo mkdir -p /opt/Qt
sudo cp -r ${DEPS_CACHE_DIR}/Qt/${QT_VERSION} /opt/Qt/${QT_VERSION}
- name: Download Qt
if: steps.cache-qt.outputs.cache-hit != 'true'
run: wget https://qgis.org/downloads/macos/deps/qt-${QT_VERSION}.tar.gz
run: |
wget https://qgis.org/downloads/macos/deps/qt-${QT_VERSION}.tar.gz
mkdir -p ${DEPS_CACHE_DIR}
mkdir -p ${DEPS_CACHE_DIR}/Qt
# QGIS-deps caching
- name: Cache qgis-deps
id: cache-deps
uses: pat-s/always-upload-cache@v2.1.3
with:
path: /opt/QGIS/qgis-deps-${{ env.QGIS_DEPS_VERSION }}
key: mac-qgis-deps-${{ env.QGIS_DEPS_VERSION }}
path: ${{ env.DEPS_CACHE_DIR }}/QGIS/qgis-deps-${{ env.QGIS_DEPS_VERSION }}
key: mac-qgis-deps-v4-${{ env.QGIS_DEPS_VERSION }}

- name: Download deps
- name: Restore qgis-deps
if: steps.cache-deps.outputs.cache-hit == 'true'
run: |
sudo mkdir -p /opt
sudo mkdir -p /opt/QGIS
sudo cp -r ${DEPS_CACHE_DIR}/QGIS/qgis-deps-${QGIS_DEPS_VERSION} /opt/QGIS/qgis-deps-${QGIS_DEPS_VERSION}
- name: Download qgis-deps
if: steps.cache-deps.outputs.cache-hit != 'true'
run: wget https://qgis.org/downloads/macos/deps/qgis-deps-${QGIS_DEPS_VERSION}.tar.gz
run: |
wget https://qgis.org/downloads/macos/deps/qgis-deps-${QGIS_DEPS_VERSION}.tar.gz
mkdir -p ${DEPS_CACHE_DIR}
mkdir -p ${DEPS_CACHE_DIR}/QGIS
- name: Install Qt and deps
env:
QT_ALREADY_CACHED: ${{ steps.cache-qt.outputs.cache-hit }}
QGIS_DEPS_ALREADY_CACHED: ${{ steps.cache-deps.outputs.cache-hit }}
run: |
wget https://qgis.org/downloads/macos/deps/install_qgis_deps-${QGIS_DEPS_VERSION}.bash
chmod +x ./install_qgis_deps-${QGIS_DEPS_VERSION}.bash
echo ::group::Install deps
sudo ./install_qgis_deps-${QGIS_DEPS_VERSION}.bash
echo ::endgroup::
[[ ${QT_ALREADY_CACHED} != "true" ]] && cp -r /opt/Qt/${QT_VERSION} ${DEPS_CACHE_DIR}/Qt/${QT_VERSION} || true
[[ ${QGIS_DEPS_ALREADY_CACHED} != "true" ]] && cp -r /opt/QGIS/qgis-deps-${QGIS_DEPS_VERSION} ${DEPS_CACHE_DIR}/QGIS/qgis-deps-${QGIS_DEPS_VERSION} || true
- name: Install ccache
run: |
Expand All @@ -100,7 +136,7 @@ jobs:
ccache --set-config=max_size=2.0G
ccache -s
- name: create build system
- name: Run cmake
run: |
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
Expand All @@ -115,7 +151,7 @@ jobs:
-DWITH_EPT=TRUE \
../QGIS
- name: build QGIS
- name: Build QGIS
run: |
cd ${BUILD_DIR}
make -j $(sysctl -n hw.ncpu)

0 comments on commit d66b41a

Please sign in to comment.