Skip to content

Implement schedule fault notification #105

Implement schedule fault notification

Implement schedule fault notification #105

Workflow file for this run

# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Continuous Integration Tests
on:
push:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: '30 15 * * *'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
cfg:
- { id: ubuntu-gcc-werror, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'"}
- { id: ubuntu-gcc-aubsan, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_FLAGS=-fsanitize=address -fsanitize=undefined"}
- { id: ubuntu-gcc-tsan, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_FLAGS=-fsanitize=thread"}
- { id: ubuntu-gcc-static, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: ""}
- { id: ubuntu-gcc-dynamic, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DBUILD_SHARED_LIBS=on"}
- { id: ubuntu-clang-static, platform: ubuntu, cc: clang, cpp: clang++, cmake_args: ""}
- { id: ubuntu-clang-dynamic, platform: ubuntu, cc: clang, cpp: clang++, cmake_args: "-DBUILD_SHARED_LIBS=on"}
- { id: ubuntu-gcc-static-cxx20, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-gcc-static-cxx23, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=23 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-gcc-static-cxx26, platform: ubuntu, cc: gcc, cpp: g++, cmake_args: "-DCMAKE_CXX_STANDARD=26 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-clang-static-cxx20, platform: ubuntu, cc: clang, cpp: clang++, cmake_args: "-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-clang-static-cxx23, platform: ubuntu, cc: clang, cpp: clang++, cmake_args: "-DCMAKE_CXX_STANDARD=23 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
- { id: ubuntu-clang-static-cxx26, platform: ubuntu, cc: clang, cpp: clang++, cmake_args: "-DCMAKE_CXX_STANDARD=26 -DCMAKE_CXX_STANDARD_REQUIRED=on"}
steps:
- uses: actions/checkout@v4
# GitHub runners have updated the Ubuntu Linux Kernel to use strong ASLR,
# but LLVM is not configured for this change, and thus the address
# sanitizer breaks.
#
# The next image is supposed to fix this, so if the Ubuntu image has been
# updated, this work around is no longer required.
- name: get runner image version
id: runner-image-version
run: |
echo "image-version=$(echo $ImageVersion)" >> "$GITHUB_OUTPUT"
working-directory: .
- name: modify number of bits to use for ASLR entropy
if: ${{ steps.runner-image-version.outputs.ImageVersion }} == '20240310.1.0'
run: |
sudo sysctl -a | grep vm.mmap.rnd
sudo sysctl -w vm.mmap_rnd_bits=28
working-directory: .
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
tags: ${{ matrix.cfg.id }}
file: .ci/docker/${{ matrix.cfg.platform }}.Dockerfile
build-args: |
cc=${{ matrix.cfg.cc }}
cxx=${{ matrix.cfg.cpp }}
cmake_args=${{ matrix.cfg.cmake_args }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run tests
run: |
docker run ${{ matrix.cfg.id }} ctest --test-dir build -C Release
docker run ${{ matrix.cfg.id }} ctest --test-dir build -C Debug
create-issue-when-fault:
runs-on: ubuntu-latest
needs: [test]
if: failure() && github.event_name == 'schedule'
steps:
- uses: actions/checkout@v4
# See https://github.com/cli/cli/issues/5075
- name: Create issue
run: |
issue_num=$(gh issue list -s open -S "[SCHEDULED-BUILD] Build & Test failure" -L 1 --json number | jq 'if length == 0 then -1 else .[0].number end')
body="**Build-and-Test Failure Report**
- **Time of Failure**: $(date -u '+%B %d, %Y, %H:%M %Z')
- **Commit**: [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})
- **Action Run**: [View logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
The scheduled build-and-test triggered by cron has failed.
Please investigate the logs and recent changes associated with this commit."
echo $body
if [[ $issue_num -eq -1 ]]; then
gh issue create --repo ${{ github.repository }} --title "[SCHEDULED-BUILD] Build & Test failure" --body "$body"
else
gh issue comment --repo ${{ github.repository }} $issue_num --body "$body"
fi
env:
GH_TOKEN: ${{ github.token }}