Save/Restore seperately in MacOS/Windows caching workflows. (#11199)
Only *save* cache on the default branch (develop), restore it everywhere it fits
This commit is contained in:
@@ -14,6 +14,10 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
build-MacOS:
|
build-MacOS:
|
||||||
runs-on: macos-${{ inputs.macos_ver }}
|
runs-on: macos-${{ inputs.macos_ver }}
|
||||||
|
# Only pushes to the default branch (develop) populate the cache; PR / merge_group runs
|
||||||
|
# restore it but never save, so they stop filling up the repo's Actions cache storage.
|
||||||
|
env:
|
||||||
|
SAVE_CACHE: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
@@ -24,8 +28,9 @@ jobs:
|
|||||||
id: r_image
|
id: r_image
|
||||||
run: echo "ver=$ImageVersion" >> "$GITHUB_OUTPUT"
|
run: echo "ver=$ImageVersion" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Cache Homebrew downloads
|
- name: Restore Homebrew cache
|
||||||
uses: actions/cache@v6
|
id: brew-cache
|
||||||
|
uses: actions/cache/restore@v6
|
||||||
with:
|
with:
|
||||||
path: ~/Library/Caches/Homebrew
|
path: ~/Library/Caches/Homebrew
|
||||||
key: brew-macos-${{ inputs.macos_ver }}-${{ steps.r_image.outputs.ver }}
|
key: brew-macos-${{ inputs.macos_ver }}-${{ steps.r_image.outputs.ver }}
|
||||||
@@ -41,13 +46,21 @@ jobs:
|
|||||||
brew install
|
brew install
|
||||||
platformio yaml-cpp libuv openssl@3 libusb argp-standalone pkg-config ulfius jsoncpp
|
platformio yaml-cpp libuv openssl@3 libusb argp-standalone pkg-config ulfius jsoncpp
|
||||||
|
|
||||||
|
- name: Save Homebrew cache
|
||||||
|
if: env.SAVE_CACHE == 'true' && steps.brew-cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/cache/save@v6
|
||||||
|
with:
|
||||||
|
path: ~/Library/Caches/Homebrew
|
||||||
|
key: brew-macos-${{ inputs.macos_ver }}-${{ steps.r_image.outputs.ver }}
|
||||||
|
|
||||||
- name: Get release version string
|
- name: Get release version string
|
||||||
run: |
|
run: |
|
||||||
echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
||||||
id: version
|
id: version
|
||||||
|
|
||||||
- name: Cache PlatformIO packages
|
- name: Restore PlatformIO cache
|
||||||
uses: actions/cache@v6
|
id: pio-cache
|
||||||
|
uses: actions/cache/restore@v6
|
||||||
with:
|
with:
|
||||||
path: ~/.platformio/.cache
|
path: ~/.platformio/.cache
|
||||||
key: pio-macos-${{ inputs.macos_ver }}-${{ hashFiles('platformio.ini', 'variants/native/portduino.ini') }}
|
key: pio-macos-${{ inputs.macos_ver }}-${{ hashFiles('platformio.ini', 'variants/native/portduino.ini') }}
|
||||||
@@ -60,6 +73,13 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
PKG_VERSION: ${{ steps.version.outputs.long }}
|
PKG_VERSION: ${{ steps.version.outputs.long }}
|
||||||
|
|
||||||
|
- name: Save PlatformIO cache
|
||||||
|
if: env.SAVE_CACHE == 'true' && steps.pio-cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/cache/save@v6
|
||||||
|
with:
|
||||||
|
path: ~/.platformio/.cache
|
||||||
|
key: pio-macos-${{ inputs.macos_ver }}-${{ hashFiles('platformio.ini', 'variants/native/portduino.ini') }}
|
||||||
|
|
||||||
- name: List output files
|
- name: List output files
|
||||||
run: ls -lah .pio/build/native-macos/
|
run: ls -lah .pio/build/native-macos/
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ jobs:
|
|||||||
uses: ./.github/actions/setup-native
|
uses: ./.github/actions/setup-native
|
||||||
|
|
||||||
- name: Setup Emscripten SDK
|
- name: Setup Emscripten SDK
|
||||||
uses: emscripten-core/setup-emsdk@v16
|
uses: emscripten-core/setup-emsdk@0822153d7a5488b70a269cfa0a631b2a86ab4da2 # 'v17' main
|
||||||
with:
|
with:
|
||||||
version: 6.0.1
|
version: 6.0.1
|
||||||
actions-cache-folder: emsdk-cache
|
actions-cache-folder: emsdk-cache
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
build-Windows:
|
build-Windows:
|
||||||
runs-on: windows-${{ inputs.windows_ver }}
|
runs-on: windows-${{ inputs.windows_ver }}
|
||||||
|
# Only pushes to the default branch (develop) populate the cache; PR / merge_group runs
|
||||||
|
# restore it but never save, so they stop filling up the repo's Actions cache storage.
|
||||||
|
env:
|
||||||
|
SAVE_CACHE: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }}
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
# UCRT64 is the MinGW-w64 environment native-windows targets; the `msys`
|
# UCRT64 is the MinGW-w64 environment native-windows targets; the `msys`
|
||||||
@@ -71,8 +75,9 @@ jobs:
|
|||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install platformio
|
pip install platformio
|
||||||
|
|
||||||
- name: Cache PlatformIO packages
|
- name: Restore PlatformIO cache
|
||||||
uses: actions/cache@v6
|
id: pio-cache
|
||||||
|
uses: actions/cache/restore@v6
|
||||||
with:
|
with:
|
||||||
path: ~/.platformio/.cache
|
path: ~/.platformio/.cache
|
||||||
key: pio-windows-${{ inputs.windows_ver }}-${{ hashFiles('platformio.ini', 'variants/native/portduino.ini') }}
|
key: pio-windows-${{ inputs.windows_ver }}-${{ hashFiles('platformio.ini', 'variants/native/portduino.ini') }}
|
||||||
@@ -94,6 +99,13 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
PKG_VERSION: ${{ steps.version.outputs.long }}
|
PKG_VERSION: ${{ steps.version.outputs.long }}
|
||||||
|
|
||||||
|
- name: Save PlatformIO cache
|
||||||
|
if: env.SAVE_CACHE == 'true' && steps.pio-cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/cache/save@v6
|
||||||
|
with:
|
||||||
|
path: ~/.platformio/.cache
|
||||||
|
key: pio-windows-${{ inputs.windows_ver }}-${{ hashFiles('platformio.ini', 'variants/native/portduino.ini') }}
|
||||||
|
|
||||||
- name: List output files
|
- name: List output files
|
||||||
run: ls -lah .pio/build/native-windows/
|
run: ls -lah .pio/build/native-windows/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user