This will email gzipped error logs to commit-hurd AT gnu.org from any
forgejo instance set up as a mirror.  This is facilitated by
not specifying any domain or user specific configuration, but to
execute the mailing code path, the repository must be called "gnumach"
and the branch that was synced be "master".
If the mail command is not configured in the CI, it will simply fail
to send mail and the failing test will not be reported.
Since there is only one instance currently set up, we won't get
duplicated reports.

---
 .forgejo/workflows/action.yaml | 39 ++++++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/.forgejo/workflows/action.yaml b/.forgejo/workflows/action.yaml
index ef3ed81d..6ea930b3 100644
--- a/.forgejo/workflows/action.yaml
+++ b/.forgejo/workflows/action.yaml
@@ -52,8 +52,22 @@ jobs:
                   --disable-linux-groups \
                   ${{ matrix.platform }} \
                   ${{ matrix.kdb }}
-          make gnumach.gz
-          make VERBOSE=true check
+          set -o pipefail
+          make gnumach.gz 2>&1 | tee ../error.log
+          make VERBOSE=true check 2>&1 | tee ../error.log
+
+      - name: Email failures
+        if: failure()
+        run: |
+          echo "CI failure: gnumach i386 on commit ${{ forgejo.SHA }} with 
options ${{ matrix.platform }} ${{ matrix.kdb }}"
+          if [ `basename ${{ forgejo.REPOSITORY }}` == "gnumach" ] && [ ${{ 
forgejo.REF_NAME }} == "master" ]; then
+            gzip -9 error.log
+            echo "CI failure: gnumach i386 master on commit ${{ forgejo.SHA }} 
with options ${{ matrix.platform }} ${{ matrix.kdb }}" | \
+              mail -a error.log.gz -s "[CI fail]: gnumach i386 ${{ forgejo.SHA 
}} (${{ matrix.platform }} ${{ matrix.kdb }})" \
+                [email protected]
+          fi
+          exit 1
+
   x86_64:
     runs-on: self
     strategy:
@@ -101,9 +115,10 @@ jobs:
           TARGET_CPPFLAGS=-I"$GNU"/include TARGET_CC=x86_64-linux-gnu-gcc 
../configure --prefix="$GNU" --target=x86_64-gnu
           make all install
           cd ../..
+          mkdir gnu32
+          GNU32=$(realpath gnu32)
           if [ "$USER_H" == "i686" ]; then
             # We need i386 headers to build mig 32bit
-            mkdir gnu32
             mkdir build32
             cd build32
             ../configure --prefix= --host=i686-gnu LD="x86_64-linux-gnu-ld 
-melf_i386" CC="x86_64-linux-gnu-gcc -m32" \
@@ -115,7 +130,6 @@ jobs:
             cd mig
             mkdir build32
             cd build32
-            GNU32=$(realpath ../../gnu32)
             TARGET_CPPFLAGS=-I"$GNU32"/include TARGET_CC="x86_64-linux-gnu-gcc 
-m32" TARGET_LD="x86_64-linux-gnu-ld -melf_i386" ../configure --prefix="$GNU32" 
--target=i686-gnu
             make all install
             cd ../..
@@ -130,5 +144,18 @@ jobs:
                   ${{ matrix.platform }} \
                   ${{ matrix.user32 }} \
                   ${{ matrix.kdb }}
-          make gnumach.gz
-          make VERBOSE=true check
+          set -o pipefail
+          make gnumach.gz 2>&1 | tee ../error.log
+          make VERBOSE=true check 2>&1 | tee ../error.log
+
+      - name: Email failures
+        if: failure()
+        run: |
+          echo "CI failure: gnumach amd64 on commit ${{ forgejo.SHA }} with 
options ${{ matrix.platform }} ${{ matrix.user32 }} ${{ matrix.kdb }}"
+          if [ `basename ${{ forgejo.REPOSITORY }}` == "gnumach" ] && [ ${{ 
forgejo.REF_NAME }} == "master" ]; then
+            gzip -9 error.log
+            echo "CI failure: gnumach amd64 master on commit ${{ forgejo.SHA 
}} with options ${{ matrix.platform }} ${{ matrix.user32 }} ${{ matrix.kdb }}" 
| \
+              mail -a error.log.gz -s "[CI fail]: gnumach amd64 ${{ 
forgejo.SHA }} (${{ matrix.platform }} ${{ matrix.user32 }} ${{ matrix.kdb }})" 
\
+                [email protected]
+          fi
+          exit 1
-- 
2.51.0



Reply via email to