Skip to content
Permalink
Browse files

fix caching of deps in mac workflow (#41440)

  • Loading branch information
3nids committed Feb 15, 2021
1 parent 3751408 commit dc0e80bcd0015b859175ae10e9731ae2211f729d
Showing with 45 additions and 9 deletions.
  1. +45 −9 .github/workflows/macos-build.yml
@@ -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:
@@ -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: |
@@ -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}
@@ -112,7 +148,7 @@ jobs:
-DWITH_3D=TRUE \
../QGIS
- name: build QGIS
- name: Build QGIS
run: |
cd ${BUILD_DIR}
make -j $(sysctl -n hw.ncpu)

0 comments on commit dc0e80b

Please sign in to comment.