Merge pull request #624 from andreasfertig/armBuild #837
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches-ignore: | |
- 'continuous' | |
pull_request: | |
branches-ignore: | |
- 'continuous' | |
repository_dispatch: | |
types: [rebuild_trigger] | |
env: | |
CMAKE_VERSION: 3.29.0 | |
NINJA_VERSION: 1.11.1 | |
LLVM_VERSION: 18.1.0 | |
NINJA_STATUS: "[%f/%t %o/sec] " | |
jobs: | |
checks: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
# Clang | |
- { | |
name: "Linux Clang - Format check", | |
os: ubuntu-20.04, | |
build_type: Release, | |
cformat_name: 'clang-format-18' | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Install Clang | |
shell: bash | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 18 | |
sudo apt-get install ${{ matrix.config.cformat_name }} | |
- name: clang-format check | |
id: clang_format_check | |
shell: bash | |
run: | | |
${GITHUB_WORKSPACE}/scripts/github-clang-format-check.sh ${{ matrix.config.cformat_name }} ${{ github.event_name }} ${{ github.event.before }} | |
#------------------------------------------------------------------------------ | |
# BUILD macOS and Windows | |
#------------------------------------------------------------------------------ | |
build: | |
needs: checks | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
# AppleClang | |
- { | |
name: "Clang 18 / LLVM 18 @ macOS Release", | |
os: macos-14, | |
build_type: Release, | |
cxx: "clang++", | |
llvm_version: "18.1.0", | |
llvm_config: "llvm-config", | |
coverage: "No", | |
static: "No", | |
debug: "No", | |
tidy: "No", | |
run_tests: "Yes", | |
bin_name: "insights", | |
archive_name: "insights-macos", | |
upload: "Yes", | |
cmake_args: "-DCMAKE_OSX_ARCHITECTURES=arm64", | |
} | |
# AppleClang | |
- { | |
name: "Clang 18 / LLVM 18 @ macOS Debug", | |
os: macos-14, | |
build_type: Release, | |
cxx: "clang++", | |
llvm_version: "18.1.0", | |
llvm_config: "llvm-config", | |
coverage: "No", | |
static: "No", | |
debug: "Yes", | |
tidy: "No", | |
run_tests: "No", # done by the coverage build | |
bin_name: "insights", | |
archive_name: "insights-macos", | |
upload: "No", | |
cmake_args: "-DCMAKE_OSX_ARCHITECTURES=arm64", | |
} | |
# # AppleClang | |
# - { | |
# name: "Clang 18 / LLVM 18 @ macOS Coverage & Debug", | |
# os: macos-14, | |
# build_type: Release, | |
# cxx: "clang++", | |
# llvm_version: "18.1.0", | |
# llvm_config: "llvm-config", | |
# coverage: "Yes", | |
# static: "No", | |
# debug: "Yes", | |
# tidy: "No", | |
# run_tests: "No", | |
# bin_name: "insights", | |
# archive_name: "insights-macos", | |
# upload: "No", | |
# } | |
# # MSVC 2019 | |
# - { | |
# name: "MSVC 2022 / LLVM 18 @ Windows Release", | |
# os: windows-2022, | |
# build_type: Release, | |
# cxx: "cl", | |
# llvm_version: "18.1.0", | |
# llvm_config: "current/bin/llvm-config.exe", | |
# static: "Yes", | |
# debug: "No", | |
# tidy: "No", | |
# run_tests: "Yes", | |
# bin_name: "insights.exe", | |
# archive_name: "insights-windows", | |
# upload: "Yes", | |
# environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
# # cmake_args: "-A x64 -T LLVM_v142", | |
# } | |
# # MSVC 2019 | |
# - { | |
# name: "MSVC 2022 / LLVM 18 @ Windows Debug", | |
# os: windows-2022, | |
# build_type: Release, | |
# cxx: "cl", | |
# llvm_version: "18.1.0", | |
# llvm_config: "current/bin/llvm-config.exe", | |
# static: "Yes", | |
# debug: "Yes", | |
# tidy: "No", | |
# run_tests: "No", # done by the coverage build | |
# bin_name: "insights.exe", | |
# archive_name: "insights-windows", | |
# upload: "No", | |
# environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
# } | |
# # MSVC 2019 | |
# - { | |
# name: "MSVC 2022 / LLVM 18 @ Windows Code Coverage & Debug", | |
# os: windows-2022, | |
# build_type: Release, | |
# cxx: "clang-cl.exe", | |
# llvm_version: "18.1.0", | |
# llvm_config: "current/bin/llvm-config.exe", | |
# coverage: "Yes", | |
# static: "Yes", | |
# debug: "Yes", | |
# tidy: "No", | |
# run_tests: "No", | |
# bin_name: "insights.exe", | |
# archive_name: "insights-windows", | |
# upload: "No", | |
# environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
# } | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
path: cppinsights | |
- name: Download Ninja and CMake | |
id: cmake_and_ninja_setup | |
shell: bash | |
run: | | |
cmake_version=$CMAKE_VERSION | |
ninja_version=$NINJA_VERSION | |
echo "Using host CMake version: ${CMAKE_VERSION}" | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
ninja_suffix="win.zip" | |
cmake_suffix="win64-x64.zip" | |
cmake_base_dir="cmake-${cmake_version}-win64-x64" | |
cmake_dir="${cmake_base_dir}/bin" | |
elif [ "$RUNNER_OS" == "Linux" ]; then | |
ninja_suffix="linux.zip" | |
cmake_suffix="Linux-x86_64.tar.gz" | |
cmake_base_dir="cmake-${cmake_version}-Linux-x86_64" | |
cmake_dir="${cmake_base_dir}/bin" | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
ninja_suffix="mac.zip" | |
cmake_suffix="macos-universal.tar.gz" | |
cmake_base_dir="cmake-${cmake_version}-macos-universal" | |
cmake_dir="${cmake_base_dir}/CMake.app/Contents/bin" | |
fi | |
ninja_url="https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}" | |
echo "ninja_url=${ninja_url}" >> $GITHUB_OUTPUT | |
cmake_url="https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-${cmake_suffix}" | |
echo "cmake_url=${cmake_url}" >> $GITHUB_OUTPUT | |
# preserve it for the next steps | |
echo "cmake_dir=${cmake_dir}" >> $GITHUB_OUTPUT | |
# preserve it for the next steps | |
echo "cmake_base_dir=${cmake_base_dir}" >> $GITHUB_OUTPUT | |
- name: Cache Ninja and CMake | |
id: cache-ninja-and-cmake | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ github.workspace }}/ninja* | |
${{ steps.cmake_and_ninja_setup.outputs.cmake_base_dir }} | |
key: ${{ runner.os }}-ninja-cmake-${{ hashFiles('${{ github.workspace }}/ninja.exe') }}-${{ hashFiles('${{ github.workspace }}/current') }}-${{ hashFiles('${{ steps.cmake_and_ninja_setup.outputs.cmake_base_dir }}') }} | |
restore-keys: | | |
${{ runner.os }}-ninja-cmake | |
- name: Download Ninja and CMake | |
id: cmake_and_ninja | |
if: steps.cache-ninja-and-cmake.outputs.cache-hit != 'true' | |
shell: cmake -P {0} | |
run: | | |
set(ninja_url "${{ steps.cmake_and_ninja_setup.outputs.ninja_url }}") | |
file(DOWNLOAD "${ninja_url}" ./ninja.zip) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ./ninja.zip) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ./ninja.zip) | |
set(cmake_url "${{ steps.cmake_and_ninja_setup.outputs.cmake_url }}") | |
file(DOWNLOAD "${cmake_url}" ./cmake.zip) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ./cmake.zip) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ./cmake.zip) | |
set(cmake_dir "${{ steps.cmake_and_ninja_setup.outputs.cmake_dir }}") | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${cmake_dir}" cmake_dir) | |
if (NOT "${{ runner.os }}" STREQUAL "Windows") | |
execute_process( | |
COMMAND chmod +x ninja | |
COMMAND chmod +x ${cmake_dir}/cmake | |
) | |
endif() | |
- name: Cache Clang | |
id: cache-clang-binary | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ github.workspace }}/current | |
key: ${{ runner.os }}-clang-${{ matrix.config.llvm_version }}-${{ hashFiles('${{ github.workspace }}/current') }} | |
- name: Install Clang | |
if: "(startsWith(matrix.config.os, 'macos') || startsWith(matrix.config.os, 'Window'))" | |
shell: cmake -P {0} | |
run: | | |
set(llvm_version ${{ matrix.config.llvm_version }}) | |
set(path_separator ":") | |
set(archive_name "clang+llvm-${llvm_version}-arm64-apple-darwin") | |
if ("${{ runner.os }}" STREQUAL "Windows") | |
set(archive_name "clang+llvm-${llvm_version}-win64-msvc") | |
set(path_separator ";") | |
endif() | |
file(REMOVE_RECURSE "./current") | |
file(DOWNLOAD "https://github.com/andreasfertig/cppinsights-compiler-binaries/releases/download/${llvm_version}/${archive_name}.tar.xz" ./llvm.tar.xz) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ./llvm.tar.xz) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ./llvm.tar.xz) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E rename "./${archive_name}" "./current") | |
- name: Set Clang path | |
if: "startsWith(matrix.config.os, 'macos') || startsWith(matrix.config.os, 'Window')" | |
shell: cmake -P {0} | |
run: | | |
set(path_separator ":") | |
if ("${{ runner.os }}" STREQUAL "Windows") | |
set(path_separator ";") | |
endif() | |
file(WRITE "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}/current/bin${path_separator}$ENV{PATH}") | |
- name: Install LLVM build tools | |
id: install_llvm_build_tools | |
if: "startsWith(matrix.config.os, 'Window') && contains(matrix.config.cmake_args, 'LLVM_v')" | |
shell: cmake -P {0} | |
run: | | |
file(DOWNLOAD "https://github.com/zufuliu/llvm-utils/releases/download/v19.05/LLVM_VS2017.zip" ./llvm-utils.zip) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ./llvm-utils.zip) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ./llvm-utils.zip) | |
execute_process(COMMAND $ENV{GITHUB_WORKSPACE}/LLVM_VS2017/install.bat) | |
- name: Cache grcov | |
id: cache-grcov-binary | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ github.workspace }}/grcov.exe | |
key: ${{ runner.os }}-grcov-${{ matrix.config.llvm_version }}-${{ hashFiles('${{ github.workspace }}/grcov.exe') }} | |
- name: Install LLVM grcov | |
# if: "(startsWith(matrix.config.os, 'Window') && (matrix.config.coverage == 'Yes') && ((steps.cache-grcov-binary.outputs.cache-hit != 'true') || (steps.cache-clang-binary.outputs.cache-hit != 'true')))" | |
if: "(startsWith(matrix.config.os, 'Window') && (matrix.config.coverage == 'Yes'))" | |
shell: cmake -P {0} | |
run: | | |
file(DOWNLOAD "https://github.com/mozilla/grcov/releases/download/v0.5.15/grcov-win-x86_64.tar.bz2" ./grcov.tar.bz2) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ./grcov.tar.bz2) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ./grcov.tar.bz2) | |
- name: Install lcov for macOS | |
if: "(startsWith(matrix.config.os, 'macos') && (matrix.config.coverage == 'Yes'))" | |
run: | | |
export HOMEBREW_NO_AUTO_UPDATE=1 | |
brew update > /dev/null | |
brew install lcov || brew upgrade lcov | |
brew install gcc@10 || brew upgrade gcc@10 # for Clang 18 and newer gcov | |
- name: Setup MSVC Dev | |
if: "startsWith(matrix.config.os, 'Windows')" | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Configure | |
id: cmake_configure | |
shell: cmake -P {0} | |
run: | | |
set(ENV{CXX} ${{ matrix.config.cxx }}) | |
if ("${{ runner.os }}" STREQUAL "macOS") | |
set(ENV{SDKROOT} "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk") | |
endif() | |
set(path_separator ":") | |
if ("${{ runner.os }}" STREQUAL "Windows") | |
set(path_separator ";") | |
endif() | |
file(WRITE "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") | |
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") | |
if ("x${{ matrix.config.libcxx }}" STREQUAL "xtrue") | |
set(cxx_flags "${cxx_flags} -stdlib=libc++ -Wno-unused-command-line-argument") | |
set(link_flags "${link_flags} -lc++abi") | |
endif() | |
execute_process( | |
COMMAND ${{ steps.cmake_and_ninja_setup.outputs.cmake_dir }}/cmake | |
-S cppinsights | |
-B build | |
-G "Ninja" | |
-D INSIGHTS_LLVM_CONFIG=${{ matrix.config.llvm_config}} | |
-D INSIGHTS_COVERAGE=${{ matrix.config.coverage }} | |
-D INSIGHTS_STATIC=${{ matrix.config.static }} | |
-D DEBUG=${{ matrix.config.debug }} | |
-D INSIGHTS_TIDY=${{ matrix.config.tidy }} | |
-D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }} | |
-D "CMAKE_MAKE_PROGRAM:STRING=$ENV{GITHUB_WORKSPACE}/ninja" | |
# -D "CMAKE_CXX_FLAGS:STRING=${cxx_flags}" | |
# -D "CMAKE_EXE_LINKER_FLAGS:STRING=${link_flags}" | |
${{ matrix.config.cmake_args }} | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit from cmake configure status") | |
endif() | |
- name: Build | |
shell: cmake -P {0} | |
continue-on-error: false | |
run: | | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
execute_process( | |
COMMAND ${{ steps.cmake_and_ninja_setup.outputs.cmake_dir }}/cmake --build build | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Run tests | |
id: run_tests | |
if: matrix.config.run_tests == 'Yes' | |
shell: cmake -P {0} | |
continue-on-error: false | |
run: | | |
if ("${{ runner.os }}" STREQUAL "macOS") | |
set(ENV{CPLUS_INCLUDE_PATH} "$ENV{GITHUB_WORKSPACE}/current/include/c++/v1:/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include") | |
set(ENV{SDKROOT} "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk") | |
endif() | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
execute_process( | |
COMMAND ${{ steps.cmake_and_ninja_setup.outputs.cmake_dir }}/cmake --build build --target tests | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status during tests") | |
endif() | |
- name: Run coverage | |
if: matrix.config.coverage == 'Yes' | |
shell: cmake -P {0} | |
continue-on-error: false | |
run: | | |
if ("${{ runner.os }}" STREQUAL "macOS") | |
set(ENV{CPLUS_INCLUDE_PATH} "$ENV{GITHUB_WORKSPACE}/current/include/c++/v1:/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include") | |
set(ENV{SDKROOT} "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk") | |
endif() | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
execute_process( | |
COMMAND cmake --build build --target coverage | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status during coverage") | |
endif() | |
- name: Upload code coverage info | |
if: matrix.config.coverage == 'Yes' | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./build/filtered.info # don't use a absolute path on Windows with gitBash. | |
flags: ${{ matrix.config.archive_name }} | |
fail_ci_if_error: true | |
- name: Create archive | |
if: matrix.config.upload == 'Yes' | |
shell: cmake -P {0} | |
working-directory: ${{ github.workspace }}/build | |
continue-on-error: false | |
run: | | |
file(MAKE_DIRECTORY "$ENV{GITHUB_WORKSPACE}/build/archive") | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar cvz "$ENV{GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}.tar.gz" -- "${{ matrix.config.bin_name }}") | |
file(SHA256 "$ENV{GITHUB_WORKSPACE}/build/${{ matrix.config.bin_name }}" CHKSM) | |
file(WRITE "$ENV{GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}.sha256" ${CHKSM}) | |
- uses: actions/upload-artifact@v3 | |
if: matrix.config.upload == 'Yes' | |
with: | |
name: insights-artifact-${{ matrix.config.os }} | |
if-no-files-found: error | |
path: | | |
${{ github.workspace }}/build/archive/* | |
#------------------------------------------------------------------------------ | |
# BUILD INSIDE DOCKER | |
#------------------------------------------------------------------------------ | |
docker_amd64: | |
runs-on: ubuntu-22.04 | |
name: ${{ matrix.config.name }} | |
container: | |
image: andreasfertig/cppinsights-builder | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
# GCC 13 / LLVM 18 | |
- { | |
name: "GCC 13 / LLVM 18 @ Ubuntu Release @docker", | |
build_type: Release, | |
cxx: "g++-13", | |
llvm_version: "18.1.0", | |
llvm_config: "/usr/bin/llvm-config-18", | |
coverage: "No", | |
static: "Yes", | |
debug: "No", | |
tidy: "No", | |
run_tests: "No", | |
libcxx: "No", | |
bin_name: "insights", | |
archive_name: "insights-ubuntu-amd64", | |
upload: "Yes", | |
docs: "Yes", | |
} | |
# GCC 13 / LLVM 18 | |
- { | |
name: "GCC 13 / LLVM 18 @ Ubuntu Code Coverage & Debug @docker", | |
build_type: Release, | |
cxx: "g++-13", | |
llvm_version: "18.1.0", | |
llvm_config: "/usr/bin/llvm-config-18", | |
coverage: "Yes", | |
static: "No", | |
debug: "Yes", | |
tidy: "No", | |
run_tests: "No", | |
libcxx: "No", | |
bin_name: "insights", | |
archive_name: "insights-ubuntu-amd64", | |
} | |
# GCC 13 / LLVM 18 | |
- { | |
name: "GCC 13 / LLVM 18 @ Ubuntu Code Coverage (libc++) @docker", | |
build_type: Release, | |
cxx: "g++-13", | |
llvm_version: "18.1.0", | |
llvm_config: "/usr/bin/llvm-config-18", | |
coverage: "Yes", | |
static: "No", | |
debug: "Yes", | |
tidy: "No", | |
run_tests: "No", | |
libcxx: "Yes", | |
bin_name: "insights", | |
archive_name: "insights-ubuntu-amd64", | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: cppinsights | |
- name: Configure | |
id: cmake_configure | |
run: | | |
export CXX=${{ matrix.config.cxx }} | |
mkdir build | |
cd build | |
cmake -G Ninja -DINSIGHTS_STATIC=${{ matrix.config.static }} -DDEBUG=${{ matrix.config.debug }} -DINSIGHTS_COVERAGE=${{ matrix.config.coverage }} -DINSIGHTS_USE_LIBCPP=${{ matrix.config.libcxx }} ../cppinsights | |
- name: Build | |
shell: cmake -P {0} | |
continue-on-error: false | |
run: | | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
execute_process( | |
COMMAND cmake --build build | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Run tests | |
if: matrix.config.run_tests == 'Yes' | |
id: run_tests | |
shell: cmake -P {0} | |
continue-on-error: false | |
run: | | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
execute_process( | |
COMMAND cmake --build build --target tests | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status during tests") | |
endif() | |
- name: Make docs | |
if: matrix.config.docs == 'Yes' | |
shell: cmake -P {0} | |
continue-on-error: false | |
run: | | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
execute_process( | |
COMMAND cmake --build build --target doc | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status during doc") | |
endif() | |
file(MAKE_DIRECTORY "$ENV{GITHUB_WORKSPACE}/build/archive/") | |
file(COPY "$ENV{GITHUB_WORKSPACE}/build/html" DESTINATION "$ENV{GITHUB_WORKSPACE}/build/archive/") | |
- name: Run coverage | |
if: matrix.config.coverage == 'Yes' | |
id: run_coverage | |
shell: cmake -P {0} | |
continue-on-error: false | |
run: | | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
execute_process( | |
COMMAND cmake --build build --target coverage | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status during coverage") | |
endif() | |
- name: Run coverage upload | |
if: matrix.config.coverage == 'Yes' | |
id: run_coverage_upload | |
continue-on-error: false | |
env: | |
LIBCXX: ${{ matrix.config.libcxx }} | |
shell: bash | |
run: | | |
if [ ! -f ${GITHUB_WORKSPACE}/build/filtered.info ]; then | |
echo -e "\033[1;31mlcov did not create filtered.info!\033[0m" | |
exit 1; | |
fi | |
if [ ! -s ${GITHUB_WORKSPACE}/build/filtered.info ]; then | |
echo -e "\033[1;31mlcov did create an empty filtered.info!\033[0m" | |
exit 1; | |
fi | |
flag="ubuntu" | |
if [ "Yes" == "${LIBCXX}" ]; then | |
flag="ubuntu-libcxx" | |
fi | |
# Uploading report to CodeCov | |
bash <(curl -s https://codecov.io/bash) -f ${GITHUB_WORKSPACE}/build/filtered.info -F ${flag} || echo "Codecov did not collect coverage reports" | |
- name: Create archive | |
if: matrix.config.upload == 'Yes' | |
working-directory: ${{ github.workspace }}/build | |
shell: cmake -P {0} | |
continue-on-error: false | |
run: | | |
file(MAKE_DIRECTORY "$ENV{GITHUB_WORKSPACE}/build/archive") | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar cvz "$ENV{GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}.tar.gz" -- "${{ matrix.config.bin_name }}") | |
file(SHA256 "$ENV{GITHUB_WORKSPACE}/build/${{ matrix.config.bin_name }}" CHKSM) | |
file(WRITE "$ENV{GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}.sha256" ${CHKSM}) | |
- uses: actions/upload-artifact@v3 | |
if: matrix.config.upload == 'Yes' | |
with: | |
name: insights-artifact-ubuntu | |
if-no-files-found: error | |
path: | | |
${{ github.workspace }}/build/archive/* | |
#------------------------------------------------------------------------------ | |
# BUILD INSIDE DOCKER for ARM | |
#------------------------------------------------------------------------------ | |
docker_arm64: | |
runs-on: ubuntu-22.04 | |
name: ${{ matrix.config.name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
# GCC 13 / LLVM 18 | |
- { | |
name: "GCC 13 / LLVM 18 @ Ubuntu ARM Release @docker", | |
build_type: Release, | |
cxx: "g++-13", | |
llvm_version: "18.1.0", | |
llvm_config: "/usr/bin/llvm-config-18", | |
coverage: "No", | |
static: "Yes", | |
debug: "No", | |
tidy: "No", | |
run_tests: "No", | |
libcxx: "No", | |
bin_name: "insights", | |
archive_name: "insights-ubuntu-arm64", | |
upload: "Yes", | |
docs: "No", | |
} | |
# GCC 13 / LLVM 18 | |
- { | |
name: "GCC 13 / LLVM 18 @ Ubuntu ARM Code Coverage & Debug @docker", | |
build_type: Release, | |
cxx: "g++-13", | |
llvm_version: "18.1.0", | |
llvm_config: "/usr/bin/llvm-config-18", | |
coverage: "Yes", | |
static: "No", | |
debug: "Yes", | |
tidy: "No", | |
run_tests: "No", | |
libcxx: "No", | |
bin_name: "insights", | |
archive_name: "insights-ubuntu-arm64", | |
} | |
# GCC 13 / LLVM 18 | |
- { | |
name: "GCC 13 / LLVM 18 @ Ubuntu ARM Code Coverage (libc++) @docker", | |
build_type: Release, | |
cxx: "g++-13", | |
llvm_version: "18.1.0", | |
llvm_config: "/usr/bin/llvm-config-18", | |
coverage: "Yes", | |
static: "No", | |
debug: "Yes", | |
tidy: "No", | |
run_tests: "No", | |
libcxx: "Yes", | |
bin_name: "insights", | |
archive_name: "insights-ubuntu-arm64", | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: cppinsights | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Configure | |
id: cmake_configure | |
run: | | |
mkdir build | |
cat > build.sh << "EOF" | |
#! /bin/bash | |
cd build | |
CXX=${{ matrix.config.cxx }} cmake -G Ninja -DINSIGHTS_STATIC=${{ matrix.config.static }} -DDEBUG=${{ matrix.config.debug }} -DINSIGHTS_COVERAGE=${{ matrix.config.coverage }} -DINSIGHTS_USE_LIBCPP=${{ matrix.config.libcxx }} ../cppinsights | |
EOF | |
chmod 0755 build.sh | |
docker run \ | |
--rm \ | |
-v $(pwd):/${{ github.workspace }} \ | |
-w ${{ github.workspace }} \ | |
--user $(id -u):$(id -g) \ | |
--platform linux/arm64 \ | |
andreasfertig/cppinsights-builder \ | |
./build.sh | |
- name: Build | |
shell: bash | |
continue-on-error: false | |
run: | | |
docker run \ | |
--rm \ | |
-v $(pwd):/${{ github.workspace }} \ | |
-w ${{ github.workspace }} \ | |
--user $(id -u):$(id -g) \ | |
--platform linux/arm64 \ | |
andreasfertig/cppinsights-builder \ | |
cmake --build build | |
- name: Run tests | |
if: matrix.config.run_tests == 'Yes' | |
id: run_tests | |
shell: bash | |
continue-on-error: false | |
run: | | |
docker run \ | |
--rm \ | |
-v $(pwd):/${{ github.workspace }} \ | |
-w ${{ github.workspace }} \ | |
--user $(id -u):$(id -g) \ | |
--platform linux/arm64 \ | |
andreasfertig/cppinsights-builder \ | |
cmake --build build --target tests | |
- name: Run coverage | |
if: matrix.config.coverage == 'Yes' | |
id: run_coverage | |
shell: bash | |
continue-on-error: false | |
run: | | |
docker run \ | |
--rm \ | |
-v $(pwd):/${{ github.workspace }} \ | |
-w ${{ github.workspace }} \ | |
--user $(id -u):$(id -g) \ | |
--platform linux/arm64 \ | |
andreasfertig/cppinsights-builder \ | |
cmake --build build --target coverage | |
- name: Run coverage upload | |
if: matrix.config.coverage == 'Yes' | |
id: run_coverage_upload | |
continue-on-error: false | |
env: | |
LIBCXX: ${{ matrix.config.libcxx }} | |
shell: bash | |
run: | | |
if [ ! -f ${GITHUB_WORKSPACE}/build/filtered.info ]; then | |
echo -e "\033[1;31mlcov did not create filtered.info!\033[0m" | |
exit 1; | |
fi | |
if [ ! -s ${GITHUB_WORKSPACE}/build/filtered.info ]; then | |
echo -e "\033[1;31mlcov did create an empty filtered.info!\033[0m" | |
exit 1; | |
fi | |
flag="ubuntu-arm64" | |
if [ "Yes" == "${LIBCXX}" ]; then | |
flag="ubuntu-arm64-libcxx" | |
fi | |
# Uploading report to CodeCov | |
bash <(curl -s https://codecov.io/bash) -f ${GITHUB_WORKSPACE}/build/filtered.info -F ${flag} || echo "Codecov did not collect coverage reports" | |
- name: Create archive | |
if: matrix.config.upload == 'Yes' | |
working-directory: ${{ github.workspace }}/build | |
shell: cmake -P {0} | |
continue-on-error: false | |
run: | | |
file(MAKE_DIRECTORY "$ENV{GITHUB_WORKSPACE}/build/archive") | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar cvz "$ENV{GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}.tar.gz" -- "${{ matrix.config.bin_name }}") | |
file(SHA256 "$ENV{GITHUB_WORKSPACE}/build/${{ matrix.config.bin_name }}" CHKSM) | |
file(WRITE "$ENV{GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}.sha256" ${CHKSM}) | |
- uses: actions/upload-artifact@v3 | |
if: matrix.config.upload == 'Yes' | |
with: | |
name: insights-artifact-ubuntu-arm64 | |
if-no-files-found: error | |
path: | | |
${{ github.workspace }}/build/archive/* | |
#------------------------------------------------------------------------------ | |
# DEPLOY | |
#------------------------------------------------------------------------------ | |
deploy: | |
needs: [build, docker_amd64, docker_arm64] | |
if: github.ref == 'refs/heads/main' | |
name: Final Deploy | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: cppinsights | |
fetch-depth: 0 | |
- name: Install node | |
uses: actions/setup-node@v1 | |
- name: Install gren | |
id: install_gren | |
shell: bash | |
run: | | |
npm install github-release-notes -g | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ~/binaries | |
- name: Generate release notes | |
env: | |
GREN_GITHUB_TOKEN: ${{ secrets.GREN_GITHUB_TOKEN }} | |
shell: bash | |
run: | | |
cd ${GITHUB_WORKSPACE}/cppinsights | |
gren changelog --generate --override --username=andreasfertig --repo=cppinsights -t continuous..`git tag --sort=-creatordate | grep -v continuous | head -n 1 ` -c .github/grenrc.json | |
sed -in '1,4d' CHANGELOG.md | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "/home/runner/binaries/insights-artifact-*/insights-*" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
bodyFile: "${{ github.workspace }}/cppinsights/CHANGELOG.md" | |
allowUpdates: true | |
artifactErrorsFailBuild: true | |
name: continuous | |
prerelease: true | |
removeArtifacts: true | |
tag: continuous | |
generateReleaseNotes: false | |
- name: Upload docs to gh-pages | |
env: | |
GH_TOKEN: ${{ secrets.GREN_GITHUB_TOKEN }} | |
run: | | |
echo "Creating and changing into ${GITHUB_WORKSPACE}/gh-pages" | |
mkdir ${GITHUB_WORKSPACE}/gh-pages | |
cd ${GITHUB_WORKSPACE}/gh-pages | |
echo "Cloning gh-pages repo" | |
/usr/bin/git clone https://andreasfertig:${GH_TOKEN}@github.com/andreasfertig/andreasfertig.github.io.git . | |
echo "Setting up git config" | |
/usr/bin/git config user.name andreasfertig | |
/usr/bin/git config user.email [email protected] | |
echo "Rsyncing files to gh-pages" | |
/usr/bin/rsync -q -av --checksum --progress ~/binaries/insights-artifact-ubuntu/html/. ${GITHUB_WORKSPACE}/gh-pages --delete --exclude CNAME --exclude .ssh --exclude .git --exclude .github | |
/usr/bin/git status --porcelain | |
echo "Adding all files" | |
/usr/bin/git add --all . | |
echo "Committing" | |
/usr/bin/git commit -m "Deploying to main from main @ ${GITHUB_SHA}" --quiet --no-verify | |
echo "Pushing" | |
/usr/bin/git push --force | |
- name: Notify listeners | |
run: | | |
curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ secrets.GH_TRIGGER }}" https://api.github.com/repos/andreasfertig/cppinsights-container/dispatches -d '{"event_type":"rebuild_trigger"}' &> /dev/null |