Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/actions/checkout/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Checkout repository
description: Checkout the repository with common configuration

inputs:
fetch-depth:
description: Depth of git history to fetch
required: false
default: "0"

ssh-key:
description: SSH private key for checkout
required: false
default: ""

persist-credentials:
description: Persist git credentials
required: false
default: "true"

runs:
using: "composite"
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: ${{ inputs.fetch-depth }}
ssh-key: ${{ inputs.ssh-key }}
persist-credentials: ${{ inputs.persist-credentials }}
54 changes: 26 additions & 28 deletions .github/actions/compute_changed_modules/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ outputs:
runs:
using: "composite"
steps:

- name: Changed files in libraries
id: changed
if: ${{ inputs.modules == '' }}
Expand All @@ -33,21 +34,30 @@ runs:
run: |
set -euo pipefail

# -----------------------------
# Manual override
# -----------------------------
if [[ -n '${{ inputs.modules }}' ]]; then
modules='${{ inputs.modules }}'
hasModules=$([[ "$modules" == "[]" ]] && echo false || echo true)

if [[ "$modules" == "[]" ]]; then
hasModules=false
else
hasModules=true
fi

{
echo "value<<EOF"
echo "$modules"
echo "EOF"
echo "value=$modules"
echo "hasModules=$hasModules"
} >> "$GITHUB_OUTPUT"

exit 0
fi

if [[ "${{ steps.changed.outputs.any_changed }}" != "true" ]]; then
# -----------------------------
# No changes detected
# -----------------------------
if [[ "${{ steps.changed.outputs.any_changed || 'false' }}" != "true" ]]; then
{
echo "value=[]"
echo "hasModules=false"
Expand All @@ -57,35 +67,26 @@ runs:

files_raw='${{ steps.changed.outputs.all_changed_files }}'

files_list=$(printf "%s" "$files_raw" | tr ' ' '\n' | sed '/^$/d')
files_list=$(printf "%s" "$files_raw" | tr ' \n' '\n' | sed '/^$/d')

mods_csv=$(printf "%s\n" "$files_list" \
modules=$(printf "%s\n" "$files_list" \
| sed -n 's|^libraries/\([^/]*\)/.*|:libraries:\1|p' \
| sort -u \
| paste -sd, -)
| sort -u)

if [[ -z "$mods_csv" ]]; then
if [[ -z "$modules" ]]; then
{
echo "value=[]"
echo "hasModules=false"
} >> "$GITHUB_OUTPUT"
exit 0
fi

json=$(printf '%s' "$mods_csv" \
| tr ',' '\n' \
| sed 's/^[[:space:]]*//; s/[[:space:]]*$//' \
| sed '/^$/d' \
| awk '{printf "%s\"%s\"", (NR==1?"":","), $0}' \
| sed 's/^/[/' \
| sed 's/$/]/')
json=$(printf "%s\n" "$modules" | jq -R . | jq -s .)

echo "Matrix JSON: $json"

{
echo "value<<EOF"
echo "$json"
echo "EOF"
echo "value=$json"
echo "hasModules=true"
} >> "$GITHUB_OUTPUT"

Expand All @@ -100,21 +101,18 @@ runs:
echo "## 🔍 Modules with Changes"
echo ""

if [[ "$matrix" == "[]" ]]; then
count=$(echo "$matrix" | jq 'length')

if [[ "$count" -eq 0 ]]; then
echo "✅ **No modules changed**"
echo ""
else
count=$(printf "%s" "$matrix" | tr -cd ',' | wc -c | tr -d ' ')
count=$((count + 1))
echo "🧩 **Modules affected:** $count"
echo ""
echo "### 📦 Affected modules"
echo ""
printf "%s\n" "$matrix" \
| tr -d '[]"' \
| tr ',' '\n' \
| sed '/^$/d' \
| sed 's/^/- `/; s/$/`/'

echo "$matrix" | jq -r '.[] | "- `\(.)`"'
echo ""
fi

Expand Down
32 changes: 8 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ jobs:
timeout-minutes: 5

steps:
- name: Checkout repository
uses: actions/checkout@v6
with: { fetch-depth: 0 }
- uses: ./.github/actions/checkout

- name: Print workflow information
uses: ./.github/actions/info
Expand All @@ -44,9 +42,7 @@ jobs:
timeout-minutes: 5

steps:
- name: Checkout repository
uses: actions/checkout@v6
with: { fetch-depth: 0 }
- uses: ./.github/actions/checkout

- name: Compute changed modules
id: modules
Expand All @@ -58,12 +54,8 @@ jobs:
timeout-minutes: 10

steps:
- name: Checkout repository
uses: actions/checkout@v6
with: { fetch-depth: 0 }

- name: Setup build environment
uses: ./.github/actions/setup
- uses: ./.github/actions/checkout
- uses: ./.github/actions/setup

- name: Run Detekt
uses: ./.github/actions/checkstyle
Expand All @@ -77,12 +69,8 @@ jobs:
timeout-minutes: 20

steps:
- name: Checkout repository
uses: actions/checkout@v6
with: { fetch-depth: 0 }

- name: Setup build environment
uses: ./.github/actions/setup
- uses: ./.github/actions/checkout
- uses: ./.github/actions/setup

- name: Assemble ${{ env.BUILD_TYPE }}
uses: ./.github/actions/assemble
Expand All @@ -104,12 +92,8 @@ jobs:
timeout-minutes: 20

steps:
- name: Checkout repository
uses: actions/checkout@v6
with: { fetch-depth: 0 }

- name: Setup build environment
uses: ./.github/actions/setup
- uses: ./.github/actions/checkout
- uses: ./.github/actions/setup

- name: Execute unit tests
uses: ./.github/actions/unit_tests
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/ci_bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ jobs:
timeout-minutes: 5

steps:
- name: Checkout repository
uses: actions/checkout@v6
with: { fetch-depth: 0 }
- uses: ./.github/actions/checkout

- name: Print workflow information
uses: ./.github/actions/info
Expand All @@ -56,15 +54,13 @@ jobs:
timeout-minutes: 10

steps:
- name: Check out code
uses: actions/checkout@v6
- uses: ./.github/actions/checkout
with:
fetch-depth: 0
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
persist-credentials: true

- name: Setup build environment
uses: ./.github/actions/setup
- uses: ./.github/actions/setup

- name: Bump versions
uses: ./.github/actions/bump_version
Expand All @@ -83,15 +79,13 @@ jobs:
timeout-minutes: 10

steps:
- name: Check out code
uses: actions/checkout@v6
- uses: ./.github/actions/checkout
with:
fetch-depth: 0
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
persist-credentials: true

- name: Setup build environment
uses: ./.github/actions/setup
- uses: ./.github/actions/setup

- name: Bump version
uses: ./.github/actions/bump_version
Expand Down
62 changes: 20 additions & 42 deletions .github/workflows/ci_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ name: Continuous Integration (Publish)
# Workflow events: Controls when the action will run.
# More info: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
branches:
- master
# push:
# branches:
# - master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -50,7 +52,7 @@ env:
# Build type
BUILD_TYPE: ${{ github.event.inputs.build-type || 'Release' }}
# Publishing type for Central Portal (USER_MANAGED or AUTOMATIC)
PUBLICATION_TYPE: ${{ github.event.inputs.publication-type || 'AUTOMATIC' }}
PUBLICATION_TYPE: ${{ github.event.inputs.publication-type || 'USER_MANAGED' }}
# BOM module name (used for version bumping)
BOM_MODULE: ${{ github.event.inputs.bom-module || ':bom' }}

Expand All @@ -63,9 +65,7 @@ jobs:
timeout-minutes: 5

steps:
- name: Checkout repository
uses: actions/checkout@v6
with: { fetch-depth: 0 }
- uses: ./.github/actions/checkout

- name: Print workflow information
uses: ./.github/actions/info
Expand All @@ -80,9 +80,7 @@ jobs:
hasModules: ${{ steps.computed.outputs.hasModules }}

steps:
- name: Checkout repository
uses: actions/checkout@v6
with: { fetch-depth: 0 }
- uses: ./.github/actions/checkout

- name: Compute changed modules
id: computed
Expand All @@ -98,12 +96,8 @@ jobs:
timeout-minutes: 10

steps:
- name: Checkout repository
uses: actions/checkout@v6
with: { fetch-depth: 0 }

- name: Setup build environment
uses: ./.github/actions/setup
- uses: ./.github/actions/checkout
- uses: ./.github/actions/setup

- name: Check code via Detekt
uses: ./.github/actions/checkstyle
Expand All @@ -117,12 +111,8 @@ jobs:
timeout-minutes: 20

steps:
- name: Checkout repository
uses: actions/checkout@v6
with: { fetch-depth: 0 }

- name: Setup build environment
uses: ./.github/actions/setup
- uses: ./.github/actions/checkout
- uses: ./.github/actions/setup

- name: Assemble ${{ env.BUILD_TYPE }}
uses: ./.github/actions/assemble
Expand All @@ -144,12 +134,8 @@ jobs:
timeout-minutes: 20

steps:
- name: Checkout repository
uses: actions/checkout@v6
with: { fetch-depth: 0 }

- name: Setup build environment
uses: ./.github/actions/setup
- uses: ./.github/actions/checkout
- uses: ./.github/actions/setup

- name: Execute unit tests
uses: ./.github/actions/unit_tests
Expand All @@ -170,12 +156,8 @@ jobs:
timeout-minutes: 20

steps:
- name: Checkout repository
uses: actions/checkout@v6
with: { fetch-depth: 0 }

- name: Setup build environment
uses: ./.github/actions/setup
- uses: ./.github/actions/checkout
- uses: ./.github/actions/setup

- name: Build nmcpProjects
id: nmcp
Expand Down Expand Up @@ -210,15 +192,13 @@ jobs:
timeout-minutes: 10

steps:
- name: Check out code
uses: actions/checkout@v6
- uses: ./.github/actions/checkout
with:
fetch-depth: 0
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
persist-credentials: true

- name: Setup build environment
uses: ./.github/actions/setup
- uses: ./.github/actions/setup

- name: Get PR info
id: pr_info
Expand All @@ -240,15 +220,13 @@ jobs:
timeout-minutes: 10

steps:
- name: Check out code
uses: actions/checkout@v6
- uses: ./.github/actions/checkout
with:
fetch-depth: 0
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
persist-credentials: true

- name: Setup build environment
uses: ./.github/actions/setup
- uses: ./.github/actions/setup

- name: Get PR info
id: pr_info
Expand Down
Loading
Loading