Merge pull request #673 from Freed-Wu/doc #979
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 }} | |
continue-on-error: false | |
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@v4 | |
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@v4 | |
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')) && steps.cache-clang-binary.outputs.cache-hit != 'true'" | |
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 | |
if: "(startsWith(matrix.config.os, 'Window') && (matrix.config.coverage == 'Yes'))" | |
uses: actions/cache@v4 | |
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: 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} | |
run: | | |
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} | |
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() | |
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} | |
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() | |
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@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./build/filtered.info # don't use a absolute path on Windows with gitBash. | |
exclude: build | |
flags: ${{ matrix.config.archive_name }} | |
disable_search: true | |
fail_ci_if_error: true | |
- name: Create archive | |
if: matrix.config.upload == 'Yes' | |
shell: cmake -P {0} | |
working-directory: ${{ github.workspace }}/build | |
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: | |
runs-on: ubuntu-22.04 | |
name: ${{ matrix.config.name }} @${{ matrix.arch }} | |
continue-on-error: false | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- arm64 | |
- amd64 | |
config: | |
# GCC 13 / LLVM 18 | |
- { | |
name: "GCC 13 / LLVM 18 @ Ubuntu Release", | |
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", | |
upload: "Yes", | |
docs: "Yes", | |
} | |
# GCC 13 / LLVM 18 | |
- { | |
name: "GCC 13 / LLVM 18 @ Ubuntu Code Coverage & Debug", | |
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", | |
} | |
# GCC 13 / LLVM 18 | |
- { | |
name: "GCC 13 / LLVM 18 @ Ubuntu Code Coverage (libc++)", | |
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", | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: cppinsights | |
- name: Create docker shell | |
shell: bash | |
run: | | |
cat > docker-shell << "EOF" | |
#! /bin/bash | |
cp $1 ./__cmd.sh | |
docker run \ | |
--rm \ | |
-v "/var/run/docker.sock":"/var/run/docker.sock" \ | |
-v "/home/runner/work/_temp/_github_home":"/github/home" \ | |
-v "/home/runner/work/_temp/_github_workflow":"/github/workflow" \ | |
-v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" \ | |
-v "/home/runner/work/cppinsights/cppinsights":"/github/workspace" \ | |
--workdir /github/workspace \ | |
--user $(id -u):$(id -g) \ | |
--platform linux/${{ matrix.arch }} \ | |
andreasfertig/cppinsights-builder \ | |
/bin/bash -e ./__cmd.sh | |
EOF | |
sudo mv docker-shell /usr/bin/docker-shell | |
sudo chmod 0755 /usr/bin/docker-shell | |
- name: Set up QEMU | |
if: matrix.arch == 'arm64' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Configure | |
id: cmake_configure | |
shell: docker-shell {0} | |
run: | | |
mkdir build | |
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 | |
- name: Build | |
shell: docker-shell {0} | |
run: | | |
cmake --build build | |
- name: Simple test | |
if: "((matrix.config.coverage != 'Yes') && (matrix.config.run_tests != 'Yes'))" | |
shell: docker-shell {0} | |
run: | | |
./build/insights cppinsights/tests/SimpleCICompileTest.cpp | |
./build/insights --use-libc++ cppinsights/tests/SimpleCICompileTest.cpp | |
- name: Run tests | |
if: matrix.config.run_tests == 'Yes' | |
id: run_tests | |
shell: docker-shell {0} | |
run: | | |
cmake --build build --target tests | |
# docker-shell fails building doc with an unknown reason. Use the original container | |
- name: Make docs 1/2 | |
if: "((matrix.arch == 'amd64') && (matrix.config.docs == 'Yes'))" | |
uses: docker://andreasfertig/cppinsights-builder:latest | |
with: | |
args: | | |
/bin/bash -c "cmake --build build --target doc" | |
- name: Make docs 2/2 | |
if: "((matrix.arch == 'amd64') && (matrix.config.docs == 'Yes'))" | |
working-directory: ${{ github.workspace }}/build | |
shell: bash | |
run: | | |
sudo chown -R $(id -u):$(id -g) ${GITHUB_WORKSPACE}/build/ | |
ls -l ${GITHUB_WORKSPACE}/build/ | |
ls -l ${GITHUB_WORKSPACE}/build/html | |
mkdir -p ${GITHUB_WORKSPACE}/build/archive | |
mv ${GITHUB_WORKSPACE}/build/html ${GITHUB_WORKSPACE}/build/archive/ | |
- name: Run coverage | |
if: matrix.config.coverage == 'Yes' | |
id: run_coverage | |
shell: docker-shell {0} | |
run: | | |
cmake --build build --target coverage | |
rm -f build/coverage.info | |
- name: Upload code coverage info | |
if: matrix.config.coverage == 'Yes' | |
id: run_coverage_upload | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./build/filtered.info # don't use a absolute path on Windows with gitBash. | |
exclude: build | |
flags: ${{ matrix.config.archive_name }}-${{ matrix.arch }}-libcxx-${{ matrix.config.libcxx }} | |
disable_search: true | |
fail_ci_if_error: true | |
- name: Create archive | |
if: matrix.config.upload == 'Yes' | |
working-directory: ${{ github.workspace }}/build | |
shell: bash | |
run: | | |
mkdir -p ${GITHUB_WORKSPACE}/build/archive | |
tar -cvzf ${GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}-${{ matrix.arch }}.tar.gz ${{ matrix.config.bin_name }} | |
sha256sum ${GITHUB_WORKSPACE}/build/${{ matrix.config.bin_name }} > ${GITHUB_WORKSPACE}/build/archive/${{ matrix.config.archive_name }}-${{ matrix.arch }}.sha256 | |
- uses: actions/upload-artifact@v3 | |
if: matrix.config.upload == 'Yes' | |
with: | |
name: insights-artifact-ubuntu-${{ matrix.arch }} | |
if-no-files-found: error | |
path: | | |
${{ github.workspace }}/build/archive/* | |
#------------------------------------------------------------------------------ | |
# BUILD INSIDE DOCKER INSIDE LLVM-SOURCE-TREE | |
#------------------------------------------------------------------------------ | |
in-source-tree: | |
runs-on: ubuntu-22.04 | |
name: ${{ matrix.config.name }} LLVM source tree | |
container: | |
image: andreasfertig/cppinsights-builder | |
continue-on-error: false | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: | |
- amd64 | |
config: | |
# GCC 13 / LLVM 18 | |
- { | |
name: "GCC 13 / LLVM 18 @ Ubuntu Release", | |
build_type: Release, | |
cxx: "g++-13", | |
llvm_version: "18.1.0", | |
llvm_config: "/usr/bin/llvm-config-18", | |
coverage: "No", | |
static: "Yes", | |
debug: "No", | |
libcxx: "No", | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: cppinsights | |
- uses: actions/checkout@v4 | |
name: Checkout Clang | |
with: | |
repository: llvm/llvm-project | |
ref: llvmorg-${{ env.LLVM_VERSION }} | |
path: llvm-project | |
fetch-tags: true | |
- name: Configure | |
id: cmake_configure | |
shell: bash | |
run: | | |
mkdir build | |
cd build | |
CXX=${{ matrix.config.cxx }} | |
cmake -G Ninja -D=CMAKE_BUILD_TYPE=Release -DLLVM_EXTERNAL_PROJECTS=cppinsights -DLLVM_EXTERNAL_CPPINSIGHTS_SOURCE_DIR=${GITHUB_WORKSPACE}/cppinsights -DINSIGHTS_STATIC=${{ matrix.config.static }} -DDEBUG=${{ matrix.config.debug }} -DINSIGHTS_COVERAGE=${{ matrix.config.coverage }} -DINSIGHTS_USE_LIBCPP=${{ matrix.config.libcxx }} ${GITHUB_WORKSPACE}/llvm-project/llvm | |
# For now a successful configure is enough | |
#------------------------------------------------------------------------------ | |
# DEPLOY | |
#------------------------------------------------------------------------------ | |
deploy: | |
needs: [build, docker, in-source-tree] | |
if: github.ref == 'refs/heads/main' | |
name: Final Deploy | |
continue-on-error: false | |
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-amd64/html/. ${GITHUB_WORKSPACE}/gh-pages --delete --exclude CNAME --exclude .nojekyll --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 |