attempt to use reproducible timestamps

This sets SOURCE_DATE_EPOCH to the commit timestamp, toolchains
should pick up timestamps from this variable.
The same sources ideally would produce the same binary, see
https://reproducible-builds.org.

Set the timestamps within the tar archives to the start of the
CI pipeline.

Sort the archive contents.
This commit is contained in:
Norbert Lange authored and Martin Storsjö committed 2024-02-13 10:13:54 +02:00
1 parent 45ad09642f
commit 8caf3767a4
2 files changed
+32 -6

No files matched your search

+26 -5
View File
@@ -26,7 +26,13 @@ jobs:
MINGW_W64_VERSION: ${{steps.get-versions.outputs.MINGW_W64_VERSION}} MINGW_W64_VERSION: ${{steps.get-versions.outputs.MINGW_W64_VERSION}}
PYTHON_VERSION_MINGW: ${{steps.get-versions.outputs.PYTHON_VERSION_MINGW}} PYTHON_VERSION_MINGW: ${{steps.get-versions.outputs.PYTHON_VERSION_MINGW}}
TAG: ${{steps.get-tag.outputs.TAG}} TAG: ${{steps.get-tag.outputs.TAG}}
COMMIT_DATE_UNIX: ${{steps.get-tag.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{steps.get-tag.outputs.BUILD_DATE}}
BUILD_DATE_UNIX: ${{steps.get-tag.outputs.BUILD_DATE_UNIX}}
steps: steps:
- uses: actions/checkout@v4
with:
sparse-checkout: .
- name: Select build tag - name: Select build tag
id: get-tag id: get-tag
run: | run: |
@@ -36,6 +42,9 @@ jobs:
TAG=$(TZ=UTC date +%Y%m%d) TAG=$(TZ=UTC date +%Y%m%d)
fi fi
echo TAG=$TAG >> $GITHUB_OUTPUT echo TAG=$TAG >> $GITHUB_OUTPUT
echo COMMIT_DATE_UNIX=$(git log -1 --pretty=%ct $GITHUB_SHA) >> $GITHUB_OUTPUT
echo BUILD_DATE=$(date -u '+%FT%TZ') >> $GITHUB_OUTPUT
echo BUILD_DATE_UNIX=$(date -d "${BUILD_DATE}" +%s) >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT cat $GITHUB_OUTPUT
cat $GITHUB_OUTPUT >> parameters.txt cat $GITHUB_OUTPUT >> parameters.txt
- name: Check latest version - name: Check latest version
@@ -66,6 +75,8 @@ jobs:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}} MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}} TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: | run: |
sudo apt-get update && sudo apt-get install ninja-build sudo apt-get update && sudo apt-get install ninja-build
# Skip dynamic library dependencies that might make it harder to # Skip dynamic library dependencies that might make it harder to
@@ -77,7 +88,7 @@ jobs:
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m) DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
NAME=llvm-mingw-$TAG-ucrt-$DISTRO NAME=llvm-mingw-$TAG-ucrt-$DISTRO
mv llvm-mingw $NAME mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: linux-ucrt-x86_64-toolchain name: linux-ucrt-x86_64-toolchain
@@ -97,6 +108,7 @@ jobs:
env: env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}} MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
run: | run: |
sudo apt-get update && sudo apt-get install ninja-build g++-aarch64-linux-gnu sudo apt-get update && sudo apt-get install ninja-build g++-aarch64-linux-gnu
./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --no-runtimes --host=aarch64-linux-gnu ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --no-runtimes --host=aarch64-linux-gnu
@@ -119,12 +131,13 @@ jobs:
- name: Package the toolchain - name: Package the toolchain
env: env:
TAG: ${{needs.prepare.outputs.TAG}} TAG: ${{needs.prepare.outputs.TAG}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: | run: |
cd install cd install
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-aarch64 DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-aarch64
NAME=llvm-mingw-$TAG-ucrt-$DISTRO NAME=llvm-mingw-$TAG-ucrt-$DISTRO
mv llvm-mingw $NAME mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: linux-ucrt-aarch64-toolchain name: linux-ucrt-aarch64-toolchain
@@ -149,6 +162,8 @@ jobs:
env: env:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}} MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: | run: |
sudo apt-get update && sudo apt-get install ninja-build sudo apt-get update && sudo apt-get install ninja-build
# Skip dynamic library dependencies that might make it harder to # Skip dynamic library dependencies that might make it harder to
@@ -157,7 +172,7 @@ jobs:
LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_TERMINFO=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb --enable-asserts LLVM_CMAKEFLAGS="-DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_TERMINFO=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb --enable-asserts
.github/workflows/store-version.sh install/llvm-mingw/versions.txt .github/workflows/store-version.sh install/llvm-mingw/versions.txt
cd install cd install
tar -Jcf ../llvm-mingw-linux.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 llvm-mingw tar -Jcf ../llvm-mingw-linux.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" llvm-mingw
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: linux-asserts-toolchain name: linux-asserts-toolchain
@@ -177,6 +192,8 @@ jobs:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}} MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}} TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: | run: |
brew install ninja gnu-tar brew install ninja gnu-tar
# Disable zstd and python. Both are available on the runners, but # Disable zstd and python. Both are available on the runners, but
@@ -189,7 +206,7 @@ jobs:
cd install cd install
NAME=llvm-mingw-$TAG-ucrt-macos-universal NAME=llvm-mingw-$TAG-ucrt-macos-universal
mv llvm-mingw $NAME mv llvm-mingw $NAME
gtar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME gtar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: macos-ucrt-toolchain name: macos-ucrt-toolchain
@@ -233,6 +250,8 @@ jobs:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}} MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}} TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: | run: |
./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb
.github/workflows/store-version.sh install/llvm-mingw/versions.txt .github/workflows/store-version.sh install/llvm-mingw/versions.txt
@@ -241,7 +260,7 @@ jobs:
cd install cd install
NAME=llvm-mingw-$TAG-ucrt-msys2-${{matrix.sys}} NAME=llvm-mingw-$TAG-ucrt-msys2-${{matrix.sys}}
mv llvm-mingw $NAME mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: msys2-${{matrix.sys}}-toolchain name: msys2-${{matrix.sys}}-toolchain
@@ -281,6 +300,8 @@ jobs:
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}} MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
PYTHON_VERSION_MINGW: ${{needs.prepare.outputs.PYTHON_VERSION_MINGW}} PYTHON_VERSION_MINGW: ${{needs.prepare.outputs.PYTHON_VERSION_MINGW}}
TAG: ${{needs.prepare.outputs.TAG}} TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: | run: |
sudo apt-get update && sudo apt-get install autoconf-archive ninja-build sudo apt-get update && sudo apt-get install autoconf-archive ninja-build
./build-cross-tools.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw ${{matrix.arch}} --with-python ./build-cross-tools.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw ${{matrix.arch}} --with-python
+6 -1
View File
@@ -24,6 +24,9 @@ jobs:
MINGW_W64_VERSION: ${{steps.get-parameters.outputs.MINGW_W64_VERSION}} MINGW_W64_VERSION: ${{steps.get-parameters.outputs.MINGW_W64_VERSION}}
PYTHON_VERSION_MINGW: ${{steps.get-parameters.outputs.PYTHON_VERSION_MINGW}} PYTHON_VERSION_MINGW: ${{steps.get-parameters.outputs.PYTHON_VERSION_MINGW}}
TAG: ${{steps.get-parameters.outputs.TAG}} TAG: ${{steps.get-parameters.outputs.TAG}}
COMMIT_DATE_UNIX: ${{steps.get-parameters.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{steps.get-parameters.outputs.BUILD_DATE}}
BUILD_DATE_UNIX: ${{steps.get-parameters.outputs.BUILD_DATE_UNIX}}
steps: steps:
- name: Download build parameters - name: Download build parameters
uses: dawidd6/action-download-artifact@v3 uses: dawidd6/action-download-artifact@v3
@@ -68,6 +71,8 @@ jobs:
LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}} LLVM_VERSION: ${{needs.prepare.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}} MINGW_W64_VERSION: ${{needs.prepare.outputs.MINGW_W64_VERSION}}
TAG: ${{needs.prepare.outputs.TAG}} TAG: ${{needs.prepare.outputs.TAG}}
SOURCE_DATE_EPOCH: ${{needs.prepare.outputs.COMMIT_DATE_UNIX}}
BUILD_DATE: ${{needs.prepare.outputs.BUILD_DATE}}
run: | run: |
sudo apt-get update && sudo apt-get install ninja-build sudo apt-get update && sudo apt-get install ninja-build
./build-all.sh $(pwd)/install/llvm-mingw --no-tools --wipe-runtimes --with-default-msvcrt=msvcrt ./build-all.sh $(pwd)/install/llvm-mingw --no-tools --wipe-runtimes --with-default-msvcrt=msvcrt
@@ -76,7 +81,7 @@ jobs:
DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m) DISTRO=ubuntu-$(grep DISTRIB_RELEASE /etc/lsb-release | cut -f 2 -d =)-$(uname -m)
NAME=llvm-mingw-$TAG-msvcrt-$DISTRO NAME=llvm-mingw-$TAG-msvcrt-$DISTRO
mv llvm-mingw $NAME mv llvm-mingw $NAME
tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 $NAME tar -Jcf ../$NAME.tar.xz --format=ustar --numeric-owner --owner=0 --group=0 --sort=name --mtime="$BUILD_DATE" $NAME
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: linux-msvcrt-x86_64-toolchain name: linux-msvcrt-x86_64-toolchain