From 1a922f7639162b5ef452eeb00baeb9227bfd2fbc Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Thu, 23 Jan 2025 16:13:30 +0100 Subject: [PATCH] :recycle: [CI] Added a common action to prepare m2 repo for caching Signed-off-by: Alberto Codutti --- .../prepareMavenRepoForCache/action.yaml | 11 +++ .github/actions/setUpMavenCaches/action.yaml | 1 + .github/workflows/kapua-ci.yaml | 76 +++++++++---------- 3 files changed, 49 insertions(+), 39 deletions(-) create mode 100644 .github/actions/prepareMavenRepoForCache/action.yaml diff --git a/.github/actions/prepareMavenRepoForCache/action.yaml b/.github/actions/prepareMavenRepoForCache/action.yaml new file mode 100644 index 00000000000..934d3df8131 --- /dev/null +++ b/.github/actions/prepareMavenRepoForCache/action.yaml @@ -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 \ No newline at end of file diff --git a/.github/actions/setUpMavenCaches/action.yaml b/.github/actions/setUpMavenCaches/action.yaml index c0bc8ea5e5c..acf857790a8 100644 --- a/.github/actions/setUpMavenCaches/action.yaml +++ b/.github/actions/setUpMavenCaches/action.yaml @@ -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 + diff --git a/.github/workflows/kapua-ci.yaml b/.github/workflows/kapua-ci.yaml index 9689d282115..aaa6bf629d2 100755 --- a/.github/workflows/kapua-ci.yaml +++ b/.github/workflows/kapua-ci.yaml @@ -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 @@ -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' \ No newline at end of file