diff --git a/.github/actions/build-cache/action.yml b/.github/actions/build-cache/action.yml index 12509e7688..307c2e91c0 100644 --- a/.github/actions/build-cache/action.yml +++ b/.github/actions/build-cache/action.yml @@ -2,20 +2,18 @@ name: Build Cache description: Cache builds runs: using: "composite" + # Make sure to keep these cache entries in sync with those in writecache.yml steps: - - name: Cache Go Modules + - name: Restore Go Modules Cache id: cache-go-modules - uses: actions/cache@v4 + uses: actions/cache/restore@v4 with: path: ~/go/pkg/mod key: ${{ runner.os }}-{{ hashFiles('**/go.sum') }}-go - - name: Cache Maven Modules + - name: Restore Maven Modules Cache id: cache-maven - uses: actions/cache@v4 + uses: actions/cache/restore@v4 with: path: ~/.m2/repository key: ${{ runner.os }}-{{ hashFiles('**/pom.xml') }}-maven - - name: Populate Cache - id: populate-cache - uses: ./.github/actions/populate-cache diff --git a/.github/actions/populate-cache/action.yml b/.github/actions/populate-cache/action.yml deleted file mode 100644 index b8aeb1d66c..0000000000 --- a/.github/actions/populate-cache/action.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: Populate Cache -description: "Populates the cache with the necessary dependencies" -runs: - using: node20 - main: "main.js" - post: "post.js" \ No newline at end of file diff --git a/.github/actions/populate-cache/main.js b/.github/actions/populate-cache/main.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.github/actions/populate-cache/post.js b/.github/actions/populate-cache/post.js deleted file mode 100644 index b2b284b51e..0000000000 --- a/.github/actions/populate-cache/post.js +++ /dev/null @@ -1,12 +0,0 @@ -const { execSync } = require("child_process"); - -try { - console.log("Resolving Maven dependencies"); - execSync("mvn dependency:resolve --batch-mode", { stdio: "inherit" }); - console.log("Resolving Go dependencies"); - execSync("go mod download -x", { stdio: "inherit" }); - console.log("Dependency resolution successful"); -} catch (error) { - console.error("Dependency resolution failed:", error.message); - process.exit(1); -} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b3cc62410..46524b5a89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,9 +19,7 @@ jobs: - name: Build Cache uses: ./.github/actions/build-cache - name: Test - run: | - find ~/.m2 -ls - mvn test --batch-mode + run: mvn test --batch-mode test: name: Test Go runs-on: ubuntu-latest diff --git a/.github/workflows/writecache.yml b/.github/workflows/writecache.yml new file mode 100644 index 0000000000..86b100a720 --- /dev/null +++ b/.github/workflows/writecache.yml @@ -0,0 +1,32 @@ +on: + push: + branches: + - main +name: Write Cache +jobs: + write-cache: + name: Write Cache + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Init Hermit + uses: cashapp/activate-hermit@v1 + - name: Build Cache + uses: ./.github/actions/build-cache + - name: Download Maven Dependencies + run: mvn dependency:resolve --batch-mode + - name: Download Go Dependencies + run: go mod download -x + - name: Save Go Modules Cache + id: cache-go-modules + uses: actions/cache/save@v4 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-{{ hashFiles('**/go.sum') }}-go + - name: Save Maven Modules Cache + id: cache-maven + uses: actions/cache/save@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-{{ hashFiles('**/pom.xml') }}-maven