action: cache the compiler cache between invocations #137
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: Action test | ||
| on: | ||
| push: | ||
| pull_request: | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| build: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-24.04, ubuntu-24.04-arm, macos-13, macos-14, macos-15, windows-2022] | ||
| release: [v3.7.0, v4.0.0, v4.1.0, main] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Main Zephyr repository checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: zephyrproject-rtos/zephyr | ||
| path: zephyr | ||
| ref: ${{ matrix.release }} | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: 3.12 | ||
| - name: Setup Zephyr project | ||
| uses: ./ | ||
| with: | ||
| app-path: zephyr | ||
| toolchains: arm-zephyr-eabi:riscv64-zephyr-elf:x86_64-zephyr-elf | ||
| west-group-filter: -tools,-bootloader,-babblesim | ||
| west-project-filter: -nrf_hw_models | ||
| - name: Restore ccache | ||
| id: ccache-restore | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: ${{ env.CCACHE_DIR }} | ||
| key: ${{ runner.os }}-ccache | ||
| - name: Set up ccache | ||
| run: | | ||
| mkdir -p ${{ env.{CCACHE_DIR }} | ||
| ccache -p | ||
| ccache -z -s -vv | ||
| - name: Build firmware | ||
| working-directory: zephyr | ||
| shell: bash | ||
| run: | | ||
| if [ "${{ runner.os }}" = "macOS" ]; then | ||
| EXTRA_TWISTER_FLAGS="-P native_sim --build-only" | ||
| elif [ "${{ runner.os }}" = "Windows" ]; then | ||
| EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O/tmp/twister-out" | ||
| fi | ||
| PLATFORMS_FLAGS="" | ||
| if [ "${{ runner.os }}-${{ runner.arch }}" == "Linux-ARM64" ]; then | ||
| PLATFORMS_FLAGS+="-p native_sim/native/64 " | ||
| else | ||
| PLATFORMS_FLAGS+="-p native_sim " | ||
| fi | ||
| PLATFORMS_FLAGS+="-p qemu_cortex_m0 " | ||
| PLATFORMS_FLAGS+="-p qemu_cortex_r5 " | ||
| PLATFORMS_FLAGS+="-p qemu_riscv32 " | ||
| PLATFORMS_FLAGS+="-p qemu_riscv32e " | ||
| PLATFORMS_FLAGS+="-p qemu_riscv64 " | ||
| PLATFORMS_FLAGS+="-p qemu_x86 " | ||
| PLATFORMS_FLAGS+="-p qemu_x86_64" | ||
| ./scripts/twister --force-color --inline-logs -T samples/hello_world -v $PLATFORMS_FLAGS $EXTRA_TWISTER_FLAGS | ||
| - name: Print ccache stats | ||
| run: | | ||
| ccache -s -vv | ||
| - name: Save ccache | ||
| uses: actions/cache/save@v4 | ||
| with: | ||
| path: ${{ env.CCACHE_DIR }} | ||
| key: ${{ steps.ccache-restore.outputs.cache-primary-key }} | ||