5959 pull_request :
6060 branches : [ '**' ]
6161 paths :
62- - ' github/workflows/arduino.yml'
62+ - ' . github/workflows/arduino.yml'
6363 - ' IDE/ARDUINO/**'
6464 - ' src/**'
6565 - ' wolfcrypt/**'
@@ -122,6 +122,15 @@ jobs:
122122 REPO_OWNER : ${{ github.repository_owner }}
123123
124124 steps :
125+ - name : Free disk space
126+ run : |
127+ sudo rm -rf /usr/share/dotnet
128+ sudo rm -rf /usr/local/lib/android
129+ sudo rm -rf /opt/ghc
130+ sudo rm -rf /opt/hostedtoolcache/CodeQL
131+ sudo apt-get clean
132+ df -h
133+
125134 - name : Checkout Repository
126135 uses : actions/checkout@v4
127136
@@ -248,7 +257,8 @@ jobs:
248257 path : |
249258 ~/.arduino15
250259 ~/.cache/arduino
251- ~/.arduino15/staging
260+ # Exclude staging directory from cache to save space
261+ !~/.arduino15/staging
252262
253263 # Arduino libraries
254264 # Specific to Arduino CI Build (2 of 4) Arduinbo Release wolfSSL for Local Examples
@@ -405,6 +415,9 @@ jobs:
405415 WOLFSSL_EXAMPLES_DIRECTORY="$ARDUINO_ROOT/wolfssl/examples"
406416 echo "WOLFSSL_EXAMPLES_DIRECTORY: $WOLFSSL_EXAMPLES_DIRECTORY"
407417
418+ # Limit the number of jobs to 1 to avoid running out of memory
419+ export ARDUINO_CLI_MAX_JOBS=1
420+
408421 echo "Change directory to Arduino examples..."
409422 pushd "$WOLFSSL_EXAMPLES_DIRECTORY"
410423 chmod +x ./compile-all-examples.sh
@@ -416,3 +429,37 @@ jobs:
416429 bash ./compile-all-examples.sh ./board_list.txt "${{ matrix.fqbn }}"
417430 popd
418431 # End Compile Arduino Sketches for Various Boards
432+
433+ - name : Cleanup to Save Disk Space
434+ if : always()
435+ run : |
436+ echo "Disk usage before cleanup:"
437+ df -h
438+ echo ""
439+ echo "Cleaning up build artifacts and temporary files..."
440+
441+ # Clean up Arduino build artifacts
442+ find ~/Arduino -name "*.hex" -delete 2>/dev/null || true
443+ find ~/Arduino -name "*.elf" -delete 2>/dev/null || true
444+ find ~/Arduino -name "*.bin" -delete 2>/dev/null || true
445+ find ~/Arduino -name "build" -type d -exec rm -rf {} + 2>/dev/null || true
446+
447+ rm -rf ~/.arduino15/packages/esp32/tools || true
448+ rm -rf ~/.arduino15/packages/esp32/hardware || true
449+ rm -rf ~/.espressif || true
450+
451+ # Clean up staging directories
452+ rm -rf ~/.arduino15/staging/* || true
453+ rm -rf ~/.cache/arduino/* || true
454+
455+ # Clean up git clone of wolfssl-examples
456+ GITHUB_WORK=$(realpath "$GITHUB_WORKSPACE/../..")
457+ rm -rf "$GITHUB_WORK/wolfssl-examples-publish" || true
458+
459+ # Clean up any temporary files in workspace
460+ find "$GITHUB_WORKSPACE" -name "*.o" -delete 2>/dev/null || true
461+ find "$GITHUB_WORKSPACE" -name "*.a" -delete 2>/dev/null || true
462+
463+ echo ""
464+ echo "Disk usage after cleanup:"
465+ df -h
0 commit comments