@@ -15,8 +15,8 @@ name: Review with IncQuery AUTOSAR-UML Bridge
15
15
- synchronize
16
16
- review_requested
17
17
env :
18
- ModelName : counting-logic
19
- ModelExtension : qeax
18
+ ModelName : DemoModel
19
+ ModelExtension : eapx
20
20
ReviewSessionURL : ' https://nexus.lieberlieber.com/repository/lemontree-session'
21
21
LemonTreePipelineToolsRemovePrerenderedDiagramsExecutable : https://nexus.lieberlieber.com/repository/lemontree-pipeline-tools/LemonTree.Pipeline.Tools.RemovePrerenderedDiagrams.exe
22
22
jobs :
27
27
runs-on : windows-latest
28
28
timeout-minutes : 15
29
29
steps :
30
- - uses : actions/checkout@v4
30
+ - uses : actions/checkout@v3
31
31
with :
32
32
ref : ${{ github.event.pull_request.head.ref }}
33
33
lfs : true
@@ -40,15 +40,15 @@ jobs:
40
40
uses : IncQueryLabs/incquery-suite-bridge-autosar-uml-action@v1
41
41
with :
42
42
arxml_folder_path : example-arxml
43
- ea_model_file_path : ' counting-logic.qeax '
43
+ ea_model_file_path : ' DemoModel.eapx '
44
44
incquery_username : ' ${{ secrets.INCQUERY_USERNAME }}'
45
45
incquery_password : ' ${{ secrets.INCQUERY_PASSWORD }}'
46
46
license : ' ${{ secrets.INCQUERY_AUTOSAR_UML_INTEGRATION_LICENSE }}'
47
47
- name : Push updated model
48
48
run : |
49
49
git config --local user.name "Automatic Model Update"
50
50
git config --local user.email "username@users.noreply.github.com"
51
- git add counting-logic.qeax
51
+ git add DemoModel.eapx
52
52
git commit -m "Automatic Model Update"
53
53
git push
54
54
- name : Get relevant commit IDs
@@ -79,21 +79,25 @@ jobs:
79
79
const filename = [repoName, 'PR', prNumber, baseSHA, headSHA].join('-') + '.ltsfs'
80
80
console.log(`Filename will be: ${filename}`)
81
81
return filename
82
+
82
83
- name : Download base-commit file
83
84
id : baseDownload
84
85
run : |
85
86
git fetch origin ${{steps.CommitIds.outputs.baseCommitId}}
86
- $contents = git cat-file blob ${{steps.CommitIds.outputs.baseCommitId}}:${{env.ModelName}}.${{env.ModelExtension}}
87
- echo $contents[1]
88
- if($contents -ne $null){
89
- echo "ps"
90
- $contents | Out-File -FilePath "${{env.ModelName}}_base.${{env.ModelExtension}}"
87
+ $pointer = git cat-file blob ${{steps.CommitIds.outputs.baseCommitId}}:${{env.ModelName}}.${{env.ModelExtension}}
88
+ $sha = ($pointer[1] -split(":"))[1]
89
+ if($sha -ne $null){
90
+ $shaPart1 = $sha.Substring(0,2)
91
+ $shaPart2 = $sha.Substring(2,2)
92
+ echo "Model SHA: $sha"
93
+ git cat-file --filters ${{steps.CommitIds.outputs.baseCommitId}}:${{env.ModelName}}.${{env.ModelExtension}} | Out-Null
94
+ copy ".git\lfs\objects\$shaPart1\$shaPart2\$sha" "${{env.ModelName}}_base.${{env.ModelExtension}}"
91
95
echo "result=downloaded" >> $env:GITHUB_OUTPUT
92
96
}
93
- else {
94
- echo "no"
97
+ else{
95
98
echo "result=notFound" >> $env:GITHUB_OUTPUT
96
99
}
100
+
97
101
- name : Post new model comment to PR
98
102
if : steps.baseDownload.outputs.result == 'notFound'
99
103
uses : actions/github-script@v6
@@ -103,15 +107,66 @@ jobs:
103
107
issue_number: context.issue.number,
104
108
owner: context.repo.owner,
105
109
repo: context.repo.repo,
106
- body: `Model not found on base commit or fork-off point`
110
+ body: `Model not found on base commit / fork-off point`
107
111
})
108
- - name : Download target file
112
+
113
+ - name : Download target branch head file
109
114
if : steps.baseDownload.outputs.result == 'downloaded'
110
115
id : headDownload
111
116
run : |
112
117
git fetch origin $env:GITHUB_HEAD_REF
113
- $pointer = git cat-file blob ${{steps.CommitIds.outputs.targetCommitId}}":${{env.ModelName}}.${{env.ModelExtension}}"
114
- $pointer | Out-File -FilePath "${{env.ModelName}}_target.${{env.ModelExtension}}"
118
+ $pointer = git cat-file blob ${{steps.CommitIds.outputs.targetId}}":${{env.ModelName}}.${{env.ModelExtension}}"
119
+ $sha = ($pointer[1] -split(":"))[1]
120
+ $shaPart1 = $sha.Substring(0,2)
121
+ $shaPart2 = $sha.Substring(2,2)
122
+ echo "Model SHA: $sha"
123
+ git cat-file --filters ${{steps.CommitIds.outputs.targetId}}":${{env.ModelName}}.${{env.ModelExtension}}" | Out-Null
124
+ copy ".git\lfs\objects\$shaPart1\$shaPart2\$sha" "${{env.ModelName}}_head.${{env.ModelExtension}}"
125
+
126
+ # download Lemontree.Automation on a runner and setup the license
127
+ - uses : LieberLieber/setup-LemonTree.Automation@v1
128
+ id : GetLTA
129
+ with :
130
+ License : ${{secrets.LTALICENSE}}
131
+ # ExeLocation &"${{steps.GetLTA.outputs.LemonTreeAutomationExecutable}}"
132
+
133
+ - name : Check for merge conflicts
134
+ if : steps.baseDownload.outputs.result == 'downloaded'
135
+ id : mergeCheck
136
+ run : |
137
+ &"${{steps.GetLTA.outputs.LemonTreeAutomationExecutable}}" merge --base ${{env.ModelName}}_base.${{env.ModelExtension}} --theirs ${{env.ModelName}}.${{env.ModelExtension}} --mine ${{env.ModelName}}_head.${{env.ModelExtension}} --dryrun --sfs ${{ steps.session_file.outputs.result }} --abortOnConflict true
138
+ echo "::set-output name=result::$LASTEXITCODE"
139
+ echo "Return code: $LASTEXITCODE"
140
+ if($LASTEXITCODE -eq 0){
141
+ echo "No merge conflicts, setting message"
142
+ echo "message=[Review Session file](${{env.ReviewSessionURL}}/${{ steps.session_file.outputs.result }})\n:heavy_check_mark: **No merge conflicts in model**\n\nInstall [LemonTree 3.3+](https://www.lieberlieber.com/lemontree/en/) to open the Review Session file." >> $env:GITHUB_OUTPUT
143
+ }
144
+ elseif($LASTEXITCODE -eq 2){
145
+ echo "Internal Error when diffing. Please report such errors to support@lieberlieber.com"
146
+ exit 2
147
+ }
148
+ elseif($LASTEXITCODE -eq 3){
149
+ echo "Merge conflicts, setting message"
150
+ echo "message=[Review Session file](${{env.ReviewSessionURL}}/${{ steps.session_file.outputs.result }})\n:x: **Please resolve merge conflicts in model first**\n\nInstall [LemonTree 3.3+](https://www.lieberlieber.com/lemontree/en/) to open the Review Session file." >> $env:GITHUB_OUTPUT
151
+ exit 0
152
+ }
153
+ elseif($LASTEXITCODE -eq 6){
154
+ echo "Licensing issue of LemonTree.Automation"
155
+ }
156
+ else{
157
+ echo "Unknown error"
158
+ }
159
+
160
+ # - name: Remove DIAGRAMIMAGEMAPS for Diff
161
+ # if: steps.mergeCheck.outputs.result == 0
162
+ # run: |
163
+ # while (Test-Path Alias:curl) {Remove-Item Alias:curl} #remove the alias binding from curl to Invoke-WebRequest
164
+ # curl "${{env.LemonTreePipelineToolsRemovePrerenderedDiagramsExecutable}}" --output LemonTree.Pipeline.Tools.RemovePrerenderedDiagrams.exe
165
+ # echo ".\LemonTree.Pipeline.Tools.RemovePrerenderedDiagrams.exe remove --Model ${{env.ModelName}}_base.${{env.ModelExtension}}"
166
+ # .\LemonTree.Pipeline.Tools.RemovePrerenderedDiagrams.exe remove --Model ${{env.ModelName}}_base.${{env.ModelExtension}}
167
+ # echo ".\LemonTree.Pipeline.Tools.RemovePrerenderedDiagrams.exe remove --Model ${{env.ModelName}}_head.${{env.ModelExtension}}"
168
+ # .\LemonTree.Pipeline.Tools.RemovePrerenderedDiagrams.exe remove --Model ${{env.ModelName}}_head.${{env.ModelExtension}}
169
+
115
170
- name : Create review session file
116
171
id : checkSession
117
172
run : |
@@ -121,17 +176,23 @@ jobs:
121
176
echo $output
122
177
ForEach ($line in $($output -split "`r`n"))
123
178
{
124
- if ($line.EndsWith('Found 0 different elements.'))
125
- {
126
- echo "No differences we don't need to publish the session file."
127
- $Message = ":heavy_check_mark: **Model is identical!**"
128
- $sfsfilename ="";
129
- }
179
+ $output = &'${{steps.GetLTA.outputs.LemonTreeAutomationExecutable}}' diff --theirs ${{env.ModelName}}_base.${{env.ModelExtension}} --mine ${{env.ModelName}}_head.${{env.ModelExtension}} --sfs ${{ steps.session_file.outputs.result }}
180
+ echo $output
181
+ ForEach ($line in $($output -split "`r`n"))
182
+ {
183
+ if ($line.EndsWith('Found 0 different elements.'))
184
+ {
185
+ echo "No differences we don't need to publish the session file."
186
+ $Message = ":heavy_check_mark: **Model is identical!**"
187
+ $sfsfilename ="";
188
+ }
189
+ }
130
190
}
131
191
echo "$Message"
132
192
echo "SfsFileName=$sfsfilename" >> $env:GITHUB_OUTPUT
133
193
echo "message=$Message" >> $env:GITHUB_OUTPUT
134
194
exit 0
195
+
135
196
- name : Upload
136
197
if : steps.baseDownload.outputs.result == 'downloaded'
137
198
run : |
@@ -147,13 +208,15 @@ jobs:
147
208
while (Test-Path Alias:curl) {Remove-Item Alias:curl} #remove the alias binding from curl to Invoke-WebRequest
148
209
curl "-u${{secrets.NEXUSAUTHENTICATION}}" -T $sessionFileName $targetUrl
149
210
}
211
+
150
212
- name : Archive Session Files
151
213
if : steps.baseDownload.outputs.result == 'downloaded'
152
214
uses : actions/upload-artifact@v3
153
215
with :
154
216
name : Review Session File
155
- path : ' ${{ steps.session_file.outputs.result }}'
217
+ path : ${{ steps.session_file.outputs.result }}
156
218
retention-days : 5
219
+
157
220
- name : Create PR comment
158
221
if : steps.baseDownload.outputs.result == 'downloaded'
159
222
uses : actions/github-script@v6
0 commit comments