6
6
description : " Provide the SP version to be used (e.g., 10.14.0.43709) - has to be a released version (Default: latest from Mendix versions.json)"
7
7
required : false
8
8
default : " "
9
-
10
9
nt_branch :
11
10
description : " Native Template branch/tag to use (Leave empty to auto-select based on Mendix version)"
12
11
default : " "
13
12
required : false
14
13
type : string
15
-
16
14
workspace :
17
15
description : " Select a widget to test (Default will run all)"
18
16
required : true
64
62
- cron : ' 0 0 * * *'
65
63
# Trigger on PR
66
64
# pull_request:
67
-
68
-
69
65
permissions :
70
66
packages : write
71
-
72
67
jobs :
73
68
scope :
74
69
runs-on : ubuntu-latest
@@ -80,56 +75,15 @@ jobs:
80
75
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
81
76
with :
82
77
fetch-depth : 2 # Fetch the latest two commits and its parent commit
83
-
84
78
- name : " Determine scope"
85
79
id : scope
86
80
run : |
87
- if [ "${{ github.event_name }}" == "pull_request" ]; then
88
- if git cat-file -e ${{ github.event.before }} 2>/dev/null; then
89
- changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
90
- else
91
- echo "Previous commit not found, using HEAD~1 as fallback"
92
- changed_files=$(git diff --name-only HEAD~1 ${{ github.sha }})
93
- fi
94
-
95
- selected_workspaces=""
96
- for file in $changed_files; do
97
- if [[ $file == packages/pluggableWidgets/* ]]; then
98
- widget=$(echo $file | cut -d'/' -f3)
99
- if [[ ! $selected_workspaces =~ $widget ]]; then
100
- selected_workspaces="$selected_workspaces $widget"
101
- fi
102
- fi
103
- done
104
-
105
- # Trim leading and trailing spaces from selected_workspaces
106
- selected_workspaces=$(echo $selected_workspaces | xargs)
107
-
108
- if [[ -n "$selected_workspaces" ]]; then
109
- echo "scope=--all --include '$selected_workspaces'" >> $GITHUB_OUTPUT
110
- echo "widgets=[\"$selected_workspaces\"]" >> $GITHUB_OUTPUT
111
- else
112
- widgets='["accordion-native","activity-indicator-native","animation-native","app-events-native","background-gradient-native","background-image-native","badge-native","bar-chart-native","barcode-scanner-native","bottom-sheet-native","carousel-native","color-picker-native","column-chart-native","feedback-native","floating-action-button-native","gallery-native","gallery-text-filter-native","image-native","intro-screen-native","line-chart-native","listview-swipe-native","maps-native","pie-doughnut-chart-native","popup-menu-native","progress-bar-native","progress-circle-native","qr-code-native","radio-buttons-native","range-slider-native","rating-native","repeater-native","safe-area-view-native","signature-native","slider-native","switch-native","toggle-buttons-native","video-player-native","web-view-native"]'
113
- echo "scope=--all --include '*-native'" >> $GITHUB_OUTPUT
114
- echo "widgets=${widgets}" >> $GITHUB_OUTPUT
115
- fi
116
- else
117
- if [ -n "${{ github.event.inputs.workspace }}" ] && [ "${{ github.event.inputs.workspace }}" != "*-native" ]; then
118
- selected_workspaces=$(echo "${{ github.event.inputs.workspace }}" | sed 's/,/ /g')
119
- echo "scope=--all --include '${selected_workspaces}'" >> $GITHUB_OUTPUT
120
- echo "widgets=[\"${{ github.event.inputs.workspace }}\"]" >> $GITHUB_OUTPUT
121
- else
122
- widgets='["accordion-native","activity-indicator-native","animation-native","app-events-native","background-gradient-native","background-image-native","badge-native","bar-chart-native","barcode-scanner-native","bottom-sheet-native","carousel-native","color-picker-native","column-chart-native","feedback-native","floating-action-button-native","gallery-native","gallery-text-filter-native","image-native","intro-screen-native","line-chart-native","listview-swipe-native","maps-native","pie-doughnut-chart-native","popup-menu-native","progress-bar-native","progress-circle-native","qr-code-native","radio-buttons-native","range-slider-native","rating-native","repeater-native","safe-area-view-native","signature-native","slider-native","switch-native","toggle-buttons-native","video-player-native","web-view-native"]'
123
- echo "scope=--all --include '*-native'" >> $GITHUB_OUTPUT
124
- echo "widgets=${widgets}" >> $GITHUB_OUTPUT
125
- fi
126
- fi
127
-
81
+ chmod +x ./.github/scripts/determine-widget-scope.sh
82
+ ./.github/scripts/determine-widget-scope.sh "${{ github.event_name }}" "${{ github.event.inputs.workspace }}" "${{ github.event.before }}" "${{ github.sha }}"
128
83
- name : " Debug Scope Output"
129
84
run : |
130
85
echo "Scope is: ${{ steps.scope.outputs.scope }}"
131
86
echo "Widgets are: ${{ steps.scope.outputs.widgets }}"
132
-
133
87
mendix-version :
134
88
runs-on : ubuntu-22.04
135
89
outputs :
@@ -154,14 +108,14 @@ jobs:
154
108
- name : " Debug Mendix Version"
155
109
run : |
156
110
echo "Mendix Version: ${{ steps.set-mendix-version.outputs.MENDIX_VERSION }}"
157
-
158
-
159
111
determine-nt-version :
160
112
needs : [mendix-version]
161
113
runs-on : ubuntu-latest
162
114
outputs :
163
- nt_branch : ${{ steps.determine-nt-branch .outputs.nt_branch }}
115
+ nt_branch : ${{ steps.set-output .outputs.nt_branch }}
164
116
steps :
117
+ - name : " Check out code"
118
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
165
119
- name : " Check if nt_branch was specified"
166
120
id : check-input
167
121
run : |
@@ -173,58 +127,28 @@ jobs:
173
127
echo "No nt_branch specified, will determine from mendix_version"
174
128
echo "source=auto" >> $GITHUB_OUTPUT
175
129
fi
176
-
177
130
- name : " Download mendix_version.json from native-template repo"
178
131
if : steps.check-input.outputs.source == 'auto'
179
132
run : |
180
133
curl -s -o mendix_version.json https://raw.githubusercontent.com/mendix/native-template/master/mendix_version.json
181
134
cat mendix_version.json
182
-
183
135
- name : " Determine Native Template version based on Mendix version"
184
136
if : steps.check-input.outputs.source == 'auto'
185
137
id : determine-nt-branch
186
138
run : |
187
- mendix_version="${{ needs.mendix-version.outputs.mendix_version }}"
188
- # Extract just the major.minor.patch part without any suffixes
189
- mendix_version_base=$(echo $mendix_version | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
190
-
191
- echo "Mendix version: $mendix_version"
192
- echo "Mendix base version: $mendix_version_base"
193
-
194
- # Use jq to find the appropriate NT version
195
- nt_version=$(jq -r --arg mv "$mendix_version_base" '
196
- # Define version comparison function first
197
- def version_to_int(v): v | split(".") | map(tonumber) | .[0]*1000000 + .[1]*1000 + .[2];
198
-
199
- # Convert input Mendix version to comparable format
200
- ($mv | version_to_int) as $mv_int |
201
-
202
- # Find matching range
203
- to_entries |
204
- map(
205
- select(
206
- (.value.min_mendix_version | version_to_int) <= $mv_int and
207
- (if .value.max_mendix_version then (.value.max_mendix_version | version_to_int) >= $mv_int else true end)
208
- )
209
- ) |
210
-
211
- # Get the latest matching NT version
212
- sort_by(.key | split(".") | map(tonumber)) |
213
- last |
214
- if . then .key else "master" end
215
- ' mendix_version.json)
216
-
217
- echo "Selected Native Template version: $nt_version"
218
- echo "nt_branch=$nt_version" >> $GITHUB_OUTPUT
219
-
139
+ chmod +x ./.github/scripts/determine-nt-version.sh
140
+ ./.github/scripts/determine-nt-version.sh "${{ needs.mendix-version.outputs.mendix_version }}"
220
141
- name : " Set output nt_branch"
221
142
id : set-output
222
143
run : |
223
144
if [[ "${{ steps.check-input.outputs.source }}" == "input" ]]; then
224
- echo "nt_branch=${{ steps.check-input.outputs .nt_branch }}" >> $GITHUB_OUTPUT
145
+ echo "nt_branch=${{ github.event.inputs .nt_branch }}" >> $GITHUB_OUTPUT
225
146
else
226
147
echo "nt_branch=${{ steps.determine-nt-branch.outputs.nt_branch }}" >> $GITHUB_OUTPUT
227
148
fi
149
+ - name : " Debug final branch output"
150
+ run : |
151
+ echo "Final nt_branch value: ${{ steps.set-output.outputs.nt_branch }}"
228
152
docker-images :
229
153
needs : [mendix-version]
230
154
runs-on : ubuntu-22.04
@@ -387,6 +311,8 @@ jobs:
387
311
needs : [android-bundle, determine-nt-version]
388
312
runs-on : ubuntu-22.04
389
313
steps :
314
+ - name : Debug branch value
315
+ run : echo "Using branch ${{ needs.determine-nt-version.outputs.nt_branch }}"
390
316
- name : " Check out Native Template for Native Components Test Project"
391
317
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
392
318
with :
0 commit comments