@@ -17,44 +17,80 @@ jobs:
17
17
version : ['focal', 'jammy', 'noble']
18
18
steps :
19
19
- name : Git checkout
20
+ id : repo_chackout
20
21
uses : actions/checkout@v4
21
22
22
- - name : Build environment setup
23
+ - name : Build environment setup - ${{ matrix.version }}
24
+ id : environment_setup
25
+ shell : bash
23
26
run : |
24
27
echo "Building base image for ${{ matrix.version }}"
25
- sudo docker run --rm -v $(pwd):/build ubuntu:${{ matrix.version }} bash -c "\
26
- apt-get update && \
27
- apt-get install -y debootstrap && \
28
- debootstrap ${{ matrix.version }} /build/${{ matrix.version }}"
29
- sudo tar -C ${{ matrix.version }} -c . | docker import - ${{ matrix.version }}
28
+ {
29
+ echo "STEP=Build environment setup" >> "$GITHUB_ENV"
30
+ sudo docker run --rm -v $(pwd):/build ubuntu:${{ matrix.version }} bash -c "\
31
+ apt-get update && \
32
+ apt-get install -y debootstrap && \
33
+ debootstrap ${{ matrix.version }} /build/${{ matrix.version }}"
34
+ sudo tar -C ${{ matrix.version }} -c . | docker import - ${{ matrix.version }}
35
+ } > command.log 2>&1 || {
36
+ echo "ERROR<<EOF" >> "$GITHUB_ENV"
37
+ echo "$(cat command.log)" >> "$GITHUB_ENV"
38
+ echo "EOF" >> "$GITHUB_ENV"
39
+ exit 1
40
+ }
30
41
31
- - name : Builder image setup
32
- run : docker build -t cl-repro-${{ matrix.version }} - < contrib/reprobuild/Dockerfile.${{ matrix.version }}
42
+ - name : Builder image setup - ${{ matrix.version }}
43
+ id : builder_image_setup
44
+ shell : bash
45
+ run : |
46
+ {
47
+ echo "STEP=Builder image setup" >> "$GITHUB_ENV"
48
+ docker build -t cl-repro-${{ matrix.version }} - < contrib/reprobuild/Dockerfile.${{ matrix.version }}
49
+ } > command.log 2>&1 || {
50
+ echo "ERROR<<EOF" >> "$GITHUB_ENV"
51
+ echo "$(cat command.log)" >> "$GITHUB_ENV"
52
+ echo "EOF" >> "$GITHUB_ENV"
53
+ exit 1
54
+ }
33
55
34
- - name : Build using the builder image and store Git state
56
+ - name : Build reproducible image and store Git state - ${{ matrix.version }}
57
+ id : repro_image_setup
58
+ shell : bash
35
59
run : |
36
- # Create release directory.
37
- mkdir $GITHUB_WORKSPACE/release
60
+ {
61
+ echo "STEP=Build reproducible image and store Git state" >> "$GITHUB_ENV"
38
62
39
- # Perform the repro build .
40
- docker run --name cl-build -v $GITHUB_WORKSPACE:/repo -e FORCE_MTIME=$(date +%F) -t cl-repro-${{ matrix.version }}
63
+ # Create release directory .
64
+ mkdir $GITHUB_WORKSPACE/release
41
65
42
- # Commit the image in order to inspect the build later .
43
- docker commit cl-build cl-release
66
+ # Perform the repro build .
67
+ docker run --name cl-build -v $GITHUB_WORKSPACE:/repo -e FORCE_MTIME=$(date +%F) -t cl-repro-${{ matrix.version }}
44
68
45
- # Inspect the version .
46
- docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-release bash -c "make version > /repo/release/version.txt"
69
+ # Commit the image in order to inspect the build later .
70
+ docker commit cl-build cl-repro
47
71
48
- # Inspect the Git tree state.
49
- docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-release bash -c "\
50
- git --no-pager status > /repo/release/git.log && \
51
- git --no-pager diff >> /repo/release/git.log"
72
+ # Inspect the version.
73
+ docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-repro bash -c "make version > /repo/release/version.txt"
52
74
53
- # Change permissions on the release files for access by the runner environment.
54
- sudo chown -R runner $GITHUB_WORKSPACE/release
75
+ # Inspect the Git tree state.
76
+ docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-repro bash -c "\
77
+ git --no-pager status > /repo/release/git.log && \
78
+ git --no-pager diff >> /repo/release/git.log"
55
79
56
- - name : Assert clean version and release
80
+ # Change permissions on the release files for access by the runner environment.
81
+ sudo chown -R runner $GITHUB_WORKSPACE/release
82
+ } > command.log 2>&1 || {
83
+ echo "ERROR<<EOF" >> "$GITHUB_ENV"
84
+ echo "$(cat command.log)" >> "$GITHUB_ENV"
85
+ echo "EOF" >> "$GITHUB_ENV"
86
+ exit 1
87
+ }
88
+
89
+ - name : Assert clean version - ${{ matrix.version }}
90
+ id : assert_version
91
+ shell : bash
57
92
run : |
93
+ echo "STEP=Assert clean version" >> "$GITHUB_ENV"
58
94
echo 'Version:'
59
95
cat release/version.txt
60
96
echo -e
65
101
echo -e
66
102
67
103
if [ -n "$(cat release/version.txt | sed -n '/-modded/p')" ] || \
68
- [ -n "$(echo $releasefile | sed -n '/-modded/p')" ]
104
+ [ -n "$(echo $releasefile | sed -n '/-modded/p')" ]
69
105
then
70
106
echo "Git Status and Diff:"
71
107
cat release/git.log
@@ -76,3 +112,38 @@ jobs:
76
112
else
77
113
echo 'Success! Clean release.'
78
114
fi
115
+
116
+ - name : Upload release artifact - ${{ matrix.version }}
117
+ uses : actions/upload-artifact@v4
118
+ with :
119
+ name : release-${{ matrix.version }}
120
+ path : release
121
+
122
+ - name : Send email on failure
123
+ id : send_email
124
+ if : ${{ failure() }}
125
+ uses : dawidd6/action-send-mail@v3
126
+ with :
127
+ server_address : smtp.gmail.com
128
+ server_port : 587
129
+ username : ${{ secrets.EMAIL_USERNAME }}
130
+ password : ${{ secrets.EMAIL_PASSWORD }}
131
+ from : ${{ secrets.EMAIL_USERNAME }}
132
+ to : ${{ vars.DISTRIBUTION_LIST }}
133
+ subject : " CI Failure: Step ${{ env.STEP }} failed for distro ${{ matrix.version }}"
134
+ convert_markdown : true
135
+ html_body : |
136
+ <html>
137
+ <body>
138
+ <p><strong>Failure Details:</strong></p>
139
+ <ul>
140
+ <li><strong>Workflow:</strong> ${{ github.workflow }}</li>
141
+ <li><strong>Event:</strong> ${{ github.event_name }}</li>
142
+ <li><strong>Job:</strong> ${{ github.job }}</li>
143
+ <li><strong>Distro:</strong> ${{ matrix.version }}</li>
144
+ <li><strong>Step:</strong> ${{ env.STEP }}</li>
145
+ <li><strong>URL:</strong> <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}</a></li>
146
+ <li><strong>Reason:</strong> <pre>${{ env.ERROR }}</pre></li>
147
+ </ul>
148
+ </body>
149
+ </html>
0 commit comments