18
18
binutilsVer : 2.35.1
19
19
# Demumble 1.1.0 released Nov 13, 2018
20
20
demumbleVer : 1.1.0
21
+ # Use SHA256 for hashing files.
22
+ hashCommand : sha256sum
21
23
22
24
jobs :
25
+ log_inputs :
26
+ name : log-inputs
27
+ runs-on : ubuntu-latest
28
+ steps :
29
+ - name : log run inputs
30
+ run : |
31
+ if [[ -n "${{ github.event.inputs.downloadPublicVersion }}" ]]; then
32
+ echo "::warning ::Downloading public SDK package from https://dl.google.com/firebase/sdk/cpp/firebase_cpp_sdk_${{ github.event.inputs.downloadPublicVersion }}.zip"
33
+ elif [[ -n "${{ github.event.inputs.downloadPreviousRun }}" ]]; then
34
+ echo "::warning ::Downloading SDK package from previous run at https://github.com/firebase/firebase-cpp-sdk/actions/runs/${{ github.event.inputs.downloadPreviousRun }}"
35
+ fi
36
+ if [[ -n "${{ github.event.inputs.commitIdToPackage }}" ]]; then
37
+ if [[ -n "${{ github.event.inputs.downloadPublicVersion }}" || -n "${{ github.event.inputs.downloadPreviousRun }}" ]]; then
38
+ echo "::warning ::Using commit ID '${{ github.event.inputs.commitIdToPackage }}' for building tests."
39
+ else
40
+ echo "::warning ::Using commit ID '${{ github.event.inputs.commitIdToPackage }}' for building and packaging SDK and tests."
41
+ fi
42
+ fi
43
+ if [[ "${{ github.event.inputs.preserveIntermediateArtifacts }}" != "0" ]]; then
44
+ echo "::warning ::Intermediate artifacts will be preserved."
45
+ fi
46
+
23
47
build_tools :
24
48
name : build-tools-${{ matrix.tools_platform }}
25
49
runs-on : ${{ matrix.os }}
@@ -54,12 +78,14 @@ jobs:
54
78
cd -
55
79
mkdir -p packaging-tools
56
80
cp -af /tmp/binutils/bin/* packaging-tools
81
+
57
82
- name : fetch demumble
58
83
59
84
with :
60
85
repository : nico/demumble
61
86
path : demumble-src
62
87
ref : v${{ env.demumbleVer }}
88
+
63
89
- name : build demumble
64
90
run : |
65
91
cd demumble-src
@@ -69,11 +95,13 @@ jobs:
69
95
cd -
70
96
mkdir -p packaging-tools-
71
97
cp -af demumble-src/demumble packaging-tools
98
+
72
99
- name : archive tools
73
100
run : |
74
101
cd packaging-tools
75
102
ls
76
103
tar -czhf ../packaging-tools.tgz .
104
+
77
105
- name : upload artifacts
78
106
uses : actions/upload-artifact@v2
79
107
with :
@@ -90,14 +118,17 @@ jobs:
90
118
with :
91
119
path : sdk-src
92
120
ref : ${{ github.event.inputs.commitIdToPackage }}
121
+
93
122
- name : install prerequisites
94
123
run : sdk-src/build_scripts/ios/install_prereqs.sh
124
+
95
125
- name : build sdk
96
126
run : |
97
127
sdk-src/build_scripts/ios/build.sh -b firebase-cpp-sdk-ios-build -s sdk-src
98
128
sdk-src/build_scripts/ios/package.sh firebase-cpp-sdk-ios-build firebase-cpp-sdk-ios-package
99
129
cd firebase-cpp-sdk-ios-package
100
130
tar -czhf ../firebase-cpp-sdk-ios-package.tgz .
131
+
101
132
- name : Print built libraries
102
133
shell : bash
103
134
run : |
@@ -107,10 +138,12 @@ jobs:
107
138
find firebase-cpp-sdk-*-build -name "*.a"
108
139
find firebase-cpp-sdk-*-build -name "*.so"
109
140
find firebase-cpp-sdk-*-build -name "*.framework"
141
+
110
142
- name : Print package contents
111
143
shell : bash
112
144
run : |
113
145
find firebase-cpp-sdk-*-package -type f
146
+
114
147
- name : upload artifacts
115
148
uses : actions/upload-artifact@v2
116
149
with :
@@ -131,14 +164,17 @@ jobs:
131
164
with :
132
165
path : sdk-src
133
166
ref : ${{ github.event.inputs.commitIdToPackage }}
167
+
134
168
- name : install prerequisites
135
169
run : sdk-src/build_scripts/android/install_prereqs.sh
170
+
136
171
- name : build sdk
137
172
run : |
138
173
sdk-src/build_scripts/android/build.sh firebase-cpp-sdk-android-${{ matrix.stl }}-build sdk-src ${{ matrix.stl }}
139
174
sdk-src/build_scripts/android/package.sh firebase-cpp-sdk-android-${{ matrix.stl }}-build firebase-cpp-sdk-android-${{ matrix.stl }}-package ${{ matrix.stl }}
140
175
cd firebase-cpp-sdk-android-${{ matrix.stl }}-package
141
176
tar -czhf ../firebase-cpp-sdk-android-${{ matrix.stl}}-package.tgz .
177
+
142
178
- name : Print built libraries
143
179
shell : bash
144
180
run : |
@@ -148,10 +184,12 @@ jobs:
148
184
find firebase-cpp-sdk-*-build -name "*.a"
149
185
find firebase-cpp-sdk-*-build -name "*.so"
150
186
find firebase-cpp-sdk-*-build -name "*.framework"
187
+
151
188
- name : Print package contents
152
189
shell : bash
153
190
run : |
154
191
find firebase-cpp-sdk-*-package -type f
192
+
155
193
- name : upload artifacts
156
194
uses : actions/upload-artifact@v2
157
195
with :
@@ -327,21 +365,25 @@ jobs:
327
365
with :
328
366
path : sdk-src
329
367
ref : ${{ github.event.inputs.commitIdToPackage }}
368
+
330
369
- name : download artifact
331
370
uses : actions/download-artifact@v2
332
371
with :
333
372
# download-artifact doesn't support wildcards, but by default
334
373
# will download all artifacts. Sadly this is what we must do.
335
374
path : artifacts
375
+
336
376
- name : Setup python
337
377
uses : actions/setup-python@v2
338
378
with :
339
379
python-version : 3.7
380
+
340
381
- name : Install prerequisites
341
382
run : |
342
383
cd sdk-src
343
384
python scripts/gha/install_prereqs_desktop.py
344
385
cd ..
386
+
345
387
- name : postprocess and package built SDK
346
388
run : |
347
389
mkdir -p bin
@@ -365,11 +407,13 @@ jobs:
365
407
fi
366
408
cd firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}-package
367
409
tar -czhf ../firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix }}-package.tgz .
410
+
368
411
- name : Print package contents
369
412
shell : bash
370
413
run : |
371
414
find firebase-cpp-sdk-*-package -type f
372
- - name : upload artifacts
415
+
416
+ - name : upload SDK zip
373
417
uses : actions/upload-artifact@v2
374
418
with :
375
419
name : firebase-cpp-sdk-${{ matrix.sdk_platform }}${{ matrix.suffix}}-package
@@ -378,14 +422,14 @@ jobs:
378
422
download_sdk_package :
379
423
name : download-sdk-package
380
424
runs-on : ubuntu-latest
425
+ needs : [log_inputs]
381
426
if : ${{ github.event.inputs.downloadPublicVersion != '' || github.event.inputs.downloadPreviousRun != '' }}
382
427
steps :
383
428
- name : fetch artifact from previous run
384
429
uses : dawidd6/action-download-artifact@v2
385
430
if : ${{ github.event.inputs.downloadPreviousRun != '' }}
386
431
with :
387
- name : ' firebase_cpp_sdk'
388
- path : ' firebase-cpp-sdk-final'
432
+ name : ' firebase_cpp_sdk.zip'
389
433
workflow : ' cpp-packaging.yml'
390
434
run_id : ${{ github.event.inputs.downloadPreviousRun }}
391
435
@@ -396,7 +440,6 @@ jobs:
396
440
echo Invalid version number: "${{ github.event.inputs.downloadPublicVersion }}"
397
441
exit 1
398
442
fi
399
- mkdir firebase-cpp-sdk-final
400
443
set +e
401
444
# Retry up to 10 times because Curl has a tendency to timeout on
402
445
# Github runners.
@@ -406,19 +449,30 @@ jobs:
406
449
sleep 300
407
450
done
408
451
set -e
409
- cd firebase-cpp-sdk-final
410
- unzip ../firebase_cpp_sdk.zip
411
- - name : upload artifacts
452
+
453
+ - name : compute SDK hash
454
+ shell : bash
455
+ run : |
456
+ ${{ env.hashCommand }} --tag firebase_cpp_sdk.zip > firebase_cpp_sdk_hash.txt
457
+ echo "::warning ::$(cat firebase_cpp_sdk_hash.txt)"
458
+
459
+ - name : upload hash
460
+ uses : actions/upload-artifact@v2
461
+ with :
462
+ name : firebase_cpp_sdk_hash.txt
463
+ path : firebase_cpp_sdk_hash.txt
464
+
465
+ - name : upload SDK zip
412
466
uses : actions/upload-artifact@v2
413
467
with :
414
- name : firebase_cpp_sdk
415
- path : firebase-cpp-sdk-final
468
+ name : firebase_cpp_sdk.zip
469
+ path : firebase_cpp_sdk.zip
416
470
417
471
merge_packages :
418
472
name : final-merge-packages
419
473
runs-on : ubuntu-latest
420
474
if : ${{ github.event.inputs.downloadPublicVersion == '' && github.event.inputs.downloadPreviousRun == '' }}
421
- needs : [build_and_package_ios, build_and_package_android, package_desktop]
475
+ needs : [build_and_package_ios, build_and_package_android, package_desktop, log_inputs ]
422
476
steps :
423
477
- name : fetch SDK
424
478
@@ -434,6 +488,7 @@ jobs:
434
488
path : artifacts
435
489
436
490
- name : merge SDK packages
491
+ shell : bash
437
492
run : |
438
493
set -ex
439
494
mkdir -p firebase-cpp-sdk-final/firebase_cpp_sdk
@@ -442,16 +497,39 @@ jobs:
442
497
done
443
498
# Add the final files.
444
499
sdk-src/build_scripts/other/package.sh sdk-src firebase-cpp-sdk-final/firebase_cpp_sdk
500
+
501
+ # Zip up the package and grab a hash of the result.
502
+ cd firebase-cpp-sdk-final
503
+ # Save the hash of every file into the SDK package.
504
+ find firebase_cpp_sdk -type f -print0 | xargs -0 ${{ env.hashCommand }} --tag > file_hashes.txt
505
+ mv file_hashes.txt firebase_cpp_sdk/
506
+ # Zip up the SDK package recursively, preserving symlinks.
507
+ zip -9 -r -y ../firebase_cpp_sdk.zip firebase_cpp_sdk
508
+ cd ..
509
+
510
+ - name : compute SDK hash
511
+ shell : bash
512
+ run : |
513
+ ${{ env.hashCommand }} --tag firebase_cpp_sdk.zip > firebase_cpp_sdk_hash.txt
514
+ echo "::warning ::$(cat firebase_cpp_sdk_hash.txt)"
515
+
445
516
- name : Print final package contents
446
517
shell : bash
447
518
run : |
448
519
cd firebase-cpp-sdk-final
449
- find * -type f
450
- - name : upload artifacts
520
+ find firebase_cpp_sdk -type f
521
+
522
+ - name : upload hash
523
+ uses : actions/upload-artifact@v2
524
+ with :
525
+ name : firebase_cpp_sdk_hash.txt
526
+ path : firebase_cpp_sdk_hash.txt
527
+
528
+ - name : upload SDK zip
451
529
uses : actions/upload-artifact@v2
452
530
with :
453
- name : firebase_cpp_sdk
454
- path : firebase-cpp-sdk-final
531
+ name : firebase_cpp_sdk.zip
532
+ path : firebase_cpp_sdk.zip
455
533
456
534
cleanup_artifacts :
457
535
# Clean up intermediate artifacts.
@@ -498,14 +576,33 @@ jobs:
498
576
if : always()
499
577
runs-on : ubuntu-latest
500
578
steps :
501
- - name : download artifact
579
+ - name : download SDK zip
502
580
uses : actions/download-artifact@v2
503
581
with :
504
- name : firebase_cpp_sdk
582
+ name : firebase_cpp_sdk.zip
505
583
path : .
584
+
585
+ - name : download hash
586
+ uses : actions/download-artifact@v2
587
+ with :
588
+ name : firebase_cpp_sdk_hash.txt
589
+ path : .
590
+
506
591
- name : List binary SDK files.
507
592
run : |
593
+ # Verify zipfile hash first.
594
+ ${{ env.hashCommand }} -c --quiet firebase_cpp_sdk_hash.txt
595
+ unzip -q firebase_cpp_sdk.zip
508
596
find . -print
597
+
598
+ - name : Verify SDK package files.
599
+ run : |
600
+ if [[ -r firebase_cpp_sdk/file_hashes.txt ]]; then
601
+ ${{ env.hashCommand }} -c --quiet firebase_cpp_sdk/file_hashes.txt
602
+ else
603
+ echo "::warning ::SDK package does not contain file_hashes.txt, cannot verify files in package."
604
+ fi
605
+
509
606
- name : fetch integration test source
510
607
511
608
with :
0 commit comments