From dd13fb55f901964904b25e902562413aa4969690 Mon Sep 17 00:00:00 2001
From: Victor Jung <jungvi@iis.ee.ethz.ch>
Date: Fri, 23 May 2025 15:28:24 +0200
Subject: [PATCH 1/4] Add to GenerateCCache workflow a user input field for the
 docker image link and set default to 'ghcr.io/pulp-platform/deeploy:devel'

---
 .github/workflows/GenerateCCache.yml | 45 ++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 .github/workflows/GenerateCCache.yml

diff --git a/.github/workflows/GenerateCCache.yml b/.github/workflows/GenerateCCache.yml
new file mode 100644
index 0000000000..170a416eb8
--- /dev/null
+++ b/.github/workflows/GenerateCCache.yml
@@ -0,0 +1,45 @@
+name: GenerateCCache
+
+on:
+  workflow_dispatch:
+    inputs:
+      docker_image_deeploy:
+        description: 'Deeploy Image to use'
+        required: false
+        default: 'ghcr.io/pulp-platform/deeploy:devel'
+  schedule:
+    # Runs the workflow on the default branch every 6 days at 2AM CET to keep the cache fresh
+    - cron: "0 1 */6 * *"
+
+jobs:
+
+    generate-ccache:
+      runs-on: ubuntu-latest
+      container:
+        image:  ${{ github.event.inputs.docker_image_deeploy }}
+      steps:
+      - name: Checkout Repo
+        uses: actions/checkout@v4
+        with:
+          submodules: recursive
+      - name: Build Deeploy
+        run: pip install -e .
+      - name: Generate CCache
+        run: |
+          cd DeeployTest
+          mkdir -p /app/.ccache
+          export CCACHE_DIR=/app/.ccache
+          python testRunner_generic.py -t ./Tests/Adder
+          python testRunner_mempool.py  -t ./Tests/Adder
+          python testRunner_cortexm.py  -t ./Tests/Adder
+          python testRunner_snitch.py  -t ./Tests/Adder
+          python testRunner_siracusa.py  -t ./Tests/Adder
+          python testRunner_tiled_siracusa.py  -t ./Tests/Adder
+          python testRunner_tiled_siracusa_w_neureka.py  -t ./Tests/Adder
+      - name: Clean and Upload CCache
+        uses: actions/cache@v4
+        with:
+          path: /app/.ccache
+          key: ccache-ci
+
+    
\ No newline at end of file

From 7c881b2415b60bfff46234726f71a756976c13bd Mon Sep 17 00:00:00 2001
From: Victor Jung <jungvi@iis.ee.ethz.ch>
Date: Fri, 23 May 2025 16:25:05 +0200
Subject: [PATCH 2/4] Update schedule run to run every day at 1am

---
 .github/workflows/GenerateCCache.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/GenerateCCache.yml b/.github/workflows/GenerateCCache.yml
index 170a416eb8..79206d84df 100644
--- a/.github/workflows/GenerateCCache.yml
+++ b/.github/workflows/GenerateCCache.yml
@@ -8,8 +8,8 @@ on:
         required: false
         default: 'ghcr.io/pulp-platform/deeploy:devel'
   schedule:
-    # Runs the workflow on the default branch every 6 days at 2AM CET to keep the cache fresh
-    - cron: "0 1 */6 * *"
+    # Runs the workflow on the default branch every day at 1AM CET to keep the cache fresh
+    - cron: "0 1 * * *"
 
 jobs:
 

From b7a18af4e30cc685280af3b9a3cd071330d97009 Mon Sep 17 00:00:00 2001
From: Victor Jung <jungvi@iis.ee.ethz.ch>
Date: Sat, 24 May 2025 18:44:58 +0200
Subject: [PATCH 3/4] GenerateCCache Action: Add default docker image triggered
 by schedule

---
 .github/workflows/GenerateCCache.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/GenerateCCache.yml b/.github/workflows/GenerateCCache.yml
index 79206d84df..b22d04bd1e 100644
--- a/.github/workflows/GenerateCCache.yml
+++ b/.github/workflows/GenerateCCache.yml
@@ -16,7 +16,7 @@ jobs:
     generate-ccache:
       runs-on: ubuntu-latest
       container:
-        image:  ${{ github.event.inputs.docker_image_deeploy }}
+        image:  ${{ github.event.inputs.docker_image_deeploy || 'ghcr.io/pulp-platform/deeploy:devel' }}
       steps:
       - name: Checkout Repo
         uses: actions/checkout@v4

From c8de99b2f89c68dcf7a7cc8fa1cb78aada126e1c Mon Sep 17 00:00:00 2001
From: Victor Jung <jungvi@iis.ee.ethz.ch>
Date: Sat, 24 May 2025 18:53:01 +0200
Subject: [PATCH 4/4] Update Changelog

---
 CHANGELOG.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index c254ed80cd..218f1ba318 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ This file contains the changelog for the Deeploy project. The changelog is divid
 This release containing major architectural changes, new platform support, enhanced simulation workflows, floating-point kernel support, training infrastructure for CCT models, memory allocation strategies, and documentation improvements.
 
 ### List of Pull Requests
+- Cache Build Artefacts [#82](https://github.com/pulp-platform/Deeploy/pull/82)
 - Fix Linting in CI and Reformat C Files [#86](https://github.com/pulp-platform/Deeploy/pull/86)
 - Fix Broken CMake Flow For pulp-sdk [#87](https://github.com/pulp-platform/Deeploy/pull/87)
 - Refactor Changelog For Release [#85](https://github.com/pulp-platform/Deeploy/pull/85)
@@ -57,6 +58,9 @@ This release containing major architectural changes, new platform support, enhan
 - Port GitLab CI [#1](https://github.com/pulp-platform/Deeploy/pull/1)
 
 ### Added
+- Generate CCcache action
+- Concurrency group by branch name
+- Define a default container on main branch
 - Tutorial section in the documentation
 - Guide on using the debug print topology pass and code transformation
 - VSCode configuration files for improved IDE support
@@ -169,6 +173,7 @@ This release containing major architectural changes, new platform support, enhan
 - Add helper script to generate a baseline changelog.
 
 ### Changed
+- CI tests use ccache in a read-only manner
 - Adapt the select docker image stage to also select a runner depending on ` github.repository`
 - Adapt the jobs and reusable workflows to use the selected runner.
 - Updated `README.md` description to use a persistent development container
