diff --git a/.github/actions/prepareMavenRepoForCache/action.yaml b/.github/actions/saveBuiltKapuaArtifacts/action.yaml similarity index 53% rename from .github/actions/prepareMavenRepoForCache/action.yaml rename to .github/actions/saveBuiltKapuaArtifacts/action.yaml index b4aa1539149..ef43bf76fcd 100644 --- a/.github/actions/prepareMavenRepoForCache/action.yaml +++ b/.github/actions/saveBuiltKapuaArtifacts/action.yaml @@ -1,12 +1,16 @@ -name: 'Prepare Maven Repo' +name: 'Save built Kapua Artifacts' description: | - Prepares ~/.m2/repository/ for caching + Saves the built Kapua artifacts for later usage runs: using: "composite" steps: - name: Extract built Kapua artifacts # This splits the built Kapua artifact of this run from the cached repository of external dependencies for caching - if: ${{ steps.cache-maven-kapua-artifacts.outputs.cache-hit != 'true' }} run: | mkdir --parents ~/.m2/kapua-repository/org/eclipse/ mv ~/.m2/repository/org/eclipse/kapua ~/.m2/kapua-repository/org/eclipse/kapua - shell: bash \ No newline at end of file + shell: bash + - name: Save built Kapua artifacts + uses: actions/cache/save@v4 + with: + path: ~/.m2/kapua-repository/org/eclipse/kapua + key: ${{ runner.os }}-maven-${{ github.run_number }}-kapua-artifacts \ No newline at end of file diff --git a/.github/actions/setUpMavenCaches/action.yaml b/.github/actions/setUpMavenCaches/action.yaml index acf857790a8..7563468ba36 100644 --- a/.github/actions/setUpMavenCaches/action.yaml +++ b/.github/actions/setUpMavenCaches/action.yaml @@ -18,13 +18,14 @@ runs: - name: Cache Maven repository - Kapua artifacts # Cache of built Kapua artifacts be reused in other jobs if: ${{ inputs.kapua-artifact-cache-enabled == 'true' }} id: cache-maven-kapua-artifacts - uses: actions/cache@v4 + uses: actions/cache/restore@v4 with: path: ~/.m2/kapua-repository/org/eclipse/kapua key: ${{ runner.os }}-maven-${{ github.run_number }}-kapua-artifacts + fail-on-cache-miss: 'true' - name: Build full cached Maven repository # This adds the built Kapua artifact of this run to the cached repository of external dependencies. Used when re-running a job - if: ${{ inputs.kapua-artifact-cache-enabled == 'true' && steps.cache-maven-kapua-artifacts.outputs.cache-hit == 'true' }} + if: ${{ inputs.kapua-artifact-cache-enabled == 'true' }} run: mv ~/.m2/kapua-repository/org/eclipse/kapua ~/.m2/repository/org/eclipse/kapua shell: bash diff --git a/.github/workflows/kapua-ci.yaml b/.github/workflows/kapua-ci.yaml index aaa6bf629d2..e2e848b2f4e 100755 --- a/.github/workflows/kapua-ci.yaml +++ b/.github/workflows/kapua-ci.yaml @@ -21,6 +21,8 @@ jobs: - name: Set up Maven caches uses: ./.github/actions/setUpMavenCaches + with: + kapua-artifact-cache-enabled: 'false' - name: Maven version run: mvn --version @@ -28,8 +30,8 @@ jobs: - name: Build Kapua project run: mvn -B -DskipTests clean install -T 1C - - name: Prepare Maven repo for caching - uses: ./.github/actions/prepareMavenRepoForCache + - name: Save built Kapua Artifacts + uses: ./.github/actions/saveBuiltKapuaArtifacts build-javadoc: needs: build