Skip to content

Commit

Permalink
♻️ [CI] Added a common action to prepare m2 repo for caching
Browse files Browse the repository at this point in the history
Signed-off-by: Alberto Codutti <[email protected]>
  • Loading branch information
Coduz committed Jan 23, 2025
1 parent ac36de5 commit 1a922f7
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 39 deletions.
11 changes: 11 additions & 0 deletions .github/actions/prepareMavenRepoForCache/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'Prepare Maven Repo'
description: |
Prepares ~/.m2/repository/ for caching
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
run: |
mkdir --parents ~/.m2/kapua-repository/org/eclipse/
mv ~/.m2/repository/org/eclipse/kapua ~/.m2/kapua-repository/org/eclipse/kapua
shell: bash
1 change: 1 addition & 0 deletions .github/actions/setUpMavenCaches/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ runs:
if: ${{ inputs.kapua-artifact-cache-enabled == 'true' && steps.cache-maven-kapua-artifacts.outputs.cache-hit == 'true' }}
run: mv ~/.m2/kapua-repository/org/eclipse/kapua ~/.m2/repository/org/eclipse/kapua
shell: bash

76 changes: 37 additions & 39 deletions .github/workflows/kapua-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,43 @@ jobs:
- name: Build Kapua project
run: mvn -B -DskipTests clean install -T 1C

- name: Download all dependencies of the project # Downloading all referenced dependencies to build a complete cache if not present
if: steps.cache-maven-external-deps.outputs.cache-hit != 'true'
run: mvn dependency:go-offline
- name: Prepare Maven repo for caching
uses: ./.github/actions/prepareMavenRepoForCache

- name: Extract built Kapua artifacts # This splits the built Kapua artifact of this run from the cached repository of external dependencies for caching
run: |
mkdir --parents ~/.m2/kapua-repository/org/eclipse/
mv ~/.m2/repository/org/eclipse/kapua ~/.m2/kapua-repository/org/eclipse/kapua
build-javadoc:
needs: build
name: Build Javadoc
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout repository # Checks out a copy of the repository on the runner
uses: actions/checkout@v4

- name: Set up runner
uses: ./.github/actions/setUpRunner

- name: Set up Maven caches
uses: ./.github/actions/setUpMavenCaches
with:
kapua-artifact-cache-enabled: 'false'

- name: Build Kapua Javadoc
run: mvn -B -DskipTests install javadoc:jar

junit-tests:
needs: build
name: Run jUnit Tests
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout repository # Checks out a copy of the repository on the runner
uses: actions/checkout@v4
- name: Set up runner
uses: ./.github/actions/setUpRunner
- uses: ./.github/actions/runTestsTaggedAs
with:
needs-docker-images: 'false'
run-junit: 'true'

test-brokerAcl:
needs: build
Expand Down Expand Up @@ -325,35 +354,4 @@ jobs:
with:
tag: '@rest_parsing'
needs-docker-images: 'true'
needs-api-docker-image: 'true'
junit-tests:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout repository # Checks out a copy of the repository on the runner
uses: actions/checkout@v4
- name: Set up runner
uses: ./.github/actions/setUpRunner
- uses: ./.github/actions/runTestsTaggedAs
with:
needs-docker-images: 'false'
run-junit: 'true'
build-javadoc:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout repository # Checks out a copy of the repository on the runner
uses: actions/checkout@v4

- name: Set up runner
uses: ./.github/actions/setUpRunner

- name: Set up Maven caches
uses: ./.github/actions/setUpMavenCaches
with:
kapua-artifact-cache-enabled: 'false'

- name: Build Kapua Javadoc
run: mvn -B -DskipTests install javadoc:jar
needs-api-docker-image: 'true'

0 comments on commit 1a922f7

Please sign in to comment.