Use separate cache restore/save with unique keys per run #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Dev Release - RPi ARMv7 Thunder | |
| on: | |
| push: | |
| tags: | |
| - 'dev-*' | |
| env: | |
| TZ: Etc/UTC | |
| DEBIAN_FRONTEND: noninteractive | |
| FORCE_UNSAFE_CONFIGURE: 1 | |
| CONFIG_NAME: raspberrypi_armv7_thunder | |
| CCACHE_LIMIT: 3.5G | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository (without submodules) | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: false | |
| fetch-depth: 0 | |
| - name: Set up SSH for private repos | |
| run: | | |
| mkdir -p ~/.ssh | |
| ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts | |
| echo "${{ secrets.GHA_SSH_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| cat <<EOT >> ~/.ssh/config | |
| Host github.com | |
| IdentityFile ~/.ssh/id_ed25519 | |
| IdentitiesOnly yes | |
| EOT | |
| echo "β SSH configured" | |
| - name: Checkout submodules | |
| run: | | |
| echo "π¦ Checking out submodules..." | |
| git submodule sync --recursive | |
| git submodule update --init --recursive | |
| echo "β Submodules checked out" | |
| # Try to restore downloads cache | |
| - name: Restore downloads cache | |
| id: cache-downloads-restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: build/download | |
| key: downloads-${{ hashFiles('.gitmodules') }} | |
| restore-keys: | | |
| downloads- | |
| # Try to restore ccache | |
| - name: Restore ccache | |
| id: cache-ccache-restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: build/ccache | |
| key: ccache-armv7-${{ hashFiles('.gitmodules') }} | |
| restore-keys: | | |
| ccache-armv7- | |
| - name: Cache status | |
| run: | | |
| echo "π Cache Restore Status:" | |
| echo "Downloads cache hit: ${{ steps.cache-downloads-restore.outputs.cache-hit }}" | |
| echo "Downloads cache key: ${{ steps.cache-downloads-restore.outputs.cache-matched-key || 'none' }}" | |
| echo "ccache hit: ${{ steps.cache-ccache-restore.outputs.cache-hit }}" | |
| echo "ccache key: ${{ steps.cache-ccache-restore.outputs.cache-matched-key || 'none' }}" | |
| echo "" | |
| echo "π Checking directories:" | |
| ls -lah build/ 2>/dev/null || echo "build/ doesn't exist" | |
| du -sh build/download 2>/dev/null || echo "build/download doesn't exist" | |
| du -sh build/ccache 2>/dev/null || echo "build/ccache doesn't exist" | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get -qq update | |
| sudo apt-get -qq --yes install apt-utils > /dev/null | |
| sudo apt-get -qq --yes install \ | |
| subversion build-essential bison flex gettext libncurses5-dev texinfo \ | |
| autoconf automake libtool mercurial git-core gperf gawk expat curl cvs \ | |
| libexpat-dev bzr unzip bc python3-dev wget cpio rsync xxd libmpc-dev \ | |
| libgmp3-dev xz-utils file ccache > /dev/null | |
| # Install multilib on x86_64 | |
| if [ "$(arch)" = "x86_64" ]; then | |
| sudo apt-get -qq --yes install gcc-multilib g++-multilib > /dev/null | |
| fi | |
| echo "β Dependencies installed" | |
| - name: Get git reference | |
| id: ref | |
| run: | | |
| REF=$(git rev-parse --short HEAD) | |
| echo "ref=$REF" >> $GITHUB_OUTPUT | |
| echo "π Building reference: $REF" | |
| echo "π·οΈ Tag: ${{ github.ref_name }}" | |
| - name: Download packages | |
| run: | | |
| export BR2_DL_DIR="${PWD}/build/download" | |
| echo "π¦ Downloading packages for $CONFIG_NAME..." | |
| # Initialize config | |
| make -C buildroot \ | |
| BR2_EXTERNAL="../buildroot-external-metrological-open-source" \ | |
| O=../build/$CONFIG_NAME \ | |
| ${CONFIG_NAME}_defconfig | |
| make -C build/$CONFIG_NAME syncconfig | |
| # Download all sources | |
| echo "β¬ Running 'make source'..." | |
| time make -C build/$CONFIG_NAME source | |
| echo "β Package download complete" | |
| echo "" | |
| echo "π Download cache size:" | |
| du -sh build/download | |
| echo "Files in download cache:" | |
| find build/download -type f | wc -l | |
| - name: Build ${{ env.CONFIG_NAME }} | |
| run: | | |
| export BR2_DL_DIR="${PWD}/build/download" | |
| export BR2_CCACHE_DIR="${PWD}/build/ccache" | |
| echo "π¨ Building $CONFIG_NAME..." | |
| echo "β° Build started at $(date)" | |
| # Add WPE WebKit parallel build optimization | |
| echo 'BR2_PACKAGE_WPEWEBKIT_ML_PARALLEL_BUILD_JOBS="6"' >> ./build/$CONFIG_NAME/.config | |
| # Compiler cache initial setup | |
| echo 'BR2_CCACHE_INITIAL_SETUP="-M ${CCACHE_LIMIT} -z"' >> ./build/$CONFIG_NAME/.config | |
| make -C build/$CONFIG_NAME syncconfig | |
| # Build with timing | |
| time make -C build/$CONFIG_NAME | |
| echo "β Build completed at $(date)" | |
| echo "" | |
| echo "π ccache size:" | |
| du -sh build/ccache | |
| - name: Show build artifacts | |
| run: | | |
| echo "π Build artifacts:" | |
| ls -lh ./build/$CONFIG_NAME/images/ | |
| - name: Show ccache statistics | |
| run: | | |
| echo "π ccache Statistics:" | |
| ./build/$CONFIG_NAME/host/usr/bin/ccache -s | |
| - name: Final cache sizes | |
| run: | | |
| echo "π Final cache directory sizes before saving:" | |
| echo "" | |
| echo "Downloads cache:" | |
| du -sh build/download | |
| echo "" | |
| echo "ccache:" | |
| du -sh build/ccache | |
| echo "" | |
| echo "Total build directory:" | |
| du -sh build/ | |
| # Save downloads cache (always, even if it existed) | |
| - name: Save downloads cache | |
| uses: actions/cache/save@v4 | |
| if: always() | |
| with: | |
| path: build/download | |
| key: downloads-${{ hashFiles('.gitmodules') }}-${{ github.run_id }} | |
| # Save ccache (always, even if it existed) | |
| - name: Save ccache | |
| uses: actions/cache/save@v4 | |
| if: always() | |
| with: | |
| path: build/ccache | |
| key: ccache-armv7-${{ hashFiles('.gitmodules') }}-${{ github.run_id }} | |
| - name: Compress image | |
| run: | | |
| echo "ποΈ Compressing image at $(date)..." | |
| xz --verbose --keep --compress --stdout \ | |
| ./build/$CONFIG_NAME/images/sdcard.img > \ | |
| ./${CONFIG_NAME}-${{ steps.ref.outputs.ref }}-sdcard.img.xz | |
| # Show file size | |
| echo "" | |
| echo "π¦ Compressed image:" | |
| ls -lh ${CONFIG_NAME}-${{ steps.ref.outputs.ref }}-sdcard.img.xz | |
| # Calculate checksums | |
| echo "" | |
| echo "π Checksums:" | |
| sha256sum ${CONFIG_NAME}-${{ steps.ref.outputs.ref }}-sdcard.img.xz | tee ${CONFIG_NAME}-${{ steps.ref.outputs.ref }}-sdcard.img.xz.sha256 | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz | |
| path: | | |
| ${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz | |
| ${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz.sha256 | |
| compression-level: 0 # Already compressed with xz | |
| - name: Create pre-release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| ${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz | |
| ${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz.sha256 | |
| prerelease: true | |
| generate_release_notes: true | |
| body: | | |
| ## π Dev Build - ${{ env.CONFIG_NAME }} | |
| **Configuration:** `${{ env.CONFIG_NAME }}_defconfig` | |
| **Reference:** `${{ steps.ref.outputs.ref }}` | |
| **Tag:** `${{ github.ref_name }}` | |
| **Build Date:** ${{ github.event.head_commit.timestamp }} | |
| **Triggered by:** @${{ github.actor }} | |
| ### π¦ Artifacts | |
| - `${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz` - Compressed SD card image | |
| - `${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz.sha256` - SHA256 checksum | |
| ### π§ Platform | |
| - **Target:** Raspberry Pi (ARMv7 32-bit) | |
| - **Variant:** Thunder | |
| ### β‘ Usage | |
| ```bash | |
| # Download and verify | |
| wget https://github.com/WebPlatformForEmbedded/lithosphere/releases/download/${{ github.ref_name }}/${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz | |
| wget https://github.com/WebPlatformForEmbedded/lithosphere/releases/download/${{ github.ref_name }}/${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz.sha256 | |
| # Verify checksum | |
| sha256sum -c ${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz.sha256 | |
| # Extract and flash | |
| xz -d ${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img.xz | |
| sudo dd if=${{ env.CONFIG_NAME }}-${{ steps.ref.outputs.ref }}-sdcard.img of=/dev/sdX bs=4M status=progress | |
| sync | |
| ``` | |
| --- | |
| β οΈ **This is a development build for testing purposes.** | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build summary | |
| run: | | |
| echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββ" | |
| echo "β BUILD SUCCESSFUL" | |
| echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββ" | |
| echo "" | |
| echo "π Configuration: $CONFIG_NAME" | |
| echo "π·οΈ Tag: ${{ github.ref_name }}" | |
| echo "π Reference: ${{ steps.ref.outputs.ref }}" | |
| echo "π― Platform: Raspberry Pi (ARMv7)" | |
| echo "" | |
| echo "π¦ Artifact: ${CONFIG_NAME}-${{ steps.ref.outputs.ref }}-sdcard.img.xz" | |
| echo "π Release: https://github.com/WebPlatformForEmbedded/lithosphere/releases/tag/${{ github.ref_name }}" | |
| echo "" | |
| echo "π Cache Status:" | |
| echo "Downloads: ${{ steps.cache-downloads-restore.outputs.cache-hit == 'true' && 'β HIT' || 'β MISS' }}" | |
| echo "ccache: ${{ steps.cache-ccache-restore.outputs.cache-hit == 'true' && 'β HIT' || 'β MISS' }}" | |
| echo "" | |
| echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββ" |