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

Update Build and Test CI Workflow #149

Merged
merged 7 commits into from
Jul 2, 2024
Merged
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
122 changes: 18 additions & 104 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ env:
-DHEXL_HINT_DIR=${GITHUB_WORKSPACE}/lib/cmake/hexl-${HEXL_VER}
COVERAGE_COMPILER_FLAGS: >
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_CXX_COMPILER=g++-9
-DCMAKE_C_COMPILER=gcc-9
-DCMAKE_CXX_COMPILER=g++-11
-DCMAKE_C_COMPILER=gcc-11
-DHEXL_BENCHMARK=ON
-DHEXL_TESTING=ON
-DHEXL_COVERAGE=ON
Expand All @@ -42,7 +42,7 @@ env:
jobs:
format:
name: Format
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
# Required for pre-commit
Expand All @@ -60,8 +60,11 @@ jobs:
shell: bash
strategy:
matrix:
# removed platforms not available on github hosted servers.
# sel-fhosted ice-lake servers not enabled by sysadmin
# os: [ice-lake, [self-hosted, ubuntu-18.04], macos-latest, ubuntu-20.04]
os: [ice-lake, macos-latest, ubuntu-20.04]
# os: [macos-latest, ubuntu-20.04]
os: [macos-latest, ubuntu-22.04]
build_type: [Release, Debug]
shared_lib: [ON, OFF]
include:
Expand All @@ -83,8 +86,8 @@ jobs:
run: |
set -x
if [ "$RUNNER_OS" == "Linux" ]; then
export CC=clang-10
export CXX=clang++-10
export CC=clang-14
export CXX=clang++-14
fi

# Print information useful for debugging
Expand Down Expand Up @@ -177,101 +180,6 @@ jobs:

# TODO: add pkgconfig and vcpkg examples



ubuntu-1804-build:
name: '${{ matrix.os }} ${{ matrix.build_type }} shared=${{ matrix.shared_lib }}'
runs-on: '${{ matrix.os }}'
defaults:
run:
shell: bash
strategy:
matrix:
os: [ubuntu-18.04]
build_type: [Release, Debug]
shared_lib: [ON, OFF]
include:
# Run benchmarks quickly in Debug mode
- build_type: Debug
benchmark_min_time: "--benchmark_min_time=0.001"
- build_type: Release
benchmark_min_time: ""
exclude: # Skip debug on Mac. TODO: add Debug mode
- os: macos-latest
build_type: Debug
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.10
with:
cmake-version: '3.13.x'
- name: Default build
run: |
set -x
if [ "$RUNNER_OS" == "Linux" ]; then
export CC=gcc
export CXX=g++
fi

# Print information useful for debugging
gcc --version
g++ --version
whoami
echo $HOME
echo $GITHUB_WORKSPACE
echo "Testing from branch:"
echo $GITHUB_REFH
cmake --version
pwd

# Build library
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DHEXL_SHARED_LIB=${{ matrix.shared_lib }} \
-DCMAKE_INSTALL_PREFIX=./
cmake --build build -j
cmake --build build --target install
cmake --build build --target unittest
# Instead of calling cmake --build build --target bench,
# we run the executable directly to pass command-line arguments
./build/benchmark/bench_hexl \
--benchmark_out="${GITHUB_WORKFLOW}_${GITHUB_SHA}" \
--benchmark_out_format=csv ${{ matrix.benchmark_min_time }}

# Build and run examples
cd $GITHUB_WORKSPACE/example/cmake
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
${{ env.HEXL_HINT_DIR }}
cmake --build build
build/example

# Build example using pkgconfig
cd $GITHUB_WORKSPACE/example/pkgconfig
# Set PKG_CONFIG_PATH to locate hexl.pc
export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/lib/pkgconfig
cmake -S . -B build
cmake --build build
build/example

# Build example using vcpkg
# TODO: fix vcpkg example CI
# vcpkg install hexl --overlay-ports=$GITHUB_WORKSPACE/port/hexl/ --head
# cd $GITHUB_WORKSPACE/example/vcpkg
# vcpkg_toolchain=$(locate vcpkg.cmake)
# echo $vcpkg_toolchain
# cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$vcpkg_toolchain
# cmake --build build
# build/example
# set +x

- name: Archive benchmark results
uses: actions/upload-artifact@v2
with:
name: bench_hexl_${{github.sha}}.csv
path: ${{ github.workspace }}/${{ github.workflow }}_${{ github.sha }}
retention-days: 90 # Maximum for free version



experimental-build:
name: 'experimental: ${{ matrix.os }} ${{ matrix.build_type }} shared=${{ matrix.shared_lib }}'
runs-on: '${{ matrix.os }}'
Expand All @@ -280,7 +188,13 @@ jobs:
shell: bash
strategy:
matrix:
os: [ice-lake]
# This is an unsupported experimental build - use at your own risk
#
# Ice-lake platform not available on github
# self-hosted platforms disabled by Intel github sys admin
# building on default ubuntu-20.04 platform
# os: [ice-lake]
os: [ubuntu-20.04]
build_type: [Release]
shared_lib: [ON]
steps:
Expand All @@ -289,8 +203,8 @@ jobs:
run: |
set -x
if [ "$RUNNER_OS" == "Linux" ]; then
export CC=clang-10
export CXX=clang++-10
export CC=clang-11
export CXX=clang++-11
fi

# Print information useful for debugging
Expand Down