command_line/arguments: Cleaned up the formatting of the parseArgumen… #807
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: GitHub Actions | |
on: | |
push: | |
branches-ignore: | |
- 'coverityScan' | |
pull_request: | |
branches: | |
- 'main' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-linux: | |
name: '${{ matrix.os.id }} (${{ matrix.compiler }}, ${{ matrix.cpp_std }})' | |
runs-on: ${{ matrix.os.id }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
matrix: | |
os: | |
- { id: ubuntu-20.04, name: focal } | |
compiler: | |
- 'clang-9' | |
- 'clang-10' | |
- 'clang-11' | |
- 'clang-12' | |
- 'clang-13' | |
- 'clang-14' | |
- 'clang-15' | |
- 'gcc-7' | |
- 'gcc-8' | |
- 'gcc-9' | |
- 'gcc-10' | |
- 'gcc-11' | |
cpp_std: | |
- 11 | |
- 14 | |
- 17 | |
include: | |
- os: { id: ubuntu-20.04, name: focal } | |
compiler: 'clang-15' | |
cpp_std: 20 | |
- os: { id: ubuntu-20.04, name: focal } | |
compiler: 'gcc-11' | |
cpp_std: 20 | |
fail-fast: false | |
steps: | |
- name: Runtime environment | |
env: | |
WORKSPACE: ${{ github.workspace }} | |
run: | | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV | |
- name: Setup GCC | |
if: startsWith(matrix.compiler, 'gcc') | |
run: | | |
CXX=${CC/#gcc/g++} | |
sudo apt-add-repository ppa:ubuntu-toolchain-r/test | |
sudo apt-get update | |
sudo apt-get install $CC $CXX | |
echo "CC=$CC" >> $GITHUB_ENV | |
echo "CXX=$CXX" >> $GITHUB_ENV | |
echo "GCOV=${CC/#gcc/gcov}" >> $GITHUB_ENV | |
env: | |
CC: ${{ matrix.compiler }} | |
- name: Setup Clang | |
if: startsWith(matrix.compiler, 'clang') | |
run: | | |
wget https://apt.llvm.org/llvm-snapshot.gpg.key | |
sudo apt-key add llvm-snapshot.gpg.key | |
rm llvm-snapshot.gpg.key | |
sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os.name }}/ llvm-toolchain-${{ matrix.os.name }}${CC/#clang/} main" | |
sudo apt-get update | |
sudo apt-get install $CC | |
CXX=${CC/#clang/clang++} | |
echo "CC=$CC" >> $GITHUB_ENV | |
echo "CXX=$CXX" >> $GITHUB_ENV | |
echo "GCOV=/usr/lib/${CC/#clang/llvm}/bin/llvm-cov gcov" >> $GITHUB_ENV | |
env: | |
CC: ${{ matrix.compiler }} | |
working-directory: ${{ runner.temp }} | |
- name: Add coverage dependency | |
if: matrix.compiler == 'clang-14' | |
run: | | |
apt download libclang-rt-14-dev | |
PACKAGE=$(find . -name 'libclang-rt-14*.deb') | |
sudo dpkg --install --force-breaks $PACKAGE | |
working-directory: ${{ runner.temp }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
submodules: true | |
- name: Setup Meson + Ninja + gcovr | |
run: | | |
sudo python3 -m pip install --upgrade pip setuptools wheel | |
sudo python3 -m pip install meson ninja gcovr | |
working-directory: ${{ runner.temp }} | |
- name: Version tools | |
run: | | |
$CC --version | |
$CXX --version | |
$GCOV --version | |
meson --version | |
ninja --version | |
- name: Configure | |
run: meson setup build --prefix=$HOME/.local -Dcpp_std=c++${{ matrix.cpp_std }} $BUILD_OPTS | |
- name: Build | |
run: meson compile -C build | |
- name: Test | |
if: matrix.cpp_std > 11 | |
run: meson test -C build | |
- name: Install | |
run: meson install -C build | |
- name: Run coverage build | |
if: github.repository == 'bad-alloc-heavy-industries/substrate' && matrix.cpp_std > 11 | |
# Codecov no longer parses gcov files automatically | |
run: | | |
rm -rf build | |
meson setup build --prefix=$HOME/.local -Dcpp_std=c++${{ matrix.cpp_std }} -Db_coverage=true --buildtype=debug | |
meson compile -C build | |
meson test -C build | |
ninja -C build coverage-xml | |
- name: Upload failure logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs-${{ matrix.os.id }}-${{ matrix.cpp_std }} | |
path: ${{ github.workspace }}/build/meson-logs/* | |
retention-days: 5 | |
- name: Codecov | |
if: success() && github.repository == 'bad-alloc-heavy-industries/substrate' && matrix.cpp_std > 11 | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: ./build/meson-logs/ | |
files: coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
build-windows: | |
name: '${{ matrix.os }} (msvc, ${{ matrix.cpp_std }})' | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: pwsh | |
strategy: | |
matrix: | |
os: | |
- windows-2019 | |
- windows-2022 | |
cpp_std: | |
- 14 | |
- 17 | |
include: | |
- os: windows-2022 | |
cpp_std: 20 | |
fail-fast: false | |
steps: | |
- name: Runtime environment | |
env: | |
WORKSPACE: ${{ github.workspace }} | |
run: | | |
echo "$HOME\\.local\\bin" >> $GITHUB_PATH | |
echo "GITHUB_WORKSPACE=$(pwd)" >> $GITHUB_ENV | |
- name: Setup compiler | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: x86_64 | |
- name: Install OpenCppCoverage | |
if: github.repository == 'bad-alloc-heavy-industries/substrate' | |
uses: crazy-max/ghaction-chocolatey@v2.1.0 | |
with: | |
args: install OpenCppCoverage | |
- name: Setup OpenCppCoverage | |
if: github.repository == 'bad-alloc-heavy-industries/substrate' && matrix.cpp_std > 11 | |
run: | | |
echo "C:/Program Files/OpenCppCoverage" >> $env:GITHUB_PATH | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
submodules: true | |
- name: Setup Meson + Ninja | |
run: | | |
python3 -m pip install --upgrade pip setuptools wheel | |
python3 -m pip install meson ninja | |
working-directory: ${{ runner.temp }} | |
- name: Version tools | |
run: | | |
cl /Bv | |
link | |
meson --version | |
ninja --version | |
- name: Configure | |
run: meson setup build --prefix=$HOME/.local -Dcpp_std=c++${{ matrix.cpp_std }} $BUILD_OPTS | |
- name: Build | |
run: meson compile -C build | |
- name: Test | |
if: matrix.cpp_std > 11 | |
run: meson test -C build | |
- name: Install | |
run: meson install -C build | |
- name: Run coverage build | |
if: github.repository == 'bad-alloc-heavy-industries/substrate' && matrix.cpp_std > 11 | |
run: | | |
Remove-Item -Recurse build | |
meson setup build --prefix=$HOME/.local -Dcpp_std=c++${{ matrix.cpp_std }} -Db_coverage=true --buildtype=debug -Ddefault_library=static | |
meson compile -C build | |
meson test -C build | |
- name: Upload failure logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs-${{ matrix.os }}-${{ matrix.cpp_std }} | |
path: | | |
${{ github.workspace }}/build/meson-logs | |
${{ github.workspace }}/build/test | |
retention-days: 5 | |
- name: Codecov | |
if: success() && github.repository == 'bad-alloc-heavy-industries/substrate' && matrix.cpp_std > 11 | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
build-windows-mingw: | |
name: '${{ matrix.os }} (${{ matrix.sys }}, ${{ matrix.cpp_std }})' | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: msys2 {0} | |
strategy: | |
matrix: | |
os: | |
- windows-2019 | |
sys: | |
- mingw64 | |
- ucrt64 | |
- clang64 | |
cpp_std: | |
- 11 | |
- 14 | |
- 17 | |
- 20 | |
fail-fast: false | |
steps: | |
- name: Use MinGW from MSYS | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.sys }} | |
update: true | |
path-type: inherit | |
pacboy: >- | |
toolchain:p | |
lcov:p | |
- name: Runtime environment | |
env: | |
WORKSPACE: ${{ github.workspace }} | |
run: | | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV | |
- name: Setup compiler | |
if: startsWith(matrix.sys, 'mingw') || startsWith(matrix.sys, 'ucrt64') | |
run: | | |
echo "GCOV=gcov" >> $GITHUB_ENV | |
- name: Setup compiler | |
if: startsWith(matrix.sys, 'clang') | |
run: | | |
echo "GCOV=llvm-cov gcov" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
submodules: true | |
- name: Setup Meson + Ninja | |
shell: bash | |
run: | | |
python3 -m pip install --upgrade pip setuptools wheel | |
python3 -m pip install meson ninja gcovr | |
working-directory: ${{ runner.temp }} | |
- name: Version tools | |
run: | | |
cc --version | |
c++ --version | |
$GCOV --version | |
meson --version | |
ninja --version | |
- name: Configure | |
run: meson setup build --prefix=$HOME/.local -Dcpp_std=c++${{ matrix.cpp_std }} $BUILD_OPTS | |
- name: Build | |
run: meson compile -C build | |
- name: Test | |
if: matrix.cpp_std > 11 | |
run: meson test -C build | |
- name: Install | |
run: ninja -C build install | |
- name: Run coverage build | |
if: github.repository == 'bad-alloc-heavy-industries/substrate' && matrix.cpp_std > 11 | |
# Codecov no longer parses gcov files automatically | |
run: | | |
rm -rf build | |
meson setup build --prefix=$HOME/.local -Dcpp_std=c++${{ matrix.cpp_std }} -Db_coverage=true --buildtype=debug | |
meson compile -C build | |
meson test -C build | |
ninja -C build coverage-xml | |
- name: Upload failure logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs-${{ matrix.os }}-${{ matrix.sys }}-${{ matrix.cpp_std }} | |
path: ${{ github.workspace }}/build/meson-logs/* | |
retention-days: 5 | |
- name: Codecov | |
if: success() && github.repository == 'bad-alloc-heavy-industries/substrate' && matrix.cpp_std > 11 | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: ./build/meson-logs/ | |
files: coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
build-macos: | |
name: '${{ matrix.os }} (${{ matrix.cpp_std }})' | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
matrix: | |
os: | |
- macos-12 | |
- macos-11 | |
cpp_std: | |
- 11 | |
- 14 | |
- 17 | |
build_opts: | |
- '' | |
include: | |
- os: macos-latest | |
cpp_std: 17 | |
build_opts: '-Db_lto=true -Ddefault_library=static' | |
fail-fast: false | |
steps: | |
- name: Runtime environment | |
env: | |
WORKSPACE: ${{ github.workspace }} | |
run: | | |
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV | |
- name: Setup tools | |
if: github.repository == 'bad-alloc-heavy-industries/substrate' | |
run: | | |
brew install gcovr | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
submodules: true | |
- name: Setup Meson + Ninja | |
run: | | |
brew install meson ninja | |
working-directory: ${{ runner.temp }} | |
- name: Version tools | |
run: | | |
cc --version || true | |
ld --version || true | |
gcov --version || true | |
meson --version | |
ninja --version | |
- name: Configure | |
run: meson setup build --prefix=$HOME/.local -Db_coverage=true -Dcpp_std=c++${{ matrix.cpp_std }} ${{ matrix.build_opts }} | |
- name: Build | |
run: meson compile -C build | |
- name: Test | |
if: matrix.cpp_std > 11 | |
run: meson test -C build | |
- name: Install | |
run: ninja -C build install | |
- name: Run coverage build | |
if: github.repository == 'bad-alloc-heavy-industries/substrate' && matrix.cpp_std > 11 | |
# Codecov no longer parses gcov files automatically | |
run: | | |
rm -rf build | |
meson setup build --prefix=$HOME/.local -Dcpp_std=c++${{ matrix.cpp_std }} -Db_coverage=true --buildtype=debug | |
meson compile -C build | |
meson test -C build | |
ninja -C build coverage-xml | |
- name: Upload failure logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs-${{ matrix.os }}-${{ matrix.cpp_std }} | |
path: ${{ github.workspace }}/build/meson-logs/* | |
retention-days: 5 | |
- name: Codecov | |
if: success() && github.repository == 'bad-alloc-heavy-industries/substrate' && matrix.cpp_std > 11 | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: ./build/meson-logs/ | |
files: coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
build-macos-homebrew: | |
# Apple LLD is unable to link GCC < 11 generated object files. | |
# https://stackoverflow.com/questions/73714336/xcode-update-to-version-2395-ld-compile-problem-occurs-computedatomcount-m | |
# rdar://FB11369327 | |
name: '${{ matrix.os }} (homebrew, ${{ matrix.compiler }}, ${{ matrix.cpp_std }})' | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
matrix: | |
os: | |
- macos-11 | |
compiler: | |
## GCC5 cannot compile anything on macOS | |
# - gcc@5 | |
## GCC6 cannot handle constexpr-ness of mmap_t | |
## See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66297 | |
# - gcc@6 | |
- gcc@7 | |
- gcc@8 | |
- gcc@9 | |
- gcc@10 | |
- gcc@11 | |
- gcc | |
cpp_std: | |
- 11 | |
- 14 | |
- 17 | |
include: | |
- os: macos-11 | |
compiler: gcc | |
cpp_std: 20 | |
fail-fast: false | |
steps: | |
- name: Runtime environment | |
env: | |
WORKSPACE: ${{ github.workspace }} | |
run: | | |
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV | |
- name: Setup compiler | |
run: | | |
brew install ${{ matrix.compiler }} gcovr | |
CC=${COMPILER/@/-} | |
CXX=${CC/#gcc/g++} | |
echo "CC=$CC" >> $GITHUB_ENV | |
echo "CXX=$CXX" >> $GITHUB_ENV | |
echo "GCOV=${CC/#gcc/gcov}" >> $GITHUB_ENV | |
env: | |
COMPILER: ${{ matrix.compiler }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
submodules: true | |
- name: Setup Meson + Ninja | |
run: | | |
brew install meson ninja | |
working-directory: ${{ runner.temp }} | |
- name: Version tools | |
shell: bash | |
run: | | |
$CC --version | |
$CXX --version | |
$GCOV --version | |
meson --version | |
ninja --version | |
- name: Configure | |
run: meson setup build --prefix=$HOME/.local -Dcpp_std=c++${{ matrix.cpp_std }} $BUILD_OPTS | |
- name: Build | |
run: meson compile -C build | |
- name: Test | |
if: matrix.cpp_std > 11 | |
run: meson test -C build | |
- name: Install | |
run: ninja -C build install | |
- name: Run coverage build | |
if: github.repository == 'bad-alloc-heavy-industries/substrate' && matrix.cpp_std > 11 | |
# Codecov no longer parses gcov files automatically | |
run: | | |
rm -rf build | |
meson setup build --prefix=$HOME/.local -Dcpp_std=c++${{ matrix.cpp_std }} -Db_coverage=true --buildtype=debug | |
meson compile -C build | |
meson test -C build | |
ninja -C build coverage-xml | |
- name: Upload failure logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs-${{ matrix.os }}-homebrew-${{ matrix.compiler }}-${{ matrix.cpp_std }} | |
path: ${{ github.workspace }}/build/meson-logs/* | |
retention-days: 5 | |
- name: Codecov | |
if: success() && github.repository == 'bad-alloc-heavy-industries/substrate' && matrix.cpp_std > 11 | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: ./build/meson-logs/ | |
files: coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} |