-
Notifications
You must be signed in to change notification settings - Fork 19
213 lines (203 loc) · 9 KB
/
application-build.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: Build jars
on:
workflow_dispatch:
push:
tags:
- "extender-v[0-9]+.[0-9]+.[0-9]+"
- "client-v[0-9]+.[0-9]+.[0-9]+"
- "manifestmergetool-v[0-9]+.[0-9]+.[0-9]+"
env:
GOOGLE_ARTIFACT_REGISTRY: europe-west1-docker.pkg.dev
MAVEN_SERVICE_ACCOUNT: [email protected]
jobs:
client:
if: ${{ startsWith(github.ref_name, 'client-') }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Generate version
id: version
run: |
SHORT_SHA="$(echo ${GITHUB_SHA} | cut -c1-8)"
TAG_NAME=${{ github.ref_name }}
TAG_VERSION="${TAG_NAME#*-v}"
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
- name: Login to Google Artifact registry (Maven)
uses: google-github-actions/auth@71fee32a0bb7e97b4d33d548e7d957010649d8fa
with:
service_account: ${{ env.MAVEN_SERVICE_ACCOUNT }}
credentials_json: ${{ secrets.MAVEN_REGISTRY_JSON_KEY }}
export_environment_variables: true
create_credentials_file: true
- name: Install Java
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@31ae3562f68c96d481c31bc1a8a55cc1be162f83
- name: Build the extender-client.jar
run: ./gradlew -PclientVersion=${{ steps.version.outputs.tag_version }} client:jar
- name: Test the extender-client.jar
run: ./gradlew -PclientVersion=${{ steps.version.outputs.tag_version }} client:test
- name: Publish to Google artifact registry
run: ./gradlew -PclientVersion=${{ steps.version.outputs.tag_version }} publishExtenderClientPublicationToExtenderRepoRepository
- name: Prepare jar for GH release
run: |
mkdir -p ${{ github.workspace }}/gh_release
cp ${{ github.workspace }}/client/build/libs/extender-client-${{ steps.version.outputs.tag_version }}.jar \
${{ github.workspace }}/gh_release/extender-client-${{ steps.version.outputs.tag_version }}.jar
- name: Publish to Github release
run: |
chmod 0444 ${{ github.workspace }}/gh_release/*.jar
echo ${{ github.token }} | gh auth login --with-token
gh release create "${GITHUB_REF_NAME}" \
--draft \
--generate-notes \
--target ${{ github.sha }} \
${{ github.workspace }}/gh_release/*.jar
- name: Notify if tests failed
uses: homoluctus/slatify@cd4b4a1158cfb3e26fe1ee35c1cd4f0247dfbf96
if: failure()
with:
type: ${{ job.status }}
job_name: 'Extender cleint release'
channel: '#defold-alarms-build'
url: ${{ secrets.SLACK_WEBHOOK }}
manifestmerger:
if: ${{ startsWith(github.ref_name, 'manifestmergetool-') }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Generate version
id: version
run: |
SHORT_SHA="$(echo ${GITHUB_SHA} | cut -c1-8)"
TAG_NAME=${{ github.ref_name }}
TAG_VERSION="${TAG_NAME#*-v}"
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
- name: Login to Google Artifact registry (Maven)
uses: google-github-actions/auth@71fee32a0bb7e97b4d33d548e7d957010649d8fa
with:
service_account: ${{ env.MAVEN_SERVICE_ACCOUNT }}
credentials_json: ${{ secrets.MAVEN_REGISTRY_JSON_KEY }}
export_environment_variables: true
create_credentials_file: true
- name: Install Java
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@31ae3562f68c96d481c31bc1a8a55cc1be162f83
- name: Build manifestmerger
run: ./gradlew -PmanifestMergetoolVersion=${{ steps.version.outputs.tag_version }} :manifestmergetool:mainJar
- name: Test manifestmerger
run: ./gradlew -PmanifestMergetoolVersion=${{ steps.version.outputs.tag_version }} :manifestmergetool:test
- name: Publish to Google artifact registry
run: ./gradlew -PmanifestMergetoolVersion=${{ steps.version.outputs.tag_version }} publishManifestMergeToolPublicationToExtenderRepoRepository
- name: Prepare jar for GH release
run: |
mkdir -p ${{ github.workspace }}/gh_release
cp ${{ github.workspace }}/server/manifestmergetool/build/libs/manifestmergetool-${{ steps.version.outputs.tag_version }}.jar \
${{ github.workspace }}/gh_release/manifestmergetool-${{ steps.version.outputs.tag_version }}.jar
- name: Publish to Github release
run: |
chmod 0444 ${{ github.workspace }}/gh_release/*.jar
echo ${{ github.token }} | gh auth login --with-token
gh release create "${GITHUB_REF_NAME}" \
--draft \
--generate-notes \
--target ${{ github.sha }} \
${{ github.workspace }}/gh_release/*.jar
- name: Notify if tests failed
uses: homoluctus/slatify@cd4b4a1158cfb3e26fe1ee35c1cd4f0247dfbf96
if: failure()
with:
type: ${{ job.status }}
job_name: 'Manifest merge tool release'
channel: '#defold-alarms-build'
url: ${{ secrets.SLACK_WEBHOOK }}
extender:
if: ${{ startsWith(github.ref_name, 'extender-') }}
runs-on: ubuntu-latest
steps:
# cleanup disk space because we use lots of disk space for Docker image during extender tests
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Generate version
id: version
run: |
SHORT_SHA="$(echo ${GITHUB_SHA} | cut -c1-8)"
TAG_NAME=${{ github.ref_name }}
TAG_VERSION="${TAG_NAME#*-v}"
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
- name: Install Java
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@31ae3562f68c96d481c31bc1a8a55cc1be162f83
- name: Build extender
run: ./gradlew -PextenderVersion=${{ steps.version.outputs.tag_version }} server:bootJar
- name: Login to Google Artifact registry (Docker)
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
registry: ${{ env.GOOGLE_ARTIFACT_REGISTRY }}
username: _json_key
password: ${{ secrets.DOCKER_REGISTRY_JSON_KEY }}
- name: Pull necessary docker images
run: |
# pull all containers under profile 'test'. Part of them is used in 'auth-test'
# if you need some new container under other profiles - need to add new statement with different profile
docker compose --file ./server/docker/docker-compose.yml --profile test pull
- name: Run extender tests
run: ./gradlew -PextenderVersion=${{ steps.version.outputs.tag_version }} server:test -i
- name: Login to Google Artifact registry (Maven)
uses: google-github-actions/auth@71fee32a0bb7e97b4d33d548e7d957010649d8fa
with:
service_account: ${{ env.MAVEN_SERVICE_ACCOUNT }}
credentials_json: ${{ secrets.MAVEN_REGISTRY_JSON_KEY }}
export_environment_variables: true
create_credentials_file: true
- name: Publish to Google artifact registry
run: ./gradlew -PextenderVersion=${{ steps.version.outputs.tag_version }} publishExtenderPublicationToExtenderRepoRepository
- name: Prepare jar for GH release
run: |
mkdir -p ${{ github.workspace }}/gh_release
cp ${{ github.workspace }}/server/build/libs/extender-${{ steps.version.outputs.tag_version }}.jar \
${{ github.workspace }}/gh_release/extender-${{ steps.version.outputs.tag_version }}.jar
- name: Publish to Github release
run: |
chmod 0444 ${{ github.workspace }}/gh_release/*.jar
echo ${{ github.token }} | gh auth login --with-token
gh release create "${GITHUB_REF_NAME}" \
--draft \
--generate-notes \
--target ${{ github.sha }} \
${{ github.workspace }}/gh_release/*.jar
- name: Notify if tests failed
uses: homoluctus/slatify@cd4b4a1158cfb3e26fe1ee35c1cd4f0247dfbf96
if: failure()
with:
type: ${{ job.status }}
job_name: 'Extender release'
channel: '#defold-alarms-build'
url: ${{ secrets.SLACK_WEBHOOK }}