Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI #50

Merged
merged 1 commit into from
Nov 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 109 additions & 84 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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
Expand Down Expand Up @@ -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/[email protected]
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;
Expand All @@ -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 }}
Expand Down
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
cmake_minimum_required (VERSION 3.11)

set(git_version 139)
project(Diagon
LANGUAGES C CXX
VERSION 1.0.127
VERSION 1.0.${git_version}
)

option(DIAGON_BUILD_TESTS_FUZZER "Set to ON to enable fuzzing" OFF)
Expand All @@ -28,7 +29,7 @@ endif()

FetchContent_Declare(antlr
GIT_REPOSITORY https://github.com/antlr/antlr4
GIT_TAG 4.8
GIT_TAG 4.11.1
GIT_PROGRESS TRUE
)

Expand Down
38 changes: 19 additions & 19 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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(<file.g4>)
Expand All @@ -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()
Loading