Skip to content

Commit 8228705

Browse files
CI: Don't run bootstrap if we restored from cache (#32610)
* CI: Don't run bootstrap if we restored from cache Handle caching and log upload directly within the bootstrap action, and don't perform the actual bootstrap if we have a cache hit. Include the platform name in the cache key. * Silabs requirements are for non-Docker builds
1 parent f4f1e19 commit 8228705

File tree

9 files changed

+46
-55
lines changed

9 files changed

+46
-55
lines changed

.github/actions/bootstrap-cache/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Bootstrap cache
2-
description: Bootstrap cache
2+
description: Bootstrap cache (deprecated)
33
runs:
44
using: "composite"
55
steps:

.github/actions/bootstrap/action.yaml

+33-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,40 @@ inputs:
55
description: "Platform name"
66
required: false
77
default: none
8+
bootstrap-log-name:
9+
description: "Bootstrap log name"
10+
required: false
11+
default: bootstrap-logs-${{ github.job }}
12+
813
runs:
914
using: "composite"
1015
steps:
11-
- name: Bootstrap
16+
- uses: Wandalen/wretry.action@v1.4.10
17+
name: Bootstrap from cache
18+
id: bootstrap-cache
19+
continue-on-error: true
20+
with:
21+
action: buildjet/cache@v4
22+
attempt_limit: 3
23+
attempt_delay: 2000
24+
with: |
25+
key: ${{ runner.os }}-${{ inputs.platform }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }}
26+
path: |
27+
.environment
28+
build_overrides/pigweed_environment.gni
29+
30+
- name: Run bootstrap
31+
if: fromJSON(steps.bootstrap-cache.outputs.outputs).cache-hit != 'true' # retry returns all outputs in `outputs`
32+
env:
33+
PW_NO_CIPD_CACHE_DIR: Y
1234
shell: bash
13-
run: bash scripts/bootstrap.sh -p all,${{ inputs.platform }}
35+
run: source scripts/bootstrap.sh -p all,${{ inputs.platform }}
36+
37+
- name: Uploading bootstrap logs
38+
uses: actions/upload-artifact@v3
39+
if: always() && !env.ACT && fromJSON(steps.bootstrap-cache.outputs.outputs).cache-hit != 'true'
40+
with:
41+
name: ${{ inputs.bootstrap-log-name }}
42+
path: |
43+
.environment/gn_out/.ninja_log
44+
.environment/pigweed-venv/*.log

.github/actions/checkout-submodules-and-bootstrap/action.yaml

+1-8
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,14 @@ runs:
2626
with:
2727
platform: ${{ inputs.platform }}
2828
extra-parameters: ${{ inputs.extra-submodule-parameters }}
29-
- name: Bootstrap Cache
30-
uses: ./.github/actions/bootstrap-cache
3129
- name: Bootstrap
3230
uses: ./.github/actions/bootstrap
33-
env:
34-
PW_NO_CIPD_CACHE_DIR: Y
3531
with:
3632
platform: ${{ inputs.platform }}
33+
bootstrap-log-name: ${{ inputs.bootstrap-log-name }}
3734
- name: Dump disk info after checkout submodule & Bootstrap
3835
shell: bash
3936
run: scripts/dump_diskspace_info.sh
40-
- name: Upload Bootstrap Logs
41-
uses: ./.github/actions/upload-bootstrap-logs
42-
with:
43-
bootstrap-log-name: ${{ inputs.bootstrap-log-name }}
4437
- name: Work around TSAN ASLR issues
4538
if: runner.os == 'Linux' && !env.ACT
4639
shell: bash

.github/actions/upload-bootstrap-logs/action.yaml

-18
This file was deleted.

.github/workflows/cirque.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
with:
5858
platform: linux
5959

60+
# TODO: Is what's being cached here actually compatible with a regular bootstrap?
6061
- name: Bootstrap Cache
6162
uses: ./.github/actions/bootstrap-cache
6263
- name: Bootstrap Cirque

.github/workflows/fuzzing-build.yaml

-8
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,8 @@ jobs:
4646
run: |
4747
mkdir objdir-clone || true
4848
49-
- name: Bootstrap Cache
50-
uses: ./.github/actions/bootstrap-cache
5149
- name: Bootstrap
5250
uses: ./.github/actions/bootstrap
53-
- name: Upload Bootstrap Logs
54-
uses: ./.github/actions/upload-bootstrap-logs
5551

5652
- name: Build all-clusters-app
5753
run: |
@@ -84,12 +80,8 @@ jobs:
8480
run: |
8581
mkdir objdir-clone || true
8682
87-
- name: Bootstrap Cache
88-
uses: ./.github/actions/bootstrap-cache
8983
- name: Bootstrap
9084
uses: ./.github/actions/bootstrap
91-
- name: Upload Bootstrap Logs
92-
uses: ./.github/actions/upload-bootstrap-logs
9385

9486
- name: Build all-clusters-app
9587
run: |

.github/workflows/release_artifacts.yaml

-8
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,8 @@ jobs:
3939
uses: actions/checkout@v4
4040
with:
4141
ref: "${{ github.event.inputs.releaseTag }}"
42-
- name: Bootstrap Cache
43-
uses: ./.github/actions/bootstrap-cache
4442
- name: Bootstrap
4543
uses: ./.github/actions/bootstrap
46-
- name: Upload Bootstrap Logs
47-
uses: ./.github/actions/upload-bootstrap-logs
4844

4945
- name: Build
5046
run: scripts/examples/esp_example.sh all-clusters-app
@@ -74,12 +70,8 @@ jobs:
7470
uses: actions/checkout@v4
7571
with:
7672
ref: "${{ github.event.inputs.releaseTag }}"
77-
- name: Bootstrap Cache
78-
uses: ./.github/actions/bootstrap-cache
7973
- name: Bootstrap
8074
uses: ./.github/actions/bootstrap
81-
- name: Upload Bootstrap Logs
82-
uses: ./.github/actions/upload-bootstrap-logs
8375

8476
- name: Build example EFR32 Lock App
8577
run: scripts/examples/gn_silabs_example.sh examples/lock-app/efr32/

scripts/setup/bootstrap.sh

+10-10
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ _install_additional_pip_requirements() {
2121
# figure out additional pip install items
2222
while [ $# -gt 0 ]; do
2323
case $1 in
24-
-p | --platform)
25-
_SETUP_PLATFORM=$2
26-
shift # argument
27-
shift # value
28-
;;
29-
*)
30-
shift
31-
;;
24+
-p | --platform)
25+
_SETUP_PLATFORM=$2
26+
shift # argument
27+
shift # value
28+
;;
29+
*)
30+
shift
31+
;;
3232
esac
3333
done
3434

@@ -41,7 +41,7 @@ _install_additional_pip_requirements() {
4141

4242
for platform in ${_SETUP_PLATFORM}; do
4343
# Allow none as an alias of nothing extra installed (like -p none)
44-
if [ "$platform" != "none" ]; then
44+
if [ "$platform" != "none" -a -e "$_CHIP_ROOT/scripts/setup/requirements.$platform.txt" ]; then
4545
echo "Installing pip requirements for $platform..."
4646
pip install -q \
4747
-r "$_CHIP_ROOT/scripts/setup/requirements.$platform.txt" \
@@ -66,7 +66,7 @@ _bootstrap_or_activate() {
6666
local _BOOTSTRAP_NAME="${_BOOTSTRAP_PATH##*/}"
6767
local _BOOTSTRAP_DIR="${_BOOTSTRAP_PATH%/*}"
6868
# Strip off the 'scripts[/setup]' directory, leaving the root of the repo.
69-
_CHIP_ROOT="$(cd "${_BOOTSTRAP_DIR%/setup}/.." > /dev/null && pwd)"
69+
_CHIP_ROOT="$(cd "${_BOOTSTRAP_DIR%/setup}/.." >/dev/null && pwd)"
7070

7171
local _CONFIG_FILE="scripts/setup/environment.json"
7272

0 commit comments

Comments
 (0)