Skip to content

Commit 673360a

Browse files
committed
Merge branch '193-incquery-autosar-uml-bridge' into 193-testing
2 parents 66afd62 + e5c7b2f commit 673360a

File tree

1 file changed

+86
-23
lines changed

1 file changed

+86
-23
lines changed

.github/workflows/AutosarUmlActionExample.yml

Lines changed: 86 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ name: Review with IncQuery AUTOSAR-UML Bridge
1515
- synchronize
1616
- review_requested
1717
env:
18-
ModelName: counting-logic
19-
ModelExtension: qeax
18+
ModelName: DemoModel
19+
ModelExtension: eapx
2020
ReviewSessionURL: 'https://nexus.lieberlieber.com/repository/lemontree-session'
2121
LemonTreePipelineToolsRemovePrerenderedDiagramsExecutable: https://nexus.lieberlieber.com/repository/lemontree-pipeline-tools/LemonTree.Pipeline.Tools.RemovePrerenderedDiagrams.exe
2222
jobs:
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: windows-latest
2828
timeout-minutes: 15
2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v3
3131
with:
3232
ref: ${{ github.event.pull_request.head.ref }}
3333
lfs: true
@@ -40,15 +40,15 @@ jobs:
4040
uses: IncQueryLabs/incquery-suite-bridge-autosar-uml-action@v1
4141
with:
4242
arxml_folder_path: example-arxml
43-
ea_model_file_path: 'counting-logic.qeax'
43+
ea_model_file_path: 'DemoModel.eapx'
4444
incquery_username: '${{ secrets.INCQUERY_USERNAME }}'
4545
incquery_password: '${{ secrets.INCQUERY_PASSWORD }}'
4646
license: '${{ secrets.INCQUERY_AUTOSAR_UML_INTEGRATION_LICENSE }}'
4747
- name: Push updated model
4848
run: |
4949
git config --local user.name "Automatic Model Update"
5050
git config --local user.email "username@users.noreply.github.com"
51-
git add counting-logic.qeax
51+
git add DemoModel.eapx
5252
git commit -m "Automatic Model Update"
5353
git push
5454
- name: Get relevant commit IDs
@@ -79,21 +79,25 @@ jobs:
7979
const filename = [repoName, 'PR', prNumber, baseSHA, headSHA].join('-') + '.ltsfs'
8080
console.log(`Filename will be: ${filename}`)
8181
return filename
82+
8283
- name: Download base-commit file
8384
id: baseDownload
8485
run: |
8586
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}}"
9195
echo "result=downloaded" >> $env:GITHUB_OUTPUT
9296
}
93-
else {
94-
echo "no"
97+
else{
9598
echo "result=notFound" >> $env:GITHUB_OUTPUT
9699
}
100+
97101
- name: Post new model comment to PR
98102
if: steps.baseDownload.outputs.result == 'notFound'
99103
uses: actions/github-script@v6
@@ -103,15 +107,66 @@ jobs:
103107
issue_number: context.issue.number,
104108
owner: context.repo.owner,
105109
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`
107111
})
108-
- name: Download target file
112+
113+
- name: Download target branch head file
109114
if: steps.baseDownload.outputs.result == 'downloaded'
110115
id: headDownload
111116
run: |
112117
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+
115170
- name: Create review session file
116171
id: checkSession
117172
run: |
@@ -121,17 +176,23 @@ jobs:
121176
echo $output
122177
ForEach ($line in $($output -split "`r`n"))
123178
{
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+
}
130190
}
131191
echo "$Message"
132192
echo "SfsFileName=$sfsfilename" >> $env:GITHUB_OUTPUT
133193
echo "message=$Message" >> $env:GITHUB_OUTPUT
134194
exit 0
195+
135196
- name: Upload
136197
if: steps.baseDownload.outputs.result == 'downloaded'
137198
run: |
@@ -147,13 +208,15 @@ jobs:
147208
while (Test-Path Alias:curl) {Remove-Item Alias:curl} #remove the alias binding from curl to Invoke-WebRequest
148209
curl "-u${{secrets.NEXUSAUTHENTICATION}}" -T $sessionFileName $targetUrl
149210
}
211+
150212
- name: Archive Session Files
151213
if: steps.baseDownload.outputs.result == 'downloaded'
152214
uses: actions/upload-artifact@v3
153215
with:
154216
name: Review Session File
155-
path: '${{ steps.session_file.outputs.result }}'
217+
path: ${{ steps.session_file.outputs.result }}
156218
retention-days: 5
219+
157220
- name: Create PR comment
158221
if: steps.baseDownload.outputs.result == 'downloaded'
159222
uses: actions/github-script@v6

0 commit comments

Comments
 (0)