moved more tests from Travis to GitHub actions (#3201)

This commit is contained in:
Oliver Stöneberg 2021-04-09 07:47:11 +02:00 committed by GitHub
parent 5cf2f7e633
commit 98335e5d5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 33 deletions

View File

@ -100,6 +100,23 @@ jobs:
cd 'cpp check/test/cli' cd 'cpp check/test/cli'
pytest test-*.py pytest test-*.py
# fails on macos since some includes (e.g. sys/epoll.h) are not available
- name: Run cfg tests
if: contains(matrix.os, 'ubuntu')
run: |
make -j$(nproc) checkcfg
# it seems macos has no "wc" command
- name: Run showtimetop5 tests
if: contains(matrix.os, 'ubuntu')
run: |
./tools/test_showtimetop5.sh
- name: Run --dump test
run: |
./cppcheck test/testpreprocessor.cpp --dump
xmllint --noout test/testpreprocessor.cpp.dump
- name: Validate - name: Validate
run: | run: |
make -j$(nproc) checkCWEEntries validateXML make -j$(nproc) checkCWEEntries validateXML

View File

@ -21,17 +21,22 @@ jobs:
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install missing software on ubuntu
run: |
sudo apt-get update
sudo apt-get install tidy libxml2-utils
- name: Install missing software on ubuntu (Python 2) - name: Install missing software on ubuntu (Python 2)
if: matrix.python-version == '2.7' if: matrix.python-version == '2.7'
run: | run: |
python -m pip install pip --upgrade python -m pip install pip --upgrade
python -m pip install pytest python -m pip install pytest
python -m pip install pygments
- name: Install missing software on ubuntu (Python 3) - name: Install missing software on ubuntu (Python 3)
if: matrix.python-version != '2.7' if: matrix.python-version != '2.7'
run: | run: |
sudo apt-get update sudo apt-get install shellcheck
sudo apt-get install shellcheck libxml2-utils
python -m pip install pip --upgrade python -m pip install pip --upgrade
python -m pip install natsort python -m pip install natsort
python -m pip install pexpect python -m pip install pexpect
@ -81,10 +86,21 @@ jobs:
run: | run: |
python tools/test_matchcompiler.py python tools/test_matchcompiler.py
- name: test addons - name: build cppcheck
run: | run: |
make -j$(nproc) -s make -j$(nproc) -s
PYTHONPATH=./addons python -m pytest addons/test/test-*.py
- name: test addons
run: |
python -m pytest addons/test/test-*.py
env:
PYTHONPATH: ./addons
- name: test htmlreport
run: |
htmlreport/test_htmlreport.py
cd htmlreport
./check.sh
- name: dmake - name: dmake
if: matrix.python-version == '3.9' if: matrix.python-version == '3.9'

View File

@ -45,15 +45,6 @@ matrix:
compiler: clang compiler: clang
script: script:
- make -j$(nproc) -s - make -j$(nproc) -s
# check cfg files
- make checkcfg
# check htmlreport stuff
- python2 htmlreport/test_htmlreport.py
- python3 htmlreport/test_htmlreport.py
- cd htmlreport
- PYTHON=python2 ./check.sh
- PYTHON=python3 ./check.sh
- cd ../
# check if DESTDIR works TODO: actually execute this # check if DESTDIR works TODO: actually execute this
- mkdir install_test - mkdir install_test
- echo $CXXFLAGS - echo $CXXFLAGS
@ -65,12 +56,7 @@ matrix:
- make -s MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck -j$(nproc) - make -s MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck -j$(nproc)
- sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck install - sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck install
# check if it actually works: # check if it actually works:
- /usr/bin/cppcheck ./cli - /usr/bin/cppcheck -j$(nproc) ./cli
# check if showtime=top5 works
- ./tools/test_showtimetop5.sh
# check --dump
- ${CPPCHECK} test/testpreprocessor.cpp --dump
- xmllint --noout test/testpreprocessor.cpp.dump
# check addons/misc.py # check addons/misc.py
- cd addons/test - cd addons/test
- ${CPPCHECK} --dump misc-test.cpp - ${CPPCHECK} --dump misc-test.cpp
@ -132,8 +118,6 @@ matrix:
script: script:
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources # fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
- set -e - set -e
# Determine CPU count. As of January 2019 it seems to be 2 - so use this for job count in suitable calls to make or cppcheck
- cat /proc/cpuinfo
# check with TEST_MATHLIB_VALUE enabled # check with TEST_MATHLIB_VALUE enabled
- touch lib/mathlib.cpp test/testmathlib.cpp - touch lib/mathlib.cpp test/testmathlib.cpp
- echo $CXXFLAGS - echo $CXXFLAGS

View File

@ -1,22 +1,23 @@
#!/bin/bash -ex #!/bin/bash -ex
# Command for checking HTML syntax with HTML Tidy, see http://www.html-tidy.org/ # Command for checking HTML syntax with HTML Tidy, see http://www.html-tidy.org/
# newer tidy (5.6.0) command, if using this it is not necessary to ignore warnings: tidy_version=$(tidy --version)
#tidy_cmd='tidy -o /dev/null -eq --drop-empty-elements no'
# older tidy from 2009 (Ubuntu 16.04 Xenial comes with this old version): if [[ "$tidy_version" == *"5.6.0"* ]] ;then
tidy_cmd='tidy -o /dev/null -eq' # newer tidy (5.6.0) command, if using this it is not necessary to ignore warnings:
tidy_cmd='tidy -o /dev/null -eq --drop-empty-elements no'
else
# older tidy from 2009 (Ubuntu 16.04 Xenial comes with this old version):
tidy_cmd='tidy -o /dev/null -eq'
fi
function validate_html { function validate_html {
if [ ! -f "$1" ]; then if [ ! -f "$1" ]; then
echo "File $1 does not exist!" echo "File $1 does not exist!"
exit 1 exit 1
fi fi
set +e if ! ${tidy_cmd} "$1"; then
${tidy_cmd} "$1" echo "HTML validation failed!"
tidy_status=$?
set -e
if [ $tidy_status -eq 2 ]; then
echo "HTML does not validate!"
exit 1 exit 1
fi fi
} }

View File

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
if [[ "$(./cppcheck --showtime=top5 cli/cmdlineparser.h --language=c++ --quiet | wc -l)" != 7 ]] ; then output=$(./cppcheck --showtime=top5 cli/cmdlineparser.h --language=c++ --quiet)
echo "$output"
if [[ "$(echo "$output" | wc -l)" != 7 ]] ; then
false false
fi fi