Skip to content

Commit

Permalink
♻️ [CI] Added a common action to perform runner setup
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 486d70d commit 3deba26
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 98 deletions.
16 changes: 2 additions & 14 deletions .github/actions/runTestsTaggedAs/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,8 @@ inputs:
runs:
using: "composite"
steps:
- name: Setup Java 11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

- name: Setup Node 16
uses: actions/setup-node@v4 # Installs Node and NPM
with:
node-version: 16

- name: Install Swagger CLI # Installs Swagger CLI to bundle OpenAPI files
run: 'npm install -g @apidevtools/swagger-cli'
shell: bash
- name: Set up runner
uses: ./.github/actions/setUpRunner

- name: Cache Maven repository - External dependencies # Cache of external Maven dependencies built from 'build' job
uses: actions/cache@v4
Expand Down
23 changes: 23 additions & 0 deletions .github/actions/setUpRunner/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Set Up Runner'
description: |
Set up runner with tools required for the build
- Setup Java 11
- Setup Node 16
- Install Swagger CLI
runs:
using: "composite"
steps:
- name: Setup Java 11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

- name: Setup Node 16
uses: actions/setup-node@v4 # Installs Node and NPM
with:
node-version: 16

- name: Install Swagger CLI # Installs Swagger CLI to bundle OpenAPI files
run: 'npm install -g @apidevtools/swagger-cli'
shell: bash
129 changes: 75 additions & 54 deletions .github/workflows/kapua-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,11 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout repository # Checks out a copy of the repository on the worker
- name: Checkout repository # Checks out a copy of the repository on the runner
uses: actions/checkout@v4

- name: Setup Java 11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

- name: Setup Node 16 # Installs Node and NPM
uses: actions/setup-node@v4
with:
node-version: 16

- name: Install Swagger CLI # Installs Swagger CLI to bundle OpenAPI files
run: 'npm install -g @apidevtools/swagger-cli'
shell: bash
- name: Set up runner
uses: ./.github/actions/setUpRunner

- name: Cache Maven repository - External dependencies # Cache of external Maven dependencies to speed up build time
id: cache-maven-external-deps
Expand Down Expand Up @@ -69,8 +57,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@brokerAcl'
Expand All @@ -80,8 +70,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@tag'
Expand All @@ -91,8 +83,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@broker'
Expand All @@ -102,8 +96,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@device'
Expand All @@ -113,8 +109,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@deviceManagement'
Expand All @@ -124,8 +122,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@connection'
Expand All @@ -135,8 +135,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@datastore'
Expand All @@ -146,8 +148,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@user'
Expand All @@ -157,8 +161,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@userIntegrationBase'
Expand All @@ -168,8 +174,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@userIntegration'
Expand All @@ -179,8 +187,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@security'
Expand All @@ -190,8 +200,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '(@job or @scheduler) and not @it'
Expand All @@ -201,8 +213,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@job and @it'
Expand All @@ -212,8 +226,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@jobEngine'
Expand All @@ -223,8 +239,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@jobsIntegration'
Expand All @@ -234,8 +252,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@account or @translator'
Expand All @@ -245,8 +265,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@role or @group'
Expand All @@ -256,8 +278,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@deviceRegistry'
Expand All @@ -267,8 +291,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@endpoint'
Expand All @@ -278,8 +304,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@rest_auth'
Expand All @@ -290,8 +318,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@rest_cors'
Expand All @@ -302,8 +332,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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:
tag: '@rest_parsing'
Expand All @@ -314,8 +346,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- 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'
Expand All @@ -325,23 +359,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Clones Kapua repo inside the runner
- name: Checkout repository # Checks out a copy of the repository on the runner
uses: actions/checkout@v4

- name: Setup Java 11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

- name: Setup Node 16
uses: actions/setup-node@v4 # Installs Node and NPM
with:
node-version: 16

- name: Install Swagger CLI # Installs Swagger CLI to bundle OpenAPI files
run: 'npm install -g @apidevtools/swagger-cli'
shell: bash
- name: Set up runner
uses: ./.github/actions/setUpRunner

- name: Cache Maven repository - External dependencies # Cache of external Maven dependencies to speed up build time
id: cache-maven-external-deps
Expand Down
Loading

0 comments on commit 3deba26

Please sign in to comment.