From 40d9092eb8816250290aa46562fdd635c805aa19 Mon Sep 17 00:00:00 2001 From: Se7enZ Date: Tue, 3 Sep 2024 13:27:46 +0200 Subject: [PATCH] build: Nightly repro build for Ubuntu Noble. --- .github/workflows/repro.yml | 76 +++++++++++++++++++++++++++++ contrib/reprobuild/Dockerfile.noble | 1 + 2 files changed, 77 insertions(+) create mode 100644 .github/workflows/repro.yml diff --git a/.github/workflows/repro.yml b/.github/workflows/repro.yml new file mode 100644 index 000000000000..6a22edb3227d --- /dev/null +++ b/.github/workflows/repro.yml @@ -0,0 +1,76 @@ +--- +# https://docs.corelightning.org/docs/repro +name: Repro Build Nightly +on: + # TODO: reinstate after testing + # schedule: + # - cron: "0 3 * * *" + # TODO: remove after testing + push: + branches: + - 7117-repro-nightly-builds +jobs: + ubuntu-noble: + name: Ubuntu Noble Repro build + runs-on: ubuntu-22.04 + 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 + + - name: Builder image setup + run: docker build -t cl-repro-noble - < contrib/reprobuild/Dockerfile.noble + + - name: Create release directory + run: mkdir $GITHUB_WORKSPACE/release + + - name: Build using the builder image + #run: docker run --rm -v $GITHUB_WORKSPACE:/repo -e FORCE_MTIME=$(date +%F) -t cl-repro-noble + run: | + # Perform the repro build. + docker run --name cl-build -v $GITHUB_WORKSPACE:/repo -e FORCE_MTIME=$(date +%F) -t cl-repro-noble + + # Commit the image and use it to inspect the state. + docker commit cl-build cl-release + docker run -v $GITHUB_WORKSPACE:/repo -t cl-release git status > release/git-status.txt + docker run -v $GITHUB_WORKSPACE:/repo -t cl-release git diff > release/git-diff.txt + + # Change permissions on the release files. + docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-repro-noble chmod -R 777 /repo/release + + # Clean up + #git rm cl-build + #git rm cl-release + + - name: Assert clean release + working-directory: ${{ github.workspace }} + run: | + echo 'Release file:' + ls -al release/clightning-* + + #mv release /tmp/ + #echo 'Release moved to:' + #ls -al /tmp/release/* + #releasefile=$(ls /tmp/release/*) + + if [ -n "$(echo $releasefile | sed -n '/-modded/p')" ]; then + #git status + #git diff + #docker run -v $GITHUB_WORKSPACE:/repo -t cl-release git status + #docker run -v $GITHUB_WORKSPACE:/repo -t cl-release git diff + + echo "Git Status:" + cat release/git-status.txt + echo "Git Diff:" + cat release/git-diff.txt + + echo 'Error: release modded / dirty tree.' + exit 1 + else + echo 'Success! Clean release.' + fi diff --git a/contrib/reprobuild/Dockerfile.noble b/contrib/reprobuild/Dockerfile.noble index 2636aef4890a..73cdcec44e08 100644 --- a/contrib/reprobuild/Dockerfile.noble +++ b/contrib/reprobuild/Dockerfile.noble @@ -70,5 +70,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/