-
Notifications
You must be signed in to change notification settings - Fork 3
167 lines (142 loc) · 6.92 KB
/
pull_request_check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Check New Pull Request
on:
push:
branches: [ main ]
pull_request:
branches: [ '**' ]
jobs:
build:
name: Check if passes all requirements
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ macos-12, windows-latest, ubuntu-20.04 ]
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Configure Pagefile
if: matrix.os == 'windows-latest'
# Fix for "LINK : fatal error LNK1171: unable to load mspdbcore.dll (error code: 1455)":
# This seems to be caused by running out of memory; increasing page file
# size suggested here:
# https://github.com/actions/virtual-environments/issues/3420#issuecomment-861342418
uses: al-cheb/[email protected]
with:
minimum-size: 16GB
maximum-size: 16GB
disk-root: "C:"
- name: Setup graalvm ce
uses: graalvm/setup-graalvm@v1
with:
version: '22.3.1'
java-version: '17'
components: 'native-image,js'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache maven packages
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Creating native image (Mac)
if: matrix.os == 'macos-12'
run: mvn install -P native-image -Dos.platform=mac -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Creating native image (Linux)
if: matrix.os == 'ubuntu-20.04'
run: mvn install -P native-image -Dos.platform=linux -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up MSVC
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Creating native image (Win)
if: matrix.os == 'windows-latest'
run: mvn install -P native-image -D os.platform=win -D maven.wagon.httpconnectionManager.ttlSeconds=60
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Performing integration test for Mac
if: matrix.os == 'macos-12'
run: mvn install -DskipTests -P dependencies-for-integration-tests,start-unix-native-image-for-integration-tests,run-postman-integration-tests -Dos.platform=mac
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Performing integration test for Linux
if: matrix.os == 'ubuntu-20.04'
run: mvn install -DskipTests -P dependencies-for-integration-tests,start-unix-native-image-for-integration-tests,run-postman-integration-tests -Dos.platform=linux
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Performing integration test for Windows
if: matrix.os == 'windows-latest'
run: mvn install -DskipTests -P dependencies-for-integration-tests,start-windows-native-image-for-integration-tests,run-postman-integration-tests -D os.platform=win
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload binary (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: aspect-model-editor-vDEV-SNAPSHOT-win
path: |
aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-win.exe
aspect-model-editor-runtime/target/*.dll
aspect-model-editor-runtime/target/*.bat
aspect-model-editor-runtime/target/lib/
- name: Upload binary (Linux)
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v4
with:
name: ame-backend-${{ matrix.os }}
path: |
aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-linux
aspect-model-editor-runtime/target/*.so
- name: Upload binary (Mac)
if: matrix.os == 'macos-12'
uses: actions/upload-artifact@v4
with:
name: aspect-model-editor-vDEV-SNAPSHOT-mac
path: aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-mac
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v3
# Sign (Windows & Mac) executable
- name: Get Artifact ID (Windows & Mac)
shell: bash
run: |
# Get the list of artifacts for the specified workflow run
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")
# Filter out the ID of the artifacts
artifact_id_win=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("win")) | .id')
artifact_id_mac=$(echo "$response" | jq -r '.artifacts[] | select(.name | contains("mac")) | .id')
# Save the artifact ID in an environment variable
echo "ARTIFACT_ID_WIN=$artifact_id_win" >> $GITHUB_ENV
echo "ARTIFACT_ID_MAC=$artifact_id_mac" >> $GITHUB_ENV
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit Artifact url and version changes and push to pre release branch for jenkins (Windows & Mac)
shell: bash
run: |
ARTIFACT_URL_WIN="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/actions/artifacts/$ARTIFACT_ID_WIN/zip"
ARTIFACT_URL_MAC="https://api.github.com/repos/eclipse-esmf/esmf-aspect-model-editor-backend/actions/artifacts/$ARTIFACT_ID_MAC/zip"
BRANCH_NAME="pre_release_configuration"
echo "artifact_url_win=$ARTIFACT_URL_WIN" > parameters.txt
echo "artifact_url_mac=$ARTIFACT_URL_MAC" >> parameters.txt
echo "version=DEV-SNAPSHOT" >> parameters.txt
git config --global user.email "[email protected]"
git config --global user.name "github-actions"
git checkout -b $BRANCH_NAME
git add parameters.txt
git commit -m "Add parameters.txt with artifact_url_win, artifact_url_mac and version"
git push origin $BRANCH_NAME
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger Jenkins Job, for signing executable
shell: bash
run: |
DATA='{"repository": {"url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend", "html_url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend", "owner": { "name": "ESMF"}}, "pusher": { "name": "GitHub Action", "email": "[email protected]"}}'
SHA1="$(echo -n "${DATA}" | openssl dgst -sha1 -hmac "${WEBHOOK_SECRET}" | sed 's/SHA1(stdin)= //')"
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}"