Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds CI #13

Merged
merged 8 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed .github/workflows/ci.yml
Empty file.
130 changes: 130 additions & 0 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# 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:
# preset-test:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# preset: []
# name: "Preset Test: ${{ matrix.preset }}"
# steps:
# - uses: actions/checkout@v4
# - name: Setup build environment
# uses: lukka/get-cmake@latest
# with:
# cmakeVersion: "~3.25.0"
# ninjaVersion: "^1.11.1"
# - name: Run preset
# run: cmake --workflow --preset ${{ matrix.preset }}

test:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
compiler:
- cpp: g++
c: gcc
- cpp: clang++
c: clang
cpp_version: [20, 23, 26]
cmake_args:
- description: "Default"
args: ""
- description: "TSan"
args: "-DCMAKE_CXX_FLAGS=-fsanitize=thread"
- description: "ASan"
args: "-DCMAKE_CXX_FLAGS=-fsanitize=address -fsanitize=undefined"
include:
- platform: ubuntu-latest
compiler:
cpp: g++
c: gcc
cpp_version: 20
cmake_args:
description: "Werror"
cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'"
- platform: ubuntu-latest
compiler:
cpp: g++
c: gcc
cpp_version: 20
cmake_args:
description: "Dynamic"
cmake_args: "-DBUILD_SHARED_LIBS=on"

name: "Bulid & Test: ${{ matrix.compiler.c }} ${{ matrix.cpp_version }} ${{ matrix.cmake_args.description }}"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0"
ninjaVersion: "^1.11.1"
- name: Print installed softwares
run: |
clang++ --version
g++ --version
cmake --version
ninja --version
- name: Configure CMake
run: |
cmake -B build -S . "-DCMAKE_CXX_STANDARD=${{ matrix.cpp_version }} ${{ matrix.cmake_args.args }}"
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
CMAKE_GENERATOR: "Ninja Multi-Config"
- name: Build Release
run: |
cmake --build build --config Release --verbose
# cmake --build build --config Release --target all_verify_interface_header_sets
cmake --install build --config Release --prefix /tmp/beman.inplace_vector
find /tmp/beman.inplace_vector -type f
- name: Test Release
run: ctest --test-dir build --build-config Release
- name: Build Debug
run: |
cmake --build build --config Debug --verbose
# cmake --build build --config Debug --target all_verify_interface_header_sets
cmake --install build --config Debug --prefix /tmp/beman.inplace_vector
find /tmp/beman.inplace_vector -type f
- name: Test Debug
run: ctest --test-dir build --build-config Debug

create-issue-when-fault:
runs-on: ubuntu-latest
needs: [test]
if: failure() && github.event_name == 'schedule'
steps:
# See https://github.com/cli/cli/issues/5075
- uses: actions/checkout@v4
- 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 or rerun the workflow if you believe this is an error."

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 }}
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ project(
"A dynamically-resizable vector with fixed capacity and embedded storage"
LANGUAGES CXX)

include(GNUInstallDirs)

add_library(beman.inplace_vector INTERFACE)
target_include_directories(
beman.inplace_vector
Expand Down