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

Move Build & Test out of docker #48

Merged
merged 8 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
38 changes: 0 additions & 38 deletions .ci/docker/ubuntu.Dockerfile

This file was deleted.

125 changes: 76 additions & 49 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,63 +12,90 @@ on:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
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"}
neatudarius marked this conversation as resolved.
Show resolved Hide resolved
platform: [ubuntu-latest]
compiler:
- cpp: g++
c: gcc
- cpp: clang++
c: clang
cmake_args:
- description: "Static default"
args: ""
- description: "Dynamic default"
args: "-DBUILD_SHARED_LIBS=on"
- description: "static C++20"
args: "-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=on"
neatudarius marked this conversation as resolved.
Show resolved Hide resolved
- description: "static C++23"
args: "-DCMAKE_CXX_STANDARD=23 -DCMAKE_CXX_STANDARD_REQUIRED=on"
- description: "static C++26"
args: "-DCMAKE_CXX_STANDARD=26 -DCMAKE_CXX_STANDARD_REQUIRED=on"
include:
- platform: ubuntu-latest
compiler:
cpp: g++
c: gcc
cmake_args:
description: "Werror"
cmake_args: "-DCMAKE_CXX_FLAGS='-Werror=all -Werror=extra'"
- platform: ubuntu-latest
compiler:
cpp: g++
c: gcc
cmake_args:
description: "A-San"
cmake_args: "-DCMAKE_CXX_FLAGS=-fsanitize=address -fsanitize=undefined"
- platform: ubuntu-latest
compiler:
cpp: g++
c: gcc
cmake_args:
description: "T-San"
cmake_args: "-DCMAKE_CXX_FLAGS=-fsanitize=thread"

name: "Bulid & Test: ${{ matrix.compiler.c }} ${{ matrix.cmake_args.description }}"
runs-on: ${{ matrix.platform }}
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
- name: Install Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.25.0"
ninjaVersion: "^1.11.1"
- name: Print installed softwares
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub Image comes with Clang and GCC, we can setup specific version of them if needed in the future.

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'
Comment on lines -44 to -47
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we no longer have to care about this. Current image version has well past this post.

(Also this condition was erroneous).

clang++ --version
g++ --version
cmake --version
ninja --version
- name: Build Release
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
cmake -B build -S . "${{ matrix.cmake_args.args }}"
cmake --build build --config Release --verbose
cmake --build build --config Release --target all_verify_interface_header_sets
cmake --install build --config Release --prefix /opt/beman.exemplar
find /opt/beman.exemplar -type f
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
CMAKE_GENERATOR: "Ninja Multi-Config"
- name: Test Release
run: ctest --test-dir build -C Release
wusatosi marked this conversation as resolved.
Show resolved Hide resolved
- name: Build Debug
run: |
docker run ${{ matrix.cfg.id }} ctest --test-dir build -C Release
docker run ${{ matrix.cfg.id }} ctest --test-dir build -C Debug
cmake -B build -S . "${{ matrix.cmake_args.args }}"
cmake --build build --config Debug --verbose
cmake --build build --config Debug --target all_verify_interface_header_sets
cmake --install build --config Debug --prefix /opt/beman.exemplar
find /opt/beman.exemplar -type f
env:
CC: ${{ matrix.compiler.c }}
CXX: ${{ matrix.compiler.cpp }}
CMAKE_GENERATOR: "Ninja Multi-Config"
- name: Test Release
run: ctest --test-dir build -C Debug
wusatosi marked this conversation as resolved.
Show resolved Hide resolved

create-issue-when-fault:
runs-on: ubuntu-latest
Expand Down
Loading