Skip to content

Commit a7d37ac

Browse files
authored
Certify ame win frontend (#203)
* WIP sign windows electron application for ame * Testing on pr level * Remove sh husky step for windows to sign application * Update Jenkinsfile * Add certify sign to release workflow
1 parent 750d3ba commit a7d37ac

File tree

330 files changed

+1259
-1426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

330 files changed

+1259
-1426
lines changed

.github/workflows/tagged_release.yml

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,58 @@ jobs:
201201
script-file: win-installer/installer.nsi
202202
arguments: "-V3 -DVERSION=${{ github.event.inputs.release_version }}"
203203

204+
- name: Upload binary (Windows)
205+
if: matrix.os == 'windows-latest'
206+
uses: actions/upload-artifact@v4
207+
with:
208+
name: aspect-model-editor-v${{ github.event.inputs.release_version }}-win
209+
path: win-installer/aspect-model-editor-v${{ github.event.inputs.release_version }}-win.exe
210+
211+
# Sign Windows executable
212+
- name: Get Artifact ID (Windows)
213+
if: matrix.os == 'windows-latest'
214+
shell: bash
215+
run: |
216+
# Get the list of artifacts for the specified workflow run
217+
response=$(curl -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/${{ github.repository_owner }}/$(echo '${{ github.repository }}' | cut -d'/' -f2)/actions/runs/${{ github.run_id }}/artifacts")
218+
219+
# Filter out the ID of the artifact with a name that contains "windows"
220+
artifact_id=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("win")) | .id')
221+
222+
# Save the artifact ID in an environment variable
223+
echo "ARTIFACT_ID=$artifact_id" >> $GITHUB_ENV
224+
env:
225+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
226+
227+
- name: Commit Artifact url and version changes and push to pre release branch for jenkins (Windows)
228+
if: matrix.os == 'windows-latest'
229+
shell: bash
230+
run: |
231+
ARTIFACT_URL_WIN="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor/actions/artifacts/$ARTIFACT_ID/zip"
232+
BRANCH_NAME="pre_release_configuration"
233+
234+
echo "artifact_url_win=$ARTIFACT_URL_WIN" > parameters.txt
235+
echo "version=${{ github.event.inputs.release_version }}" >> parameters.txt
236+
237+
git config --global user.email "[email protected]"
238+
git config --global user.name "github-actions"
239+
git checkout -b $BRANCH_NAME
240+
git add parameters.txt
241+
git commit -m "Add parameters.txt with artifact_url_win and version"
242+
git push origin $BRANCH_NAME
243+
env:
244+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
245+
246+
- name: Trigger Jenkins Job, for signing executable
247+
if: matrix.os == 'windows-latest'
248+
shell: bash
249+
run: |
250+
DATA='{"repository": {"url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor", "html_url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor", "owner": { "name": "ESMF"}}, "pusher": { "name": "GitHub Action", "email": "[email protected]"}}'
251+
SHA1="$(echo -n "${DATA}" | openssl dgst -sha1 -hmac "${WEBHOOK_SECRET}" | sed 's/SHA1(stdin)= //')"
252+
curl -X POST https://ci.eclipse.org/esmf/github-webhook/ -H "Content-Type: application/json" -H "X-GitHub-Event: push" -H "X-Hub-Signature: sha1=${SHA1}" -d "${DATA}"
253+
254+
255+
# Release Mac and Linux executables
204256
- name: Create GitHub release (Mac)
205257
if: ${{ (matrix.os == 'macos-12') && (!contains( github.ref, '-rc' )) }}
206258
uses: svenstaro/upload-release-action@latest
@@ -240,23 +292,3 @@ jobs:
240292
repo_token: ${{ secrets.GITHUB_TOKEN }}
241293
file: core/electron/aspect-model-editor-v${{ github.event.inputs.release_version }}-linux-glibc-v${{ env.GLIBC_VERSION }}.tar.gz
242294
tag: v${{ github.event.inputs.release_version }}
243-
244-
- name: Create GitHub release (Windows)
245-
if: ${{ (matrix.os == 'windows-latest') && (!contains( github.ref, '-rc' )) }}
246-
uses: svenstaro/upload-release-action@latest
247-
with:
248-
overwrite: true
249-
prerelease: false
250-
repo_token: ${{ secrets.GITHUB_TOKEN }}
251-
file: win-installer/aspect-model-editor-v${{ github.event.inputs.release_version }}-win.exe
252-
tag: v${{ github.event.inputs.release_version }}
253-
254-
- name: Create GitHub pre-release (Windows)
255-
if: ${{ (matrix.os == 'windows-latest') && (contains( github.ref, '-rc' )) }}
256-
uses: svenstaro/upload-release-action@latest
257-
with:
258-
overwrite: true
259-
prerelease: true
260-
repo_token: ${{ secrets.GITHUB_TOKEN }}
261-
file: win-installer/aspect-model-editor-v${{ github.event.inputs.release_version }}-win.exe
262-
tag: v${{ github.event.inputs.release_version }}

.jenkins/Jenkinsfile

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
pipeline {
2+
agent any
3+
4+
environment {
5+
GITHUB_BOT_TOKEN = credentials('github-bot-token')
6+
}
7+
8+
stages {
9+
stage('Read parameters file') {
10+
steps {
11+
script {
12+
if (fileExists('parameters.txt')) {
13+
// Read the file
14+
def fileContent = readFile('parameters.txt').trim()
15+
16+
// Split the file content into lines
17+
def lines = fileContent.split("\n")
18+
19+
// Iterate over the lines and set the environment variables
20+
lines.each { line ->
21+
def parts = line.split('=')
22+
if (parts.size() == 2) {
23+
env[parts[0]] = parts[1]
24+
}
25+
}
26+
27+
echo "Artifact URL: ${env.artifact_url_win}"
28+
echo "Version: ${env.version}"
29+
} else {
30+
echo "Error: parameters.txt does not exist."
31+
}
32+
}
33+
}
34+
}
35+
36+
stage('Download and unpack artifact') {
37+
steps {
38+
script {
39+
sh "curl -L -H 'Accept: application/vnd.github.v3+json' \
40+
-H 'Authorization: Bearer ${GITHUB_BOT_TOKEN}' \
41+
'${env.artifact_url_win}' \
42+
--output 'aspect-model-editor-v${env.version}-win.zip'"
43+
sh "mkdir -p unpack_dir"
44+
sh "unzip -o aspect-model-editor-v${env.version}-win.zip -d unpack_dir"
45+
sh "ls -a unpack_dir"
46+
}
47+
}
48+
}
49+
50+
stage('Sign Applications') {
51+
steps {
52+
script {
53+
sh "mkdir -p signed_dir"
54+
sh "curl -o signed_dir/aspect-model-editor-v${env.version}-win.exe -F file=@unpack_dir/aspect-model-editor-v${env.version}-win.exe https://cbi.eclipse.org/authenticode/sign"
55+
sh "zip -r aspect-model-editor-v${env.version}-win-signed.zip signed_dir"
56+
}
57+
}
58+
}
59+
60+
stage('Release signed WINDOWS artifact to GitHub Releases') {
61+
steps {
62+
script {
63+
def repo = "eclipse-esmf/esmf-aspect-model-editor"
64+
def tagName = "v${env.version}"
65+
def fileName = "aspect-model-editor-v${env.version}-win-signed.zip"
66+
def releaseId = ""
67+
68+
def tagExists = sh(script: """
69+
curl -s -L \\
70+
-H "Accept: application/vnd.github+json" \\
71+
-H "Authorization: Bearer \$GITHUB_BOT_TOKEN" \\
72+
https://api.github.com/repos/${repo}/git/refs/tags/${tagName} | jq -r '.ref'
73+
""", returnStdout: true).trim()
74+
75+
if (tagExists == "null") {
76+
// Tag does not exist, create a new one
77+
releaseId = sh(script: """
78+
curl -s -L \\
79+
-H "Accept: application/vnd.github+json" \\
80+
-H "Authorization: Bearer \$GITHUB_BOT_TOKEN" \\
81+
-X POST \\
82+
-d '{ "tag_name": "${tagName}", "name": "${tagName}", "body": "Release ${tagName}" }' \\
83+
https://api.github.com/repos/${repo}/releases | jq -r '.id'
84+
""", returnStdout: true).trim()
85+
} else {
86+
// Tag exists, use the existing one
87+
releaseId = sh(script: """
88+
curl -s -L \\
89+
-H "Accept: application/vnd.github+json" \\
90+
-H "Authorization: Bearer \$GITHUB_BOT_TOKEN" \\
91+
https://api.github.com/repos/${repo}/releases/tags/${tagName} | jq -r '.id'
92+
""", returnStdout: true).trim()
93+
}
94+
95+
sh """
96+
curl -L \
97+
-X POST \
98+
-H "Accept: application/vnd.github+json" \\
99+
-H "Authorization: Bearer \$GITHUB_BOT_TOKEN" \
100+
-H "Content-Type: application/octet-stream" \
101+
--data-binary @${fileName} \
102+
"https://uploads.github.com/repos/${repo}/releases/${releaseId}/assets?name=${fileName}"
103+
"""
104+
105+
sh """
106+
curl -X DELETE \
107+
-H "Authorization: Bearer \$GITHUB_BOT_TOKEN" \
108+
"https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor/git/refs/heads/pre_release_configuration"
109+
"""
110+
}
111+
}
112+
}
113+
}
114+
}

core/.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
. "$(dirname -- "$0")/_/husky.sh"
33

44
cd core
5-
npm run format:all -- --uncommited && npm run affected:lint -- --uncommited --parallel
5+
npm run format:all -- --uncommited
66

77
if [ -n "$(git status --porcelain)" ]; then
88
git add .

core/apps/ame-e2e/src/fixtures/valid-documentation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
~ SPDX-License-Identifier: MPL-2.0
1212
-->
1313

14-
<!doctype html>
14+
<!DOCTYPE html>
1515
<html lang="en">
1616
<head>
1717
<title>Test Documentation</title>

core/apps/ame-e2e/src/integration/drag-and-drop/different-namespace/external-characteristic-reference.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('Test drag and drop ext characteristic', () => {
3939
},
4040
{
4141
fixture: `/external-reference/different-namespace/without-childrens/${fileName}`,
42-
},
42+
}
4343
);
4444

4545
cy.visitDefault().then(() =>
@@ -61,7 +61,7 @@ describe('Test drag and drop ext characteristic', () => {
6161
expect(rdf).to.contain(':property1 a samm:Property');
6262
expect(rdf).to.contain('samm:characteristic ext-different:ExternalCharacteristic');
6363
expect(rdf).not.contain(':ExternalCharacteristic a samm:Characteristic');
64-
}),
64+
})
6565
);
6666
});
6767
});

core/apps/ame-e2e/src/integration/drag-and-drop/different-namespace/external-constraint-reference.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('Test drag and drop ext constraint', () => {
4141
},
4242
{
4343
fixture: `/external-reference/different-namespace/without-childrens/${fileName}`,
44-
},
44+
}
4545
);
4646

4747
cy.visitDefault().then(() =>
@@ -71,7 +71,7 @@ describe('Test drag and drop ext constraint', () => {
7171
expect(rdf).to.contain(':Characteristic1 a samm:Characteristic');
7272
expect(rdf).to.contain('samm-c:constraint ext-different:ExternalConstraint');
7373
expect(rdf).not.contain(':ExternalConstraint a samm:Constraint');
74-
}),
74+
})
7575
);
7676
});
7777
});

core/apps/ame-e2e/src/integration/drag-and-drop/different-namespace/external-entity-reference.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('Test drag and drop', () => {
3838
},
3939
{
4040
fixture: `/external-reference/different-namespace/without-childrens/${fileName}`,
41-
},
41+
}
4242
);
4343

4444
cy.visitDefault().then(() =>
@@ -64,7 +64,7 @@ describe('Test drag and drop', () => {
6464
expect(rdf).to.contain('samm:dataType ext-different:ExternalEntity');
6565

6666
expect(rdf).not.contain(':ExternalEntity a samm:Entity');
67-
}),
67+
})
6868
);
6969
});
7070
});

core/apps/ame-e2e/src/integration/drag-and-drop/different-namespace/external-property-reference-with-children.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('Test drag and drop ext properties', () => {
3838
},
3939
{
4040
fixture: `/external-reference/different-namespace/with-childrens/${fileName}`,
41-
},
41+
}
4242
);
4343

4444
cy.visitDefault().then(() =>
@@ -69,7 +69,7 @@ describe('Test drag and drop ext properties', () => {
6969
expect(rdf).not.contain('samm:characteristic samm-c:Boolean');
7070
expect(rdf).not.contain(':ChildrenCharacteristic2 a samm:Characteristic');
7171
expect(rdf).not.contain(':ChildrenEntity2 a samm:Entity');
72-
}),
72+
})
7373
);
7474
});
7575
});

core/apps/ame-e2e/src/integration/drag-and-drop/different-namespace/external-property-reference.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('Test drag and drop ext properties', () => {
3838
},
3939
{
4040
fixture: `/external-reference/different-namespace/without-childrens/${fileName}`,
41-
},
41+
}
4242
);
4343

4444
cy.visitDefault().then(() =>
@@ -63,7 +63,7 @@ describe('Test drag and drop ext properties', () => {
6363
expect(rdf).to.contain(':Characteristic1 a samm:Characteristic');
6464

6565
expect(rdf).not.contain(':externalProperty a samm:Property');
66-
}),
66+
})
6767
);
6868
});
6969
});

core/apps/ame-e2e/src/integration/drag-and-drop/new-elements.cy.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ describe('Test drag and drop', () => {
4949

5050
.then(() => cy.clickConnectShapes('AspectDefault', 'operation1'))
5151
.then(() =>
52-
cyHelp
53-
.hasAddInputAndOutputShapeOverlay('operation1')
54-
.then(hasInputAndOutputOverlay => expect(hasInputAndOutputOverlay).equal(true)),
52+
cyHelp.hasAddInputAndOutputShapeOverlay('operation1').then(hasInputAndOutputOverlay => expect(hasInputAndOutputOverlay).equal(true))
5553
)
5654

5755
.then(() => cy.clickConnectShapes('property2', 'Trait1'))
@@ -79,7 +77,7 @@ describe('Test drag and drop', () => {
7977
expect(aspect.properties[1].property.characteristic.name).to.equals('Trait1');
8078
expect(aspect.properties[1].property.characteristic.baseCharacteristic.name).to.equals('Characteristic1');
8179
expect(aspect.properties[1].property.characteristic.baseCharacteristic.dataType.name).to.equals('Entity1');
82-
}),
80+
})
8381
);
8482
});
8583
});

0 commit comments

Comments
 (0)