From 70d6dd601d0dfe9e0800e5e9fff3c219e68776be Mon Sep 17 00:00:00 2001 From: ArthurSonzogni Date: Sun, 20 Nov 2022 12:56:43 +0100 Subject: [PATCH] Update CI --- .github/workflows/continuous-integration.yaml | 193 ++++++++++-------- .travis.yml | 39 ---- CMakeLists.txt | 2 +- tools/CMakeLists.txt | 38 ++-- tools/download_and_patch.sh | 9 - 5 files changed, 129 insertions(+), 152 deletions(-) delete mode 100644 .travis.yml delete mode 100755 tools/download_and_patch.sh diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index f824235..8ec3476 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -15,87 +15,93 @@ jobs: test: name: "Tests" strategy: + fail-fast: false matrix: include: - name: "Linux GCC" os: ubuntu-latest - cc: gcc - cxx: g++ + compiler: gcc test: true - cmake: cmake - name: "Linux Clang" os: ubuntu-latest - cc: clang - cxx: clang++ + compiler: llvm test: true - cmake: cmake - name: "Linux emscripten" os: ubuntu-latest - cc: emcc - cxx: "em++" - test: false - cmake: "emcmake cmake" + emscripten: true - - name: "MacOS GCC" + - name: "MacOS clang" os: macos-latest - cc: /usr/local/opt/gcc/bin/gcc-11 - cxx: /usr/local/opt/gcc/bin/g++-11 - test: true - cmake: cmake - - #- name: "Windows MSVC" - #os: windows-latest - #cc: cl - #cxx: cl - #test: false - #cmake: cmake + compiler: llvm runs-on: ${{ matrix.os }} steps: - name: "Checkout repository" uses: actions/checkout@v2 - - name: "Enable MSVC command prompt" - if: matrix.os == 'windows-latest' - uses: ilammy/msvc-dev-cmd@v1 - - - name: "Install cmake" - uses: lukka/get-cmake@latest + - name: "Setup Cpp" + uses: aminya/setup-cpp@v1 + with: + compiler: ${{ matrix.compiler }} + vcvarsall: ${{ contains(matrix.os, 'windows' )}} + cmake: true + ninja: true + clangtidy: false + cppcheck: false + gcovr: "5.0" + opencppcoverage: false + + - name: "Setup Java" + uses: actions/setup-java@v3 + if: ${{ runner.os == 'macOS' }} + with: + distribution: "temurin" + java-version: '17' + check-latest: true - name: "Install Linux Dependencies" - if: runner.os == 'Linux' + if: ${{ runner.os == 'Linux' }} run: sudo apt install libboost-graph-dev uuid-dev - name: "Install boost for windows" - if: runner.os == 'Windows' + if: ${{ runner.os == 'Windows' }} uses: MarkusJx/install-boost@v1.0.1 with: boost_version: 1.73.0 - name: "Install dependencies for macOS" - if: runner.os == 'macOS' + if: ${{ runner.os == 'macOS' }} run: | brew install gcc brew install boost - name: "Setup Emscripten" - if: ${{ matrix.cc == 'emcc' }} + if: ${{ matrix.emscripten }} uses: mymindstorm/setup-emsdk@v7 - - name: "Build debug mode" + - name: "Configure cmake with emscripten" + if: ${{ matrix.emscripten }} run: > - mkdir build; - cd build; - ${{ matrix.cmake }} .. - -DCMAKE_BUILD_TYPE=Debug - -DCMAKE_C_COMPILER=${{ matrix.cc }} - -DCMAKE_CXX_COMPILER=${{ matrix.cxx }}; - cmake --build . --config Release + emcmake cmake -S . + -B ./build + -DCMAKE_BUILD_TYPE:STRING=Debug; + + - name: "Configure CMake" + if: ${{ !matrix.emscripten }} + run: > + cmake -S . + -B ./build + -DCMAKE_BUILD_TYPE:STRING=Debug; + + - name: "Build" + run: > + cmake + --build ./build - name: "Run tests" - if: matrix.test + if: ${{ matrix.test }} run: > cd build; ./input_output_test @@ -126,81 +132,100 @@ jobs: include: - name: "Linux Clang" os: ubuntu-latest - cc: clang - cxx: clang++ - cmake: cmake + compiler: llvm asset_path: build/diagon*Linux* - name: "Linux emscripten" os: ubuntu-latest - cc: emcc - cxx: em++ - cmake: "emcmake cmake" + compiler: llvm + emscripten: true asset_path: build/diagon-Web.zip - #- name: "MacOS clang" - #os: macos-latest - #cc: clang - #cxx: clang++ - #test: true - #cmake: cmake - #asset_path: build/diagon*Darwin* - - #- name: "Windows MSVC" - #os: windows-latest - #cc: cl - #cxx: cl - #test: false - #cmake: cmake - #asset_path: build/diagon*Win64* + - name: "MacOS" + os: macos-latest + compiler: llvm + asset_path: build/ftxui*Darwin* + + - name: "Windows" + os: windows-latest + compiler: cl + asset_path: build/ftxui*Win64* runs-on: ${{ matrix.os }} steps: - name: "Checkout repository" uses: actions/checkout@v2 - - name: "Enable MSVC command prompt" - if: matrix.os == 'windows-latest' - uses: ilammy/msvc-dev-cmd@v1 - - - name: "Install cmake" - uses: lukka/get-cmake@latest + - name: "Setup Cpp" + uses: aminya/setup-cpp@v1 + with: + compiler: ${{ matrix.compiler }} + vcvarsall: ${{ contains(matrix.os, 'windows' )}} + cmake: true + ninja: true + clangtidy: false + cppcheck: false + gcovr: "5.0" + opencppcoverage: false + + - name: "Setup Java" + uses: actions/setup-java@v3 + if: ${{ runner.os == 'macOS' }} + with: + distribution: "temurin" + java-version: '17' + check-latest: true - name: "Install Linux Dependencies" - if: runner.os == 'Linux' - run: sudo apt install libboost-graph-dev uuid-dev zip + if: ${{ runner.os == 'Linux' }} + run: sudo apt install libboost-graph-dev uuid-dev - name: "Install boost for windows" - if: runner.os == 'Windows' + if: ${{ runner.os == 'Windows' }} uses: MarkusJx/install-boost@v1.0.1 with: boost_version: 1.73.0 + - name: "Install dependencies for macOS" + if: ${{ runner.os == 'macOS' }} + run: | + brew install gcc + brew install boost + - name: "Setup Emscripten" - if: ${{ matrix.cc == 'emcc' }} + if: ${{ matrix.emscripten }} uses: mymindstorm/setup-emsdk@v7 - - name: "Build release mode" + - name: "Configure cmake with emscripten" + if: ${{ matrix.emscripten }} run: > - mkdir build; - cd build; - ${{ matrix.cmake }} .. - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_C_COMPILER=${{ matrix.cc }} - -DCMAKE_CXX_COMPILER=${{ matrix.cxx }}; - cmake --build . --config Release; - make package; + emcmake cmake -S . + -B ./build + -DCMAKE_BUILD_TYPE:STRING=Release; + + - name: "Configure CMake" + if: ${{ !matrix.emscripten }} + run: > + cmake -S . + -B ./build + -DCMAKE_BUILD_TYPE:STRING=Release; + + - name: "Build" + run: > + cmake + --build ./build + --target package; - name: "Upload native binaries" uses: shogo82148/actions-upload-release-asset@v1 - if: ${{ matrix.cc != 'emcc'}} + if: ${{ !matrix.emscripten }} with: upload_url: ${{ needs.release.outputs.upload_url }} asset_path: ${{ matrix.asset_path }} overwrite: true - name: "Make webAssembly distribution" - if: ${{ matrix.cc == 'emcc' }} + if: ${{ matrix.emscripten }} run: > cd build; mkdir -p diagon-Web; @@ -213,7 +238,7 @@ jobs: zip -r diagon-Web.zip diagon-Web; - name: "Upload WebAssembly distribution" - if: ${{ matrix.cc == 'emcc' }} + if: ${{ matrix.emscripten }} uses: shogo82148/actions-upload-release-asset@v1 with: upload_url: ${{ needs.release.outputs.upload_url }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 565b124..0000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -sudo: false - -language: - - cpp - -script: - - mkdir build - - cd build - - cmake .. - - cmake --build . - -notifications: - email: false - -addons: - apt: - sources: - - sourceline: "deb http://archive.ubuntu.com/ubuntu/ xenial multiverse" - - sourceline: "deb http://archive.ubuntu.com/ubuntu/ xenial-backports universe" - packages: - - libboost-graph-dev - -jobs: - include: - # Ubuntu - - os: linux - dist: bionic - compiler: gcc - - # Ubuntu - - os: linux - dist: bionic - compiler: clang - - # OS X - - os: osx - - # Windows - - os: windows diff --git a/CMakeLists.txt b/CMakeLists.txt index 3130487..3ee4e95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ endif() FetchContent_Declare(antlr GIT_REPOSITORY https://github.com/antlr/antlr4 - GIT_TAG 4.8 + GIT_TAG 4.11.1 GIT_PROGRESS TRUE ) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 6f50b4b..4724c28 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,12 +1,12 @@ -set(DIAGON_TOOLS_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "") - # ┌─────────────────────────────────────────────────┐ # │ ANTLR │ # └─────────────────────────────────────────────────┘ -execute_process( - COMMAND bash download_and_patch.sh - WORKING_DIRECTORY ${DIAGON_TOOLS_DIR} -) +if(NOT EXISTS "${CMAKE_BINARY_DIR}/antlr.jar") + execute_process( + COMMAND curl http://www.antlr.org/download/antlr-4.11.1-complete.jar -L -o antlr.jar + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + ) +endif() # Function # ANTLR() @@ -26,20 +26,20 @@ function(ANTLR source) get_filename_component(source_gen_dir ${CMAKE_CURRENT_BINARY_DIR}/${source} DIRECTORY) add_custom_command( OUTPUT - ${source_gen_dir}/${source_filename}Lexer.cpp - ${source_gen_dir}/${source_filename}Parser.cpp - ${source_gen_dir}/${source_filename}Lexer.h - ${source_gen_dir}/${source_filename}Parser.h + ${source_gen_dir}/${source_filename}Lexer.cpp + ${source_gen_dir}/${source_filename}Parser.cpp + ${source_gen_dir}/${source_filename}Lexer.h + ${source_gen_dir}/${source_filename}Parser.h COMMAND - java + java ARGS - -jar ${DIAGON_TOOLS_DIR}/antlr.jar - -Dlanguage=Cpp - -no-listener - -no-visitor - -o ${source_gen_dir} - ${source_src_dir}/${source_filename}.g4 + -jar ${CMAKE_BINARY_DIR}/antlr.jar + -Dlanguage=Cpp + -no-listener + -no-visitor + -o ${source_gen_dir} + ${source_src_dir}/${source_filename}.g4 MAIN_DEPENDENCY - ${source_src_dir}/${source_filename}.g4 - ) + ${source_src_dir}/${source_filename}.g4 + ) endfunction() diff --git a/tools/download_and_patch.sh b/tools/download_and_patch.sh deleted file mode 100755 index dbf989f..0000000 --- a/tools/download_and_patch.sh +++ /dev/null @@ -1,9 +0,0 @@ -cd "$(dirname "$0")" -top=$(pwd) - -if [[ -f "antlr.jar" ]] -then - exit -else - curl http://www.antlr.org/download/antlr-4.8-complete.jar -L -o antlr.jar -fi