From 4213c6a1fe1b5a1b3c9675b03b8297935395913c Mon Sep 17 00:00:00 2001 From: Se7enZ Date: Sat, 7 Sep 2024 15:36:27 +0200 Subject: [PATCH] build: Repro build matrix strategy or focal, jammy and noble. --- .github/workflows/repro.yml | 41 +++++++++++++++++++---------- contrib/reprobuild/Dockerfile.focal | 1 + 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/.github/workflows/repro.yml b/.github/workflows/repro.yml index 6d84fd31966a..230982d4756c 100644 --- a/.github/workflows/repro.yml +++ b/.github/workflows/repro.yml @@ -5,38 +5,51 @@ on: # 05:00 Berlin, 03:00 UTC, 23:00 New York, 20:00 Los Angeles schedule: - cron: "0 3 * * *" + # TODO: remove after testing + push: + branches: + - 7117-repro-nightly-builds jobs: - ubuntu-noble: - name: Ubuntu Noble Repro build + ubuntu: + name: "Ubuntu repro build: ${{ matrix.version }}" runs-on: ubuntu-22.04 + strategy: + matrix: + #version: ['focal', 'jammy', 'noble'] + version: ['focal'] steps: - name: Git checkout uses: actions/checkout@v2 - name: Build environment setup run: | - echo "Building base image for noble" - docker run --rm -v $(pwd):/build ubuntu:noble bash -c "apt-get update && apt-get install -y debootstrap && debootstrap noble /build/noble" - tar -C noble -c . | docker import - noble + echo "Building base image for ${{ matrix.version }}" + sudo docker run --rm -v $(pwd):/build ubuntu:${{ matrix.version }} bash -c "apt-get update && apt-get install -y debootstrap && debootstrap ${{ matrix.version }} /build/${{ matrix.version }}" + sudo tar -C ${{ matrix.version }} -c . | docker import - ${{ matrix.version }} - name: Builder image setup - run: docker build -t cl-repro-noble - < contrib/reprobuild/Dockerfile.noble + run: docker build -t cl-repro-${{ matrix.version }} - < contrib/reprobuild/Dockerfile.${{ matrix.version }} - - name: Create release directory - run: mkdir $GITHUB_WORKSPACE/release - - - name: Build using the builder image and store Git state. + - name: Build using the builder image and store Git state run: | + # Create release directory. + mkdir $GITHUB_WORKSPACE/release + # Perform the repro build. - docker run --name cl-build -v $GITHUB_WORKSPACE:/repo -e FORCE_MTIME=$(date +%F) -t cl-repro-noble + docker run --name cl-build -v $GITHUB_WORKSPACE:/repo -e FORCE_MTIME=$(date +%F) -t cl-repro-${{ matrix.version }} + echo "Build complete." # Commit the image and use it to inspect the Git tree state. docker commit cl-build cl-release - docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-release git status > release/git-status.txt - docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-release git diff > release/git-diff.txt + echo "Docker commit complete." + docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-release git --no-pager status > release/git-status.txt + echo "Docker git status complete." + docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-release git --no-pager diff > release/git-diff.txt + echo "Docker git diff complete." # Change permissions on the release files for access by build environment. - docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-repro-noble chmod -R 777 /repo/release + sudo chown -R runner $GITHUB_WORKSPACE/release + echo "Release chown complete." - name: Assert clean release run: | diff --git a/contrib/reprobuild/Dockerfile.focal b/contrib/reprobuild/Dockerfile.focal index ea0d85516a90..a45b9fa917fa 100644 --- a/contrib/reprobuild/Dockerfile.focal +++ b/contrib/reprobuild/Dockerfile.focal @@ -74,5 +74,6 @@ WORKDIR /build CMD git clone /repo . \ && poetry export -o requirements.txt --without-hashes \ && pip install -r requirements.txt \ + && echo "# test: make git tree dirty" >> Cargo.toml \ && tools/repro-build.sh \ && cp *.xz /repo/release/