Skip to content

Commit 539bfb7

Browse files
committed
Add tests and set up Travis CI
1 parent 946f637 commit 539bfb7

File tree

7 files changed

+71
-5
lines changed

7 files changed

+71
-5
lines changed

.travis.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
language: cpp
2+
compiler:
3+
- gcc
4+
before_script:
5+
- mkdir build
6+
- cd build
7+
- cmake ..
8+
script:
9+
- make
10+
- make test
11+
deploy:
12+
# # Publish DevDocs to GitHub Pages
13+
# - provider: pages
14+
# skip_cleanup: true
15+
# github_token: $GITHUB_ACCESS_TOKEN
16+
# local_dir: build/docs
17+
# keep_history: true
18+
# on:
19+
# tags: true
20+
#
21+
# # Create a GitHub release
22+
# - provider: releases
23+
# api_key: $GITHUB_ACCESS_TOKEN
24+
# on:
25+
# tags: true
26+
#
27+
# # Trigger Travis CI to deploy `extractor.cpp`
28+
# - provider: script
29+
# script: .travis/extractor.sh $TRAVIS_ACCESS_TOKEN
30+
# on:
31+
# tags: true
32+
env:
33+
global:
34+
# GITHUB_ACCESS_TOKEN
35+
- secure: QhcdUIQkleuwpAH8N85I1OcKZIXY0VLQCoE5hXu+SMBKNKXK8atefgf0AyYJU0JRCen8jbq52XWqxacaE0Bv0vHhE5CiIHWK/Twkpe2bQrjV3wYnJ/+nHnzTCOw0AQzZdT9skeIrkNdnVdfJXaTaRkHFnqYaINfh+wr/SC2QOerOjdDda/DqyIHypO648KKYgTBuQQ5nXDSLMYrUCF4Siax+af4rc2C2C2ZUWC8G4q+bUlTRDUp/EKDiq5TVfV1KCbiJzO4mjiaWy97eRDNMnFrdh8cFZxazvYWWyisiTcaOGUz78PB25x0Is45axncScBhs8qSY6mQIxbb8KI5X/UxXVSF/p0sSnaqR0TYy8zgCIXU+HXaUr7MoyMBje2DGGYhJs5CvxdOcQHBEaazIbUucM4nGBm15uX9fxzvM1SWv6C+csNjkJRNd3G3/nt3egCwI4SNAz98Ei2UW8TXXdlXtEM4QiH/AGWxHxgZo6sOIZi6uREHE1OnZygS59H7bIdditRlNBDxAtBiNVDV/vK15KrMvO1VhG8XoF/Qz6VdySGfmVWg3x9A4F2UwlLXSbGWym526n9caPS4FykTuh9GbZXvATy4hweN9+VtGeD+K4ZaLjkfaCCpG0BnnHH91k4zIXALpWUL5tVNHMutiuouSExgBrSHIMsuXmNt2Zzc=
36+
# TRAVIS_ACCESS_TOKEN
37+
- secure: As4J8URDuFqgkto2gbCUYzwPFjActoPt0kUP252DYO7MYlTNyZCRPyGjmcGqTgKYj8pc2gOpd2kJ93Vvgdosy/dtxFmqf7RrLyQgCjpPqokWWrPPImEVLGQ0cHmjDesi67zxjefafo+1smF9G6Pt25+rlybLVFqBsl03FlwJ67+44okVPE80NKHJAbZ4LQeiZcBhwBqUQea2JFulQKK7l+PmgN2BBGIbE6DTmVU+XuR8fWgBdNBDqjCnO7Q/LH5ary4+3EA1UsuosWs+qqtLuixqucbSKIXtyMWbs8F8T15iY04EGlfnAIZ8LVzmFKeYiEVQw6kgxkO2zqFSRdcNlyaOWHBUAbXNSsO5Otn02vMuKp43ILCJ3chvFVseu7z//78eYi/aGJgOITIuILmXMzvma1pyRpWVrCBO3+oOtrA5/G8QoHegb7FFt0TYRZHy692wnZ2UIEOlxroEzKIErpenYjbPSnfii7cQPiE2aK2spLwG5ehGNxGkMKxhTIF8V+pYc1zlHIuvKAmgDuv6+AxpHPUSWjg+bfQnHhruix7FLPNNZbxCNB0R+YG1+u+cfaJtWk8BtF5FlFpIcjk8oJkkTKAmcG9Oz5uEUWSt4vrdz8PtjuPozqAbSVJt5gOBIK2OryJD1zA9oWEslHHrzgvQKlKOGphfwzU5zXjYN68=

.travis/extractor.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
TRAVIS_ACCESS_TOKEN=$1
4+
GITHUB_USER="algorithm-visualizer"
5+
GITHUB_REPO="extractor.cpp"
6+
BODY="{
7+
\"request\": {
8+
\"branch\": \"master\"
9+
}
10+
}"
11+
12+
STATUS_CODE=$(curl -s -o /dev/stderr -w "%{http_code}" -X POST \
13+
-H "Content-Type: application/json" \
14+
-H "Accept: application/json" \
15+
-H "Travis-API-Version: 3" \
16+
-H "Authorization: token ${TRAVIS_ACCESS_TOKEN}" \
17+
-d "${BODY}" \
18+
"https://api.travis-ci.com/repo/${GITHUB_USER}%2F${GITHUB_REPO}/requests")
19+
20+
if [[ ${STATUS_CODE} != 2* ]]; then
21+
exit 1
22+
fi

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
cmake_minimum_required(VERSION 3.2)
1+
cmake_minimum_required(VERSION 3.9)
22

33
project(algorithm-visualizer VERSION 2.3.5)
44

55
set(CMAKE_CXX_STANDARD 11)
66

7+
execute_process(
8+
COMMAND curl --create-dirs -o ${CMAKE_SOURCE_DIR}/include/nlohmann/json.hpp -L "https://github.com/nlohmann/json/releases/download/v3.6.1/json.hpp"
9+
)
710
include_directories(include)
811
install(DIRECTORY include/
912
DESTINATION include
1013
FILES_MATCHING PATTERN "*.h*")
1114

15+
enable_testing()
1216
add_subdirectory(test)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# tracers.cpp
1+
# tracers.cpp [![Travis (.com)](https://img.shields.io/travis/com/algorithm-visualizer/tracers.cpp.svg?style=flat-square)](https://travis-ci.com/algorithm-visualizer/tracers.cpp)
22

33
> `tracers.cpp` is a visualization library for C++.
44

include/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nlohmann/json.hpp

include/algorithm-visualizer/Commander.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#include <string>
55
#include <cstdlib>
66
#include <fstream>
7-
#include <nlohmann/json.hpp>
87
#include <curl/curl.h>
8+
#include "nlohmann/json.hpp"
99
#include "Randomize.h"
1010

1111
#define MAX_COMMANDS 1000000

test/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
find_package(CURL REQUIRED)
22

3-
add_executable(test main.cpp)
3+
add_executable(tracers main.cpp)
44

5-
target_link_libraries(test ${CURL_LIBRARIES})
5+
target_link_libraries(tracers PRIVATE ${CURL_LIBRARIES})
6+
7+
add_test(test tracers)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy