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 :
11- description : " Native Template branch to use (Default: master )"
12- default : " master "
10+ description : " Native Template branch/tag to use (Leave empty to auto-select based on Mendix version )"
11+ default : " "
1312 required : false
1413 type : string
15-
1614 workspace :
1715 description : " Select a widget to test (Default will run all)"
1816 required : true
5957 - video-player-native
6058 - web-view-native
6159
60+ # Run at 0:00 UTC (2:00 AM CET time during summer, 1:00 AM during winter)
61+ schedule :
62+ - cron : ' 0 0 * * *'
6263 # Trigger on PR
6364 # pull_request:
64-
65-
6665permissions :
6766 packages : write
68-
6967jobs :
7068 scope :
7169 runs-on : ubuntu-latest
@@ -77,56 +75,15 @@ jobs:
7775 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
7876 with :
7977 fetch-depth : 2 # Fetch the latest two commits and its parent commit
80-
8178 - name : " Determine scope"
8279 id : scope
8380 run : |
84- if [ "${{ github.event_name }}" == "pull_request" ]; then
85- if git cat-file -e ${{ github.event.before }} 2>/dev/null; then
86- changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
87- else
88- echo "Previous commit not found, using HEAD~1 as fallback"
89- changed_files=$(git diff --name-only HEAD~1 ${{ github.sha }})
90- fi
91-
92- selected_workspaces=""
93- for file in $changed_files; do
94- if [[ $file == packages/pluggableWidgets/* ]]; then
95- widget=$(echo $file | cut -d'/' -f3)
96- if [[ ! $selected_workspaces =~ $widget ]]; then
97- selected_workspaces="$selected_workspaces $widget"
98- fi
99- fi
100- done
101-
102- # Trim leading and trailing spaces from selected_workspaces
103- selected_workspaces=$(echo $selected_workspaces | xargs)
104-
105- if [[ -n "$selected_workspaces" ]]; then
106- echo "scope=--all --include '$selected_workspaces'" >> $GITHUB_OUTPUT
107- echo "widgets=[\"$selected_workspaces\"]" >> $GITHUB_OUTPUT
108- else
109- 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"]'
110- echo "scope=--all --include '*-native'" >> $GITHUB_OUTPUT
111- echo "widgets=${widgets}" >> $GITHUB_OUTPUT
112- fi
113- else
114- if [ -n "${{ github.event.inputs.workspace }}" ] && [ "${{ github.event.inputs.workspace }}" != "*-native" ]; then
115- selected_workspaces=$(echo "${{ github.event.inputs.workspace }}" | sed 's/,/ /g')
116- echo "scope=--all --include '${selected_workspaces}'" >> $GITHUB_OUTPUT
117- echo "widgets=[\"${{ github.event.inputs.workspace }}\"]" >> $GITHUB_OUTPUT
118- else
119- 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"]'
120- echo "scope=--all --include '*-native'" >> $GITHUB_OUTPUT
121- echo "widgets=${widgets}" >> $GITHUB_OUTPUT
122- fi
123- fi
124-
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 }}"
12583 - name : " Debug Scope Output"
12684 run : |
12785 echo "Scope is: ${{ steps.scope.outputs.scope }}"
12886 echo "Widgets are: ${{ steps.scope.outputs.widgets }}"
129-
13087 mendix-version :
13188 runs-on : ubuntu-22.04
13289 outputs :
@@ -151,9 +108,49 @@ jobs:
151108 - name : " Debug Mendix Version"
152109 run : |
153110 echo "Mendix Version: ${{ steps.set-mendix-version.outputs.MENDIX_VERSION }}"
154-
111+ determine-nt-version :
112+ needs : [mendix-version]
113+ runs-on : ubuntu-latest
114+ outputs :
115+ nt_branch : ${{ steps.set-output.outputs.nt_branch }}
116+ steps :
117+ - name : " Check out code"
118+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
119+ - name : " Check if nt_branch was specified"
120+ id : check-input
121+ run : |
122+ if [[ -n "${{ github.event.inputs.nt_branch }}" ]]; then
123+ echo "Using specified nt_branch: ${{ github.event.inputs.nt_branch }}"
124+ echo "nt_branch=${{ github.event.inputs.nt_branch }}" >> $GITHUB_OUTPUT
125+ echo "source=input" >> $GITHUB_OUTPUT
126+ else
127+ echo "No nt_branch specified, will determine from mendix_version"
128+ echo "source=auto" >> $GITHUB_OUTPUT
129+ fi
130+ - name : " Download mendix_version.json from native-template repo"
131+ if : steps.check-input.outputs.source == 'auto'
132+ run : |
133+ curl -s -o mendix_version.json https://raw.githubusercontent.com/mendix/native-template/master/mendix_version.json
134+ cat mendix_version.json
135+ - name : " Determine Native Template version based on Mendix version"
136+ if : steps.check-input.outputs.source == 'auto'
137+ id : determine-nt-branch
138+ run : |
139+ pip install requests packaging
140+ python ./.github/scripts/determine-nt-version.py "${{ needs.mendix-version.outputs.mendix_version }}"
141+ - name : " Set output nt_branch"
142+ id : set-output
143+ run : |
144+ if [[ "${{ steps.check-input.outputs.source }}" == "input" ]]; then
145+ echo "nt_branch=${{ github.event.inputs.nt_branch }}" >> $GITHUB_OUTPUT
146+ else
147+ echo "nt_branch=${{ steps.determine-nt-branch.outputs.nt_branch }}" >> $GITHUB_OUTPUT
148+ fi
149+ - name : " Debug final branch output"
150+ run : |
151+ echo "Final nt_branch value: ${{ steps.set-output.outputs.nt_branch }}"
155152 docker-images :
156- needs : mendix-version
153+ needs : [ mendix-version]
157154 runs-on : ubuntu-22.04
158155 steps :
159156 - name : " Login to GitHub Container Registry"
@@ -311,14 +308,16 @@ jobs:
311308 platform : ios
312309 mda-file : automation.mda
313310 android-app :
314- needs : [android-bundle]
311+ needs : [android-bundle, determine-nt-version ]
315312 runs-on : ubuntu-22.04
316313 steps :
314+ - name : Debug branch value
315+ run : echo "Using branch ${{ needs.determine-nt-version.outputs.nt_branch }}"
317316 - name : " Check out Native Template for Native Components Test Project"
318317 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
319318 with :
320319 repository : mendix/native-template
321- ref : ${{ github.event.inputs .nt_branch || 'master' }}
320+ ref : ${{ needs.determine-nt-version.outputs .nt_branch }}
322321 path : native-template
323322 - name : " Check out code"
324323 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
@@ -377,14 +376,14 @@ jobs:
377376 name : android-app
378377 path : native-template/android/app/build/outputs/apk/**/*.apk
379378 ios-app :
380- needs : [ios-bundle]
379+ needs : [ios-bundle, determine-nt-version ]
381380 runs-on : macos-13
382381 steps :
383382 - name : " Check out Native Template for Native Components Test Project"
384383 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
385384 with :
386385 repository : mendix/native-template
387- ref : ${{ github.event.inputs .nt_branch || 'master' }}
386+ ref : ${{ needs.determine-nt-version.outputs .nt_branch }}
388387 path : native-template
389388 - name : " Check out code"
390389 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
0 commit comments