Skip to content

Commit afb2918

Browse files
committed
Harmonize timestamps in artifactbundle with the swift source tag date for build reproducibility
1 parent 46a06df commit afb2918

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

.github/workflows/pull_request.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
build-type: ['docker']
31-
#build-type: ['docker', 'local']
30+
#build-type: ['docker']
31+
build-type: ['docker', 'local']
3232
# blank arch builds all (aarch64,x86_64,armv7)
33-
arch: ['']
33+
#arch: ['']
3434
# builds only x86_64 to speed up the validation
3535
#arch: ['x86_64']
3636
# build both the quick (x86_64) and complete (aarch64,x86_64,armv7) SDKs
37-
#arch: ['x86_64', '']
37+
arch: ['x86_64', '']
3838
swift-version: ['release', 'swift-6.2-branch', 'development']
3939
runs-on: ubuntu-24.04
4040
steps:

swift-ci/sdks/android/scripts/build.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ function versionFromTag {
186186
}
187187

188188
swift_version=$(describe ${source_dir}/swift-project/swift)
189+
swift_tag_date=$(git -C ${source_dir}/swift-project/swift log -1 --format=%ct 2>/dev/null)
190+
189191
if [[ $swift_version == swift-* ]]; then
190192
swift_version=${swift_version#swift-}
191193
fi
@@ -631,8 +633,13 @@ header "Outputting compressed bundle"
631633

632634
quiet_pushd "${build_dir}"
633635
mkdir -p "${products_dir}"
634-
tar czf "${bundle}.tar.gz" "${bundle}"
635-
mv "${bundle}.tar.gz" "${products_dir}"
636+
# set the timestamps of every file in the artifact to the tag date for the swift repo for build reproducibility
637+
touch_date=$(date -d "@$swift_tag_date" "+%Y%m%d%H%M.%S")
638+
find "${bundle}" -exec touch -t "$touch_date" {} +
639+
640+
bundle_archive="${products_dir}/${bundle}.tar.gz"
641+
tar czf "${bundle_archive}" "${bundle}"
642+
shasum -a 256 "${bundle_archive}"
636643
quiet_popd
637644

638645
groupend

0 commit comments

Comments
 (0)