Update safe_from_reference docs #629
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: [main] | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
#- { | |
# name: "Windows MSVC", | |
# artifact: "Windows-MSVC.tar.xz", | |
# # MSVC 17.6.3 can no longer build Subspace. 16 doesn't work either. | |
# # https://developercommunity.visualstudio.com/t/Update-to-1763-now-rejects-valid-C-i/10394500 | |
# os: windows-latest, | |
# build_type: "Release", | |
# cc: "cl", | |
# cxx: "cl", | |
# environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
# } | |
#- { | |
# name: "Windows MinGW", artifact: "Windows-MinGW.tar.xz", | |
# os: windows-latest, | |
# build_type: "Release", cc: "gcc", cxx: "g++" | |
# } | |
- { | |
name: "Ubuntu Clang-16 Debug", | |
os: ubuntu-latest, | |
build_type: "Debug", | |
cc: "clang-16", | |
cxx: "clang++-16", | |
clang_version: 16, | |
installed_clang_version: 14 | |
} | |
- { | |
name: "Ubuntu Clang-17 Debug", | |
os: ubuntu-latest, | |
build_type: "Debug", | |
cc: "clang-17", | |
cxx: "clang++-17", | |
clang_version: 17, | |
installed_clang_version: 14 | |
} | |
- { | |
name: "Ubuntu Clang-17 Sanitizer", | |
os: ubuntu-latest, | |
build_type: "Release", | |
cc: "clang-17", | |
cxx: "clang++-17", | |
clang_version: 17, | |
installed_clang_version: 14 | |
} | |
- { | |
name: "Ubuntu Clang-18 Debug", | |
os: ubuntu-latest, | |
build_type: "Debug", | |
cc: "clang-18", | |
cxx: "clang++-18", | |
clang_version: 18, | |
installed_clang_version: 14 | |
} | |
- { | |
name: "Ubuntu GCC", | |
os: ubuntu-latest, | |
build_type: "Release", | |
cc: "gcc-13", | |
cxx: "g++-13", | |
clang_version: 18, | |
installed_clang_version: 14 | |
} | |
# Clang doesn't have good enough C++20 support to compile this library | |
# yet. | |
#- { | |
# name: "macOS Latest Clang", | |
# artifact: "macOS.tar.xz", | |
# os: macos-latest, | |
# build_type: "Release", | |
# cc: "clang", | |
# cxx: "clang++", | |
# } | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Install LLVM+Clang | |
if: startsWith(matrix.config.os, 'ubuntu-') | |
run: | | |
sudo apt-get remove clang-${{matrix.config.installed_clang_version}} \ | |
lldb-${{matrix.config.installed_clang_version}} \ | |
lld-${{matrix.config.installed_clang_version}} \ | |
clangd-${{matrix.config.installed_clang_version}} \ | |
clang-tidy-${{matrix.config.installed_clang_version}} \ | |
clang-format-${{matrix.config.installed_clang_version}} \ | |
clang-tools-${{matrix.config.installed_clang_version}} \ | |
llvm-${{matrix.config.installed_clang_version}}-dev \ | |
lld-${{matrix.config.installed_clang_version}} \ | |
lldb-${{matrix.config.installed_clang_version}} \ | |
llvm-${{matrix.config.installed_clang_version}}-tools \ | |
libomp-${{matrix.config.installed_clang_version}}-dev \ | |
libc++-${{matrix.config.installed_clang_version}}-dev \ | |
libc++abi-${{matrix.config.installed_clang_version}}-dev \ | |
libclang-common-${{matrix.config.installed_clang_version}}-dev \ | |
libclang-${{matrix.config.installed_clang_version}}-dev \ | |
libclang-cpp${{matrix.config.installed_clang_version}}-dev \ | |
libunwind-${{matrix.config.installed_clang_version}}-dev | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh ${{matrix.config.clang_version}} all | |
- name: Install GCC 13 | |
if: matrix.config.name == 'Ubuntu GCC' | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa | |
sudo apt update | |
sudo apt-get install g++-13 | |
echo "CXXFLAGS=$CXXFLAGS" >> $GITHUB_ENV | |
# vptr is incompatible with no-rtti. We turn off rtti to match the LLVM libraries. | |
- name: Set Sanitizer Flags | |
if: endsWith(matrix.config.name, 'Sanitizer') | |
run: | | |
echo "CFLAGS=$CFLAGS -fsanitize=address -fsanitize=undefined -fno-sanitize=vptr" >> $GITHUB_ENV | |
echo "CXXFLAGS=$CXXFLAGS -fsanitize=address -fsanitize=undefined -fno-sanitize=vptr" >> $GITHUB_ENV | |
- name: Download Ninja | |
id: ninja | |
shell: cmake -P {0} | |
run: | | |
set(ninja_version "1.11.1") | |
if ("${{ runner.os }}" STREQUAL "Windows") | |
set(ninja_suffix "win.zip") | |
elseif ("${{ runner.os }}" STREQUAL "Linux") | |
set(ninja_suffix "linux.zip") | |
elseif ("${{ runner.os }}" STREQUAL "macOS") | |
set(ninja_suffix "mac.zip") | |
endif() | |
set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}") | |
file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip) | |
if (NOT "${{ runner.os }}" STREQUAL "Windows") | |
execute_process( | |
COMMAND chmod +x ninja | |
) | |
endif() | |
- name: Configure | |
shell: cmake -P {0} | |
run: | | |
set(ENV{CC} ${{ matrix.config.cc }}) | |
set(ENV{CXX} ${{ matrix.config.cxx }}) | |
set(HAS_LLVM ON) | |
if (NOT "${{ runner.os }}" STREQUAL "Windows") | |
# Path to LLVM+Clang nightly that we have installed. | |
set(ENV{LLVM_DIR} "/usr/lib/llvm-${{matrix.config.clang_version}}/lib/cmake/llvm") | |
set(ENV{Clang_DIR} "/usr/lib/llvm-${{matrix.config.clang_version}}/lib/cmake/clang") | |
else() | |
# We don't have a copy of LLVM+Clang on the Windows bot. | |
set(HAS_LLVM OFF) | |
endif() | |
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") | |
execute_process( | |
COMMAND "${{ matrix.config.environment_script }}" && set | |
OUTPUT_FILE environment_script_output.txt | |
) | |
file(STRINGS environment_script_output.txt output_lines) | |
foreach(line IN LISTS output_lines) | |
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") | |
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") | |
endif() | |
endforeach() | |
endif() | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/ninja" ninja_program) | |
execute_process( | |
COMMAND cmake | |
-S . | |
-B out | |
-D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }} | |
-D CMAKE_EXPORT_COMPILE_COMMANDS=1 | |
-G Ninja | |
-D CMAKE_MAKE_PROGRAM=${ninja_program} | |
-D SUBSPACE_BUILD_TESTS=ON | |
-D SUBSPACE_BUILD_SUBDOC=${HAS_LLVM} | |
-D SUBSPACE_BUILD_BENCHMARKS=ON | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Build | |
shell: cmake -P {0} | |
run: | | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") | |
file(STRINGS environment_script_output.txt output_lines) | |
foreach(line IN LISTS output_lines) | |
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") | |
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") | |
endif() | |
endforeach() | |
endif() | |
execute_process( | |
COMMAND cmake --build out -j 10 | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Run tests | |
shell: cmake -P {0} | |
run: | | |
include(ProcessorCount) | |
ProcessorCount(N) | |
execute_process( | |
COMMAND ctest -j ${N} --rerun-failed --output-on-failure | |
WORKING_DIRECTORY out | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Running tests failed!") | |
endif() | |
- name: Install Strip | |
if: matrix.config.artifact != '' | |
run: cmake --install out --prefix instdir --strip | |
- name: Pack | |
working-directory: instdir | |
if: matrix.config.artifact != '' | |
run: cmake -E tar cJfv ../${{ matrix.config.artifact }} . | |
- name: Upload | |
if: matrix.config.artifact != '' | |
uses: actions/upload-artifact@v1 | |
with: | |
path: ./${{ matrix.config.artifact }} | |
name: ${{ matrix.config.artifact }} | |
release: | |
if: contains(github.ref, 'tags/v') | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Store Release url | |
run: | | |
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url | |
- uses: actions/upload-artifact@v1 | |
with: | |
path: ./upload_url | |
name: upload_url | |
publish: | |
if: contains(github.ref, 'tags/v') | |
name: publish | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows Latest MSVC", | |
artifact: "Windows-MSVC.tar.xz", | |
os: ubuntu-latest, | |
} | |
- { | |
name: "Windows Latest MinGW", | |
artifact: "Windows-MinGW.tar.xz", | |
os: ubuntu-latest, | |
} | |
- { | |
name: "Ubuntu Latest Clang", | |
artifact: "Linux-Clang.tar.xz", | |
os: ubuntu-latest, | |
} | |
- { | |
name: "Ubuntu Latest GCC", | |
artifact: "Linux-GCC.tar.xz", | |
os: ubuntu-latest, | |
} | |
- { | |
name: "macOS Latest Clang", | |
artifact: "macOS.tar.xz", | |
os: ubuntu-latest, | |
} | |
needs: release | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v1 | |
with: | |
name: ${{ matrix.config.artifact }} | |
path: ./ | |
- name: Download URL | |
uses: actions/download-artifact@v1 | |
with: | |
name: upload_url | |
path: ./ | |
- id: set_upload_url | |
run: | | |
upload_url=`cat ./upload_url` | |
echo ::set-output name=upload_url::$upload_url | |
- name: Upload to Release | |
id: upload_to_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.set_upload_url.outputs.upload_url }} | |
asset_path: ./${{ matrix.config.artifact }} | |
asset_name: ${{ matrix.config.artifact }} | |
asset_content_type: application/x-gtar |