feat: ordered maps #58
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: C++ build | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
matrix: | |
config: | |
- name: "Ubuntu" | |
os: ubuntu-latest | |
build_type: "Release" | |
cc: "gcc-11" | |
cxx: "g++-11" | |
generators: "Ninja" | |
coveralls: true | |
- name: "Ubuntu (Clang)" | |
os: ubuntu-latest | |
build_type: "Release" | |
cc: "clang-12" | |
cxx: "clang++-12" | |
generators: "Ninja" | |
coveralls: false | |
- name: "Windows" | |
os: windows-latest | |
build_type: "Release" | |
generators: "Visual Studio 17 2022" | |
gen_arch: "x64" | |
coveralls: false | |
- name: "macOS" | |
os: macos-latest | |
build_type: "Release" | |
cc: "clang" | |
cxx: "clang++" | |
generators: "Ninja" | |
coveralls: false | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: ${{ matrix.config.build_type }} | |
CC: ${{ matrix.config.cc }} | |
CXX: ${{ matrix.config.cxx }} | |
COV: ${{ matrix.config.coveralls }} | |
COV_UP: ${{ github.event_name == 'push' && matrix.config.coveralls }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Get compilers (GCC/Ubuntu) | |
if: ${{ startsWith(matrix.config.os, 'ubuntu-') && startsWith(matrix.config.cc, 'gcc-') }} | |
run: | | |
sudo apt update | |
sudo apt install ${{env.CC}} ${{env.CXX}} | |
shell: bash | |
- name: Get compilers (Clang/Ubuntu) | |
if: ${{ startsWith(matrix.config.os, 'ubuntu-') && startsWith(matrix.config.cc, 'clang-') }} | |
run: | | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-12 main" | sudo tee /etc/apt/sources.list.d/llvm.list | |
sudo apt update | |
sudo apt install ${{ env.CC }} | |
shell: bash | |
- name: Add MSBuild to PATH (Windows) | |
if: startsWith(matrix.config.os, 'windows-') | |
uses: microsoft/setup-msbuild@v1.0.2 | |
- name: Get Ninja | |
if: ${{ matrix.config.generators }} == "Ninja" | |
uses: turtlesec-no/get-ninja@1.0.0 | |
- name: Get Conan | |
uses: turtlebrowser/get-conan@v1.0 | |
- name: Configure Conan (GCC/Clang) | |
if: ${{startsWith(matrix.config.cc, 'gcc-') || (startsWith(matrix.config.os, 'ubuntu-') && startsWith(matrix.config.cc, 'clang-')) }} | |
run: | | |
conan install "${{github.workspace}}" -if "${{github.workspace}}/build" --build missing -s build_type=${{env.BUILD_TYPE}} | |
conan profile update settings.compiler.libcxx=libstdc++11 default | |
- name: Configure Conan | |
run: conan install "${{github.workspace}}" -if "${{github.workspace}}/build" --build missing -s build_type=${{env.BUILD_TYPE}} | |
- name: Configure CMake | |
run: cmake -G "${{ matrix.config.generators }}" -A "${{ matrix.config.gen_arch }}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DJSON_TESTING=ON -DJSON_COVERALLS=${{env.COV}} -DJSON_COVERALLS_UPLOAD=${{env.COV_UP}} -DJSON_COVERALLS_DEBUG=${{env.COV}} | |
- name: Build | |
run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --parallel | |
- name: Test | |
if: ${{ !matrix.config.coveralls || github.event_name != 'push' }} | |
working-directory: ${{github.workspace}}/build | |
run: ctest -C ${{env.BUILD_TYPE}} | |
- name: Coveralls | |
if: ${{ matrix.config.coveralls && github.event_name == 'push' }} | |
working-directory: ${{github.workspace}}/build | |
run: cmake --build . --config ${{env.BUILD_TYPE}} --target JSON_coveralls --parallel | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
- name: Upload tests results | |
if: $${{ success() || failure() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: test-xml | |
path: ${{github.workspace}}/build/testing-results/*.xml | |
publish-test-results: | |
name: Publish tests results | |
needs: build | |
runs-on: ubuntu-latest | |
if: $${{ success() || failure() }} | |
steps: | |
- name: Download XML Files | |
uses: actions/download-artifact@v2 | |
with: | |
path: artifacts | |
- name: Publish results | |
uses: EnricoMi/publish-unit-test-result-action@v1 | |
with: | |
files: artifacts/**/*.xml |