Skip to content

Commit 228739f

Browse files
committed
refactor(ci): refactor runner configuration and add gradle-module support to workflows for better flexibility
1 parent 7d8c260 commit 228739f

File tree

4 files changed

+30
-21
lines changed

4 files changed

+30
-21
lines changed

.github/workflows/components/runner-size-converter.yaml renamed to .github/workflows/component-runner-size-converter.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Reusable workflow to convert runner size strings to actual GitHub runner names
2+
# Maps "normal" to "linux-x64" and "large" to "linux-x64-xl" for consistent runner selection
3+
# Github issue: https://github.com/orgs/community/discussions/10773
14
name: Convert runner size to runner name
25
on:
36
workflow_call:
@@ -31,4 +34,4 @@ jobs:
3134
echo "Error: Invalid runner size '${{ inputs.runner-size }}'"
3235
exit 1
3336
;;
34-
esac
37+
esac

.github/workflows/pull-request-kotlin.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ on:
44
inputs:
55
runner-size:
66
required: false
7-
description: "Runner to use for the job"
7+
type: string
8+
description: "Runner to use for the job (normal, or large)"
89
default: "normal"
9-
type: choice
10-
options:
11-
- "normal"
12-
- "large"
1310
java-distribution:
1411
required: false
1512
type: string
@@ -44,7 +41,7 @@ on:
4441
description: "SonarCloud token"
4542
jobs:
4643
get-runner:
47-
uses: ./.github/workflows/components/runner-size-converter.yaml
44+
uses: component-runner-size-converter.yaml
4845
with:
4946
runner-size: ${{ inputs.runner-size }}
5047
pr_title_checker:

.github/workflows/pull-request-react.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ on:
44
inputs:
55
runner-size:
66
required: false
7-
description: "Runner to use for the job"
7+
type: string
8+
description: "Runner to use for the job (normal, or large)"
89
default: "normal"
9-
type: choice
10-
options:
11-
- "normal"
12-
- "large"
1310
node-version:
1411
required: false
1512
type: string
@@ -47,7 +44,7 @@ on:
4744
description: "Command to run for testing (optional)"
4845
jobs:
4946
get-runner:
50-
uses: ./.github/workflows/components/runner-size-converter.yaml
47+
uses: component-runner-size-converter.yaml
5148
with:
5249
runner-size: ${{ inputs.runner-size }}
5350
pr_title_checker:

.github/workflows/sonar-cloud.yaml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ on:
44
inputs:
55
runner-size:
66
required: false
7-
description: "Runner to use for the job"
7+
type: string
8+
description: "Runner to use for the job (normal, or large)"
89
default: "normal"
9-
type: choice
10-
options:
11-
- "normal"
12-
- "large"
1310
java-distribution:
1411
required: false
1512
type: string
@@ -18,6 +15,10 @@ on:
1815
required: false
1916
type: string
2017
default: '21'
18+
gradle-module:
19+
required: false
20+
type: string
21+
description: 'Name of the gradle module being tested'
2122
secrets:
2223
GHL_USERNAME:
2324
required: true
@@ -30,7 +31,7 @@ on:
3031
description: "Sonar token (Optional, won't publish to sonar if not present)"
3132
jobs:
3233
get-runner:
33-
uses: ./.github/workflows/components/runner-size-converter.yaml
34+
uses: component-runner-size-converter.yaml
3435
with:
3536
runner-size: ${{ inputs.runner-size }}
3637
sonar-cloud:
@@ -59,8 +60,13 @@ jobs:
5960
env:
6061
GHL_USERNAME: ${{ secrets.GHL_USERNAME }}
6162
GHL_PASSWORD: ${{ secrets.GHL_PASSWORD }}
63+
GRADLE_MODULE: ${{ inputs.gradle-module }}
6264
run: |
63-
COVERAGE_TASK=$(./gradlew :tasks | grep -Eo '(koverXmlReport|jacocoTestReport)' | head -n1)
65+
if [ -z "$GRADLE_MODULE" ]; then
66+
COVERAGE_TASK=$(./gradlew :tasks | grep -Eo '(koverXmlReport|jacocoTestReport)' | head -n1)
67+
else
68+
COVERAGE_TASK=$(./gradlew $GRADLE_MODULE:tasks | grep -Eo '(koverXmlReport|jacocoTestReport)' | head -n1)
69+
fi
6470
echo "COVERAGE_TASK=${COVERAGE_TASK}" >> "$GITHUB_ENV"
6571
- name: Build and analyze
6672
env:
@@ -69,4 +75,10 @@ jobs:
6975
# Needed to get PR information, if any
7076
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7177
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
72-
run: ./gradlew check $COVERAGE_TASK sonar
78+
GRADLE_MODULE: ${{ inputs.gradle-module }}
79+
run: |
80+
if [ -z "$GRADLE_MODULE" ]; then
81+
./gradlew check $COVERAGE_TASK sonar
82+
else
83+
./gradlew $GRADLE_MODULE:check $GRADLE_MODULE:$COVERAGE_TASK $GRADLE_MODULE:sonar
84+
fi

0 commit comments

Comments
 (0)