Skip to content

Commit cd5d1c7

Browse files
authored
Add workflow and jenkins file to certify mac application (#211)
* Add workflow and jenkins file to certify mac application
1 parent 5224511 commit cd5d1c7

File tree

336 files changed

+1926
-1197
lines changed

Some content is hidden

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

336 files changed

+1926
-1197
lines changed

.github/workflows/tagged_release.yml

Lines changed: 54 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
required: true
99

1010
jobs:
11-
gh_tagged_release:
11+
build:
1212
name: Create tagged release
1313
runs-on: ${{ matrix.os }}
1414
strategy:
@@ -85,22 +85,24 @@ jobs:
8585
if [[ ${ASSET_ONE_URL} == *"-mac"* ]];
8686
then
8787
echo $ASSET_ONE_URL
88-
DOWNLOAD_URL=$(curl -sl --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/releases/tags/v${{ github.event.inputs.release_version }} | jq -r '.assets[0].url')
88+
DOWNLOAD_URL=$(curl -sl --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/releases/tags/v${{ github.event.inputs.release_version }} | jq -r '.assets[0].browser_download_url')
8989
fi
9090
9191
if [[ ${ASSET_TWO_URL} == *"-mac"* ]];
9292
then
9393
echo $ASSET_TWO_URL
94-
DOWNLOAD_URL=$(curl -sl --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/releases/tags/v${{ github.event.inputs.release_version }} | jq -r '.assets[1].url')
94+
DOWNLOAD_URL=$(curl -sl --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/releases/tags/v${{ github.event.inputs.release_version }} | jq -r '.assets[1].browser_download_url')
9595
fi
9696
9797
if [[ ${ASSET_THREE_URL} == *"-mac"* ]];
9898
then
9999
echo ASSET_THREE_URL
100-
DOWNLOAD_URL=$(curl -sl --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/releases/tags/v${{ github.event.inputs.release_version }} | jq -r '.assets[2].url')
100+
DOWNLOAD_URL=$(curl -sl --header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/releases/tags/v${{ github.event.inputs.release_version }} | jq -r '.assets[2].browser_download_url')
101101
fi
102102
103-
curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/octet-stream" $DOWNLOAD_URL > backend/ame-backend-${{ github.event.inputs.release_version }}-mac
103+
curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/octet-stream" $DOWNLOAD_URL > backend/ame-backend-${{ github.event.inputs.release_version }}-mac.zip
104+
unzip backend/ame-backend-${{ github.event.inputs.release_version }}-mac.zip -d backend/
105+
rm backend/ame-backend-${{ github.event.inputs.release_version }}-mac.zip
104106
chmod 755 backend/ame-backend-${{ github.event.inputs.release_version }}-mac
105107
106108
- name: Download aspect model service into project (Linux)
@@ -208,87 +210,81 @@ jobs:
208210
name: aspect-model-editor-v${{ github.event.inputs.release_version }}-win
209211
path: win-installer/aspect-model-editor-v${{ github.event.inputs.release_version }}-win.exe
210212

211-
# Sign Windows executable
212-
- name: Get Artifact ID (Windows)
213-
if: matrix.os == 'windows-latest'
213+
- name: Upload binary (Mac)
214+
if: matrix.os == 'macos-12'
215+
uses: actions/upload-artifact@v4
216+
with:
217+
name: aspect-model-editor-v${{ github.event.inputs.release_version }}-mac
218+
path: core/electron/aspect-model-editor-v${{ github.event.inputs.release_version }}-mac.zip
219+
220+
# Release Linux executables
221+
- name: Create GitHub release (Linux)
222+
if: ${{ (matrix.os == 'ubuntu-20.04') && (!contains( github.ref, '-rc' )) }}
223+
uses: svenstaro/upload-release-action@latest
224+
with:
225+
overwrite: true
226+
prerelease: false
227+
repo_token: ${{ secrets.GITHUB_TOKEN }}
228+
file: core/electron/aspect-model-editor-v${{ github.event.inputs.release_version }}-linux-glibc-v${{ env.GLIBC_VERSION }}.tar.gz
229+
tag: v${{ github.event.inputs.release_version }}
230+
231+
- name: Create GitHub pre-release (Linux)
232+
if: ${{ (matrix.os == 'ubuntu-20.04') && (contains( github.ref, '-rc' )) }}
233+
uses: svenstaro/upload-release-action@latest
234+
with:
235+
overwrite: true
236+
prerelease: true
237+
repo_token: ${{ secrets.GITHUB_TOKEN }}
238+
file: core/electron/aspect-model-editor-v${{ github.event.inputs.release_version }}-linux-glibc-v${{ env.GLIBC_VERSION }}.tar.gz
239+
tag: v${{ github.event.inputs.release_version }}
240+
241+
release:
242+
needs: build
243+
runs-on: ubuntu-latest
244+
steps:
245+
- name: Checkout project
246+
uses: actions/checkout@v3
247+
248+
# Sign (Windows & Mac) executable
249+
- name: Get Artifact ID (Windows & Mac)
214250
shell: bash
215251
run: |
216252
# Get the list of artifacts for the specified workflow run
217253
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")
218254
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')
255+
# Filter out the ID of the artifacts
256+
artifact_id_win=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("win")) | .id')
257+
artifact_id_mac=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("mac")) | .id')
221258
222259
# Save the artifact ID in an environment variable
223-
echo "ARTIFACT_ID=$artifact_id" >> $GITHUB_ENV
260+
echo "ARTIFACT_ID_WIN=$artifact_id_win" >> $GITHUB_ENV
261+
echo "ARTIFACT_ID_MAC=$artifact_id_mac" >> $GITHUB_ENV
224262
env:
225263
TOKEN: ${{ secrets.GITHUB_TOKEN }}
226264

227-
- name: Commit Artifact url and version changes and push to pre release branch for jenkins (Windows)
228-
if: matrix.os == 'windows-latest'
265+
- name: Commit Artifact url and version changes and push to pre release branch for jenkins (Windows & Mac)
229266
shell: bash
230267
run: |
231-
ARTIFACT_URL_WIN="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor/actions/artifacts/$ARTIFACT_ID/zip"
268+
ARTIFACT_URL_WIN="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor/actions/artifacts/$ARTIFACT_ID_WIN/zip"
269+
ARTIFACT_URL_MAC="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor/actions/artifacts/$ARTIFACT_ID_MAC/zip"
232270
BRANCH_NAME="pre_release_configuration"
233271
234272
echo "artifact_url_win=$ARTIFACT_URL_WIN" > parameters.txt
273+
echo "artifact_url_mac=$ARTIFACT_URL_MAC" >> parameters.txt
235274
echo "version=${{ github.event.inputs.release_version }}" >> parameters.txt
236275
237276
git config --global user.email "[email protected]"
238277
git config --global user.name "github-actions"
239278
git checkout -b $BRANCH_NAME
240279
git add parameters.txt
241-
git commit -m "Add parameters.txt with artifact_url_win and version"
280+
git commit -m "Add parameters.txt with artifact_url_win, artifact_url_mac and version"
242281
git push origin $BRANCH_NAME
243282
env:
244283
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
245284

246285
- name: Trigger Jenkins Job, for signing executable
247-
if: matrix.os == 'windows-latest'
248286
shell: bash
249287
run: |
250288
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]"}}'
251289
SHA1="$(echo -n "${DATA}" | openssl dgst -sha1 -hmac "${WEBHOOK_SECRET}" | sed 's/SHA1(stdin)= //')"
252290
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
256-
- name: Create GitHub release (Mac)
257-
if: ${{ (matrix.os == 'macos-12') && (!contains( github.ref, '-rc' )) }}
258-
uses: svenstaro/upload-release-action@latest
259-
with:
260-
overwrite: true
261-
prerelease: false
262-
repo_token: ${{ secrets.GITHUB_TOKEN }}
263-
file: core/electron/aspect-model-editor-v${{ github.event.inputs.release_version }}-mac.dmg
264-
tag: v${{ github.event.inputs.release_version }}
265-
266-
- name: Create GitHub pre-release (Mac)
267-
if: ${{ (matrix.os == 'macos-12') && (contains( github.ref, '-rc' )) }}
268-
uses: svenstaro/upload-release-action@latest
269-
with:
270-
overwrite: true
271-
prerelease: true
272-
repo_token: ${{ secrets.GITHUB_TOKEN }}
273-
file: core/electron/aspect-model-editor-v${{ github.event.inputs.release_version }}-mac.dmg
274-
tag: v${{ github.event.inputs.release_version }}
275-
276-
- name: Create GitHub release (Linux)
277-
if: ${{ (matrix.os == 'ubuntu-20.04') && (!contains( github.ref, '-rc' )) }}
278-
uses: svenstaro/upload-release-action@latest
279-
with:
280-
overwrite: true
281-
prerelease: false
282-
repo_token: ${{ secrets.GITHUB_TOKEN }}
283-
file: core/electron/aspect-model-editor-v${{ github.event.inputs.release_version }}-linux-glibc-v${{ env.GLIBC_VERSION }}.tar.gz
284-
tag: v${{ github.event.inputs.release_version }}
285-
286-
- name: Create GitHub pre-release (Linux)
287-
if: ${{ (matrix.os == 'ubuntu-20.04') && (contains( github.ref, '-rc' )) }}
288-
uses: svenstaro/upload-release-action@latest
289-
with:
290-
overwrite: true
291-
prerelease: true
292-
repo_token: ${{ secrets.GITHUB_TOKEN }}
293-
file: core/electron/aspect-model-editor-v${{ github.event.inputs.release_version }}-linux-glibc-v${{ env.GLIBC_VERSION }}.tar.gz
294-
tag: v${{ github.event.inputs.release_version }}

.jenkins/Jenkinsfile

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
pipeline {
22
agent any
3+
tools {
4+
maven 'apache-maven-latest'
5+
jdk 'openjdk-jdk17-latest'
6+
}
37

48
environment {
59
GITHUB_BOT_TOKEN = credentials('github-bot-token')
@@ -24,7 +28,8 @@ pipeline {
2428
}
2529
}
2630

27-
echo "Artifact URL: ${env.artifact_url_win}"
31+
echo "Artifact URL Win: ${env.artifact_url_win}"
32+
echo "Artifact URL Mac: ${env.artifact_url_mac}"
2833
echo "Version: ${env.version}"
2934
} else {
3035
echo "Error: parameters.txt does not exist."
@@ -33,35 +38,78 @@ pipeline {
3338
}
3439
}
3540

36-
stage('Download and unpack artifact') {
41+
stage('Download and unpack Windows artifact') {
3742
steps {
3843
script {
44+
def winOsFile = "aspect-model-editor-v${env.version}-win.zip"
3945
sh "curl -L -H 'Accept: application/vnd.github.v3+json' \
4046
-H 'Authorization: Bearer ${GITHUB_BOT_TOKEN}' \
4147
'${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"
48+
--output '${winOsFile}'"
49+
sh "mkdir -p unpack_win_dir"
50+
sh "unzip -o aspect-model-editor-v${env.version}-win.zip -d unpack_win_dir"
51+
sh "rm '${winOsFile}'"
52+
sh "ls -a unpack_win_dir"
4653
}
4754
}
4855
}
4956

50-
stage('Sign Applications') {
57+
stage('Sign Windows Applications') {
5158
steps {
5259
script {
5360
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"
61+
sh "curl -o signed_dir/aspect-model-editor-v${env.version}-win.exe -F file=@unpack_win_dir/aspect-model-editor-v${env.version}-win.exe https://cbi.eclipse.org/authenticode/sign"
62+
sh "zip -r aspect-model-editor-v${env.version}-win.zip signed_dir"
63+
sh "ls -a signed_dir"
5564
}
5665
}
5766
}
5867

59-
stage('Release signed WINDOWS artifact to GitHub Releases') {
68+
stage('Download Mac artifact') {
6069
steps {
6170
script {
71+
sh "mkdir -p unpack_mac_dir"
72+
def macOsFile = "aspect-model-editor-v${env.version}-mac.zip"
73+
sh "curl -L -H 'Accept: application/vnd.github.v3+json' \
74+
-H 'Authorization: Bearer ${GITHUB_BOT_TOKEN}' \
75+
'${env.artifact_url_mac}' \
76+
--output 'unpack_mac_dir/${macOsFile}'"
77+
sh "unzip -o unpack_mac_dir/${macOsFile} -d unpack_mac_dir"
78+
sh "unzip -o unpack_mac_dir/${macOsFile} -d unpack_mac_dir"
79+
sh "rm 'unpack_mac_dir/${macOsFile}'"
80+
sh "ls -a unpack_mac_dir"
81+
}
82+
}
83+
}
84+
85+
stage('Sign Electron Application on Mac') {
86+
steps {
87+
script {
88+
nodejs(nodeJSInstallationName: 'node_20.x') {
89+
sh '''
90+
echo "NPM version:"
91+
npm --version
92+
npm install isbinaryfile
93+
cd core
94+
chmod +x electron-libs/scripts/sign.sh
95+
chmod +x electron-libs/scripts/notarize.sh
96+
node electron-libs/scripts/after-pack.js
97+
'''
98+
}
99+
}
100+
}
101+
}
102+
103+
stage('Release signed Windows and Mac artifact to GitHub Releases') {
104+
steps {
105+
script {
106+
def macOsFile = "aspect-model-editor-v${env.version}-mac.zip"
107+
sh "mv unpack_mac_dir/notarized.zip ./${macOsFile}"
108+
62109
def repo = "eclipse-esmf/esmf-aspect-model-editor"
63110
def tagName = "v${env.version}"
64-
def fileName = "signed_dir/aspect-model-editor-v${env.version}-win.exe"
111+
def fileNameWin = "aspect-model-editor-v${env.version}-win.zip"
112+
def fileNameMac = "aspect-model-editor-v${env.version}-mac.zip"
65113
def releaseId = ""
66114

67115
def tagExists = sh(script: """
@@ -97,14 +145,24 @@ pipeline {
97145
-H "Accept: application/vnd.github+json" \\
98146
-H "Authorization: Bearer \$GITHUB_BOT_TOKEN" \
99147
-H "Content-Type: application/octet-stream" \
100-
--data-binary @${fileName} \
101-
"https://uploads.github.com/repos/${repo}/releases/${releaseId}/assets?name=aspect-model-editor-v${env.version}-win.exe"
148+
--data-binary @${fileNameWin} \
149+
"https://uploads.github.com/repos/${repo}/releases/${releaseId}/assets?name=${fileNameWin}"
150+
"""
151+
152+
sh """
153+
curl -L \
154+
-X POST \
155+
-H "Accept: application/vnd.github+json" \\
156+
-H "Authorization: Bearer \$GITHUB_BOT_TOKEN" \
157+
-H "Content-Type: application/octet-stream" \
158+
--data-binary @${fileNameMac} \
159+
"https://uploads.github.com/repos/${repo}/releases/${releaseId}/assets?name=${fileNameMac}"
102160
"""
103161

104162
sh """
105163
curl -X DELETE \
106164
-H "Authorization: Bearer \$GITHUB_BOT_TOKEN" \
107-
"https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor/git/refs/heads/pre_release_configuration"
165+
"https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/git/refs/heads/pre_release_configuration"
108166
"""
109167
}
110168
}

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
});

0 commit comments

Comments
 (0)