From 77f4af1bbb288f782cb3e2a1a39ed42d03e927fe Mon Sep 17 00:00:00 2001 From: TeTeHacko Date: Mon, 30 Nov 2026 20:08:30 +0100 Subject: [PATCH] CI: public release fetches each env's libraries inside its first build Changelog: - Co-Authored-By: Claude Opus 5.5 --- .github/workflows/pub-release.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pub-release.yml b/.github/workflows/pub-release.yml index ddc1c61e..de52e0f4 100644 --- a/.github/workflows/pub-release.yml +++ b/.github/workflows/pub-release.yml @@ -274,12 +274,11 @@ jobs: echo "::error::$title failed: ${failed[*]}" exit 1 } - # 1) install. Nothing is cached here (reproducible), so each run - # downloads the platforms, toolchains and libraries: 8 minutes when - # done env by env. One env per distinct platform (+ platform_packages) - # installs those first, one at a time -- they are shared, concurrent - # installs would race in ~/.platformio. The other envs then only add - # their libraries, each into its own .pio/libdeps/: in parallel. + # 1) install the platforms. Nothing is cached here (reproducible), + # so each run downloads platforms, toolchains and libraries: 8 min + # env by env up front. One env per distinct platform (+ + # platform_packages) installs those first, one at a time -- they + # are shared in ~/.platformio, concurrent installs would race. envs=$(printf '%s\n' "${arts[@]}" | while read -r a; do echo "${spec[$a]%%|*}"; done | sort -u) mapfile -t first < <(pio project config --json-output | python3 -c ' import json, sys @@ -294,16 +293,17 @@ jobs: t0=$SECONDS for env in "${first[@]}"; do par install "install-$env"; done report "install" "${first[@]/#/install-}" - rest=() - for env in $envs; do [[ " ${first[*]} " == *" $env "* ]] || rest+=("install-$env"); done - par install "${rest[@]}" - report "install" "${rest[@]}" - echo "installed $(wc -w <<<"$envs") envs (${#first[@]} platforms first) in $((SECONDS - t0)) s" - # 2) compile, each artifact into its own build dir: one env comes in - # up to four flag sets + echo "installed ${#first[@]} platforms in $((SECONDS - t0)) s" + # 2) compile, each artifact into its own build dir (one env comes in + # up to four flag sets). An env's libraries come with its first + # build, into its own .pio/libdeps/, while other envs compile: + # the lock keeps its other flag sets from installing them at once. + locks="$RUNNER_TEMP/locks" + mkdir -p "$locks" compile() { local env flags suffix variant IFS='|' read -r env flags suffix variant <<<"${spec[$1]}" + flock "$locks/$env" pio pkg install -e "$env" || return 1 export FW_OTA_VARIANT=$variant PLATFORMIO_BUILD_DIR="$bdir/$1" PLATFORMIO_BUILD_FLAGS="$PUB_FLAGS $flags" pio run -j "$PIO_JOBS" -e "$env" || return 1 [ -f "$bdir/$1/$env/firmware.zip" ] || pio run -j "$PIO_JOBS" -t mergebin -e "$env" # ESP32 @@ -312,7 +312,7 @@ jobs: par compile "${arts[@]}" echo "compiled ${#arts[@]} artifacts in $((SECONDS - t1)) s ($PARALLEL at a time)" report "build" "${arts[@]}" - # 2) package in order: manifest.json, deltas and the version are + # 3) package in order: manifest.json, deltas and the version are # written one artifact at a time. The OTA tools read .pio/build/, # so that points at the artifact being packaged. mkdir -p .pio/build