-
Notifications
You must be signed in to change notification settings - Fork 5
254 lines (234 loc) · 8.05 KB
/
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
name: Build everything (and create a release)
on: push
env:
JAVA_VERSION: '21'
jobs:
build-windows:
runs-on: windows-latest
environment: dev
steps:
- name: 'Checkout GitHub action'
uses: actions/checkout@v4
- name: Setup Java Sdk ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v1
with:
java-version: ${{ env.JAVA_VERSION }}
- name: 'Create "dependencies" directory'
shell: pwsh
run: |
[IO.Directory]::CreateDirectory("dependencies")
- name: 'The ADS API is available as a secret. It is a base64-encoded .zip file.'
shell: pwsh
env:
ADS_API_ZIP_BASE64: ${{ secrets.ADS_API_ZIP_BASE64 }}
run: |
[IO.File]::WriteAllBytes("dependencies\AdsApi.zip", [Convert]::FromBase64String("$env:ADS_API_ZIP_BASE64"))
- name: 'Put the contents of the "AdsApi.zip" archive into the "dependencies" directory.'
shell: pwsh
run: |
Expand-Archive "dependencies\AdsApi.zip" -DestinationPath dependencies\
- name: 'Run the bootstrap batch script'
shell: cmd
run: |
CALL bootstrap.bat
- name: 'Compress documentation'
shell: pwsh
run: |
Compress-Archive -Path dist\doc\* -DestinationPath dist\documentation.zip
- name: 'Compress .jar files of the TcAdsDll samples'
shell: pwsh
run: |
Compress-Archive -Path dist\0*.jar, dist\1*.jar -DestinationPath dist\samples-tcadsdll.zip
- name: 'Compress win-x64 DLL file'
shell: pwsh
run: |
Compress-Archive -Path build_x64\Release\AdsToJava-3.dll -DestinationPath dist\win-x64.zip
- name: 'Compress win-x86 DLL file'
shell: pwsh
run: |
Compress-Archive -Path build_win32\Release\AdsToJava-3.dll -DestinationPath dist\win-x86.zip
- name: Upload .jar files of the TcAdsDll samples as artifact
uses: actions/upload-artifact@v4
with:
name: samples-tcadsdll
path: dist/samples-tcadsdll.zip
retention-days: 3
- name: Upload documentation archive as artifact
uses: actions/upload-artifact@v4
with:
name: documentation
path: dist/documentation.zip
retention-days: 3
- name: Upload win-x64 binaries as artifact
uses: actions/upload-artifact@v4
with:
name: win-x64
path: dist/win-x64.zip
retention-days: 3
- name: Upload win-x86 binaries as artifact
uses: actions/upload-artifact@v4
with:
name: win-x86
path: dist/win-x86.zip
retention-days: 3
- name: Upload the TcJavaToAds library as artifact
uses: actions/upload-artifact@v4
with:
name: tcjavatoads
path: dist/TcJavaToAds-3.1.0.jar
retention-days: 3
build-ubuntu:
runs-on: ubuntu-latest
environment: dev
steps:
- name: 'Checkout GitHub action'
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup Java Sdk ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Install other dependencies as ubuntu packages
run: sudo apt update -y && sudo apt install -y ninja-build
- name: 'Run the bootstrap bash script'
shell: bash
run: |
./bootstrap.sh
- name: 'Compress linux-x64 .so files'
shell: bash
run: |
zip --junk-paths ./dist/linux-x64.zip ./dist/*.so
- name: 'Compress .jar files of the adslib samples'
shell: bash
run: |
zip --junk-paths ./dist/samples-adslib.zip ./dist/*_adslib.jar
- name: Upload .jar files of the adslib samples as artifact
uses: actions/upload-artifact@v4
with:
name: samples-adslib
path: dist/samples-adslib.zip
retention-days: 3
- name: Upload linux-x64 binaries as artifact
uses: actions/upload-artifact@v4
with:
name: linux-x64
path: dist/linux-x64.zip
retention-days: 3
collect-and-release:
needs: [build-windows, build-ubuntu]
runs-on: ubuntu-latest
steps:
- name: Download artifact tcjavatoads
uses: actions/download-artifact@v4
with:
name: tcjavatoads
- name: Download artifact samples-tcadsdll
uses: actions/download-artifact@v4
with:
name: samples-tcadsdll
- name: Download artifact samples-adslib
uses: actions/download-artifact@v4
with:
name: samples-adslib
- name: Download artifact documentation
uses: actions/download-artifact@v4
with:
name: documentation
- name: Download artifact win-x64
uses: actions/download-artifact@v4
with:
name: win-x64
- name: Download artifact win-x86
uses: actions/download-artifact@v4
with:
name: win-x86
- name: Download artifact linux-x64
uses: actions/download-artifact@v4
with:
name: linux-x64
- name: 'List what is in the working directory'
shell: bash
run: |
ls -la
- name: Create release
if: github.ref == 'refs/heads/main'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 3.1.0-${{ github.run_number }}
release_name: 3.1.0-${{ github.run_number }}
generate_release_notes: true
- name: 'Upload release asset: TcJavaToAds-3.1.0.jar'
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./TcJavaToAds-3.1.0.jar
asset_name: TcJavaToAds-3.1.0.jar
asset_content_type: application/java-archive
- name: 'Upload release asset: documentation.zip'
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./documentation.zip
asset_name: documentation.zip
asset_content_type: application/zip
- name: 'Upload release asset: samples-tcadsdll.zip'
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./samples-tcadsdll.zip
asset_name: samples-tcadsdll.zip
asset_content_type: application/zip
- name: 'Upload release asset: samples-adslib.zip'
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./samples-adslib.zip
asset_name: samples-adslib.zip
asset_content_type: application/zip
- name: 'Upload release asset: win-x64.zip'
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./win-x64.zip
asset_name: win-x64.zip
asset_content_type: application/zip
- name: 'Upload release asset: win-x86.zip'
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./win-x86.zip
asset_name: win-x86.zip
asset_content_type: application/zip
- name: 'Upload release asset: linux-x64.zip'
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./linux-x64.zip
asset_name: linux-x64.zip
asset_content_type: application/zip