From 37e257c5ee20f6155b893cddaee4f39f6491cdbb Mon Sep 17 00:00:00 2001 From: Teal Dulcet Date: Thu, 5 May 2022 05:33:26 -0700 Subject: [PATCH] Updated CI. --- .github/workflows/ci.yml | 32 +++++++++++++++++++++++++++----- .travis.yml | 8 ++++---- python/graphs.py | 2 +- python/tables.py | 2 +- python/test.py | 2 +- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bdfbf48..0b212a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,18 +8,18 @@ on: jobs: Linux: - name: Linux + name: Linux C++ runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04, ubuntu-20.04] + os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] cxx: [g++, clang++] fail-fast: false env: CXX: ${{ matrix.cxx }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Before script run: | sudo apt-get -yqq update @@ -27,10 +27,32 @@ jobs: $CXX --version - name: Script run: | - $CXX -Wall -g -fsanitize=address tables.cpp -o tables + $CXX -Wall -g -fsanitize=address,undefined tables.cpp -o tables ./tables - $CXX -Wall -g -fsanitize=address graphs.cpp -o graphs + $CXX -Wall -g -fsanitize=address,undefined graphs.cpp -o graphs ./graphs - name: Cppcheck run: cppcheck --enable=all . + Python: + name: Linux Python + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] + fail-fast: false + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install wcwidth + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Script + run: | + python python/test.py diff --git a/.travis.yml b/.travis.yml index 3e80a56..5aca9e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,12 +13,12 @@ install: - sudo apt-get -yqq update - sudo apt-get -yqq install cppcheck script: - - g++ -Wall -g -fsanitize=address tables.cpp -o gcc_tables + - g++ -Wall -g -fsanitize=address,undefined tables.cpp -o gcc_tables - ./gcc_tables - - g++ -Wall -g -fsanitize=address graphs.cpp -o gcc_graphs + - g++ -Wall -g -fsanitize=address,undefined graphs.cpp -o gcc_graphs - ./gcc_graphs - - clang++ -Wall -g -fsanitize=address tables.cpp -o clang_tables + - clang++ -Wall -g -fsanitize=address,undefined,integer tables.cpp -o clang_tables - ./clang_tables - - clang++ -Wall -g -fsanitize=address graphs.cpp -o clang_graphs + - clang++ -Wall -g -fsanitize=address,undefined,integer graphs.cpp -o clang_graphs - ./clang_graphs - cppcheck --enable=all . diff --git a/python/graphs.py b/python/graphs.py index b7effef..a2b75a4 100644 --- a/python/graphs.py +++ b/python/graphs.py @@ -118,7 +118,7 @@ def graph(height: int, width: int, xmin: float, xmax: float, ymin: float, ymax: if not array: return 1 - if not (0 >= style > len(styles)): + if not (0 <= style < len(styles)): return 1 if height == 0: diff --git a/python/tables.py b/python/tables.py index c2aee30..7e659c1 100644 --- a/python/tables.py +++ b/python/tables.py @@ -44,7 +44,7 @@ def table(array: List[List[str]], headerrow: bool=False, headercolumn: bool=Fals if not array: return 1 - if not (0 >= style > len(styles)): + if not (0 <= style < len(styles)): return 1 rows = len(array) diff --git a/python/test.py b/python/test.py index 9df8439..3f9c2cf 100644 --- a/python/test.py +++ b/python/test.py @@ -108,4 +108,4 @@ for k in range(len(graphs.styles)): for k in range(len(graphs.styles)): graphs.functions(height, width, -(2 * math.pi), 2 * - math.pi, -4, 4, [math.sin, math.cos, math.tan], style=k) + math.pi, -4, 4, [math.sin, math.cos, math.tan], axisunitslabel=False, style=k)