66 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)"
77 required : false
88 default : " "
9-
109 nt_branch :
1110 description : " Native Template branch/tag to use (Leave empty to auto-select based on Mendix version)"
1211 default : " "
1312 required : false
1413 type : string
15-
1614 workspace :
1715 description : " Select a widget to test (Default will run all)"
1816 required : true
6462 - cron : ' 0 0 * * *'
6563 # Trigger on PR
6664 # pull_request:
67-
68-
6965permissions :
7066 packages : write
71-
7267jobs :
7368 scope :
7469 runs-on : ubuntu-latest
@@ -80,56 +75,15 @@ jobs:
8075 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
8176 with :
8277 fetch-depth : 2 # Fetch the latest two commits and its parent commit
83-
8478 - name : " Determine scope"
8579 id : scope
8680 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 }}"
12883 - name : " Debug Scope Output"
12984 run : |
13085 echo "Scope is: ${{ steps.scope.outputs.scope }}"
13186 echo "Widgets are: ${{ steps.scope.outputs.widgets }}"
132-
13387 mendix-version :
13488 runs-on : ubuntu-22.04
13589 outputs :
@@ -154,14 +108,14 @@ jobs:
154108 - name : " Debug Mendix Version"
155109 run : |
156110 echo "Mendix Version: ${{ steps.set-mendix-version.outputs.MENDIX_VERSION }}"
157-
158-
159111 determine-nt-version :
160112 needs : [mendix-version]
161113 runs-on : ubuntu-latest
162114 outputs :
163- nt_branch : ${{ steps.determine-nt-branch .outputs.nt_branch }}
115+ nt_branch : ${{ steps.set-output .outputs.nt_branch }}
164116 steps :
117+ - name : " Check out code"
118+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
165119 - name : " Check if nt_branch was specified"
166120 id : check-input
167121 run : |
@@ -173,58 +127,28 @@ jobs:
173127 echo "No nt_branch specified, will determine from mendix_version"
174128 echo "source=auto" >> $GITHUB_OUTPUT
175129 fi
176-
177130 - name : " Download mendix_version.json from native-template repo"
178131 if : steps.check-input.outputs.source == 'auto'
179132 run : |
180133 curl -s -o mendix_version.json https://raw.githubusercontent.com/mendix/native-template/master/mendix_version.json
181134 cat mendix_version.json
182-
183135 - name : " Determine Native Template version based on Mendix version"
184136 if : steps.check-input.outputs.source == 'auto'
185137 id : determine-nt-branch
186138 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 }}"
220141 - name : " Set output nt_branch"
221142 id : set-output
222143 run : |
223144 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
225146 else
226147 echo "nt_branch=${{ steps.determine-nt-branch.outputs.nt_branch }}" >> $GITHUB_OUTPUT
227148 fi
149+ - name : " Debug final branch output"
150+ run : |
151+ echo "Final nt_branch value: ${{ steps.set-output.outputs.nt_branch }}"
228152 docker-images :
229153 needs : [mendix-version]
230154 runs-on : ubuntu-22.04
@@ -387,6 +311,8 @@ jobs:
387311 needs : [android-bundle, determine-nt-version]
388312 runs-on : ubuntu-22.04
389313 steps :
314+ - name : Debug branch value
315+ run : echo "Using branch ${{ needs.determine-nt-version.outputs.nt_branch }}"
390316 - name : " Check out Native Template for Native Components Test Project"
391317 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
392318 with :
0 commit comments