refactor: general coding improvements #521
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Checks | |
on: | |
push: | |
branches: | |
- master | |
- devel | |
pull_request: | |
jobs: | |
check-manpage: | |
runs-on: ubuntu-20.04 | |
name: Check manpage | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install build dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install libunwind-dev binutils-dev libiberty-dev help2man | |
- name: Compile Austin | |
run: | | |
autoreconf --install | |
./configure | |
make | |
- name: Generate manpage | |
run: bash doc/genman.sh | |
- name: Check manpage | |
run: git diff -I".* DO NOT MODIFY.*" -I"[.]TH AUSTIN.*" --exit-code src/austin.1 | |
cppcheck-linux: | |
runs-on: ubuntu-20.04 | |
name: Static code analysis (Linux) | |
env: | |
cppcheck-version: 2.10.3 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install build dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install libpcre3-dev | |
- name: Restore cppcheck build | |
id: cppcheck-build-restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
${{ github.workspace }}/cppcheck | |
key: ${{ runner.os }}-cppcheck-${{ env.cppcheck-version }} | |
- name: Check out cppcheck | |
uses: actions/checkout@v2 | |
with: | |
repository: danmar/cppcheck | |
ref: ${{ env.cppcheck-version }} | |
path: ${{ github.workspace }}/cppcheck | |
- name: Compile cppcheck | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install libpcre3-dev | |
cd cppcheck | |
make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" | |
cd - | |
- name: Save cppcheck build | |
id: cppcheck-build-save | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
${{ github.workspace }}/cppcheck | |
key: ${{ runner.os }}-cppcheck-${{ env.cppcheck-version }} | |
- name: Check source code | |
run: ${{ github.workspace }}/cppcheck/cppcheck -q -f --error-exitcode=1 --inline-suppr src | |
cppcheck-macos: | |
name: Static code analysis (macOS) | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install cppcheck | |
run: brew install cppcheck | |
- name: Check source code | |
run: cppcheck -q -f --error-exitcode=1 --inline-suppr src | |
codespell: | |
runs-on: ubuntu-20.04 | |
name: Codespell | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: "actions/setup-python@v2" | |
with: | |
python-version: "3.9" | |
- name: Install codespell | |
run: pip install codespell | |
- name: Check source code spelling | |
run: codespell -I .github/workflows/wordlist.txt -S "src/python/*" src | |
formatting-tests: | |
runs-on: ubuntu-20.04 | |
name: Formatting (tests) | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: "actions/setup-python@v2" | |
with: | |
python-version: "3.10" | |
- name: Install black | |
run: pip install black | |
- name: Check formatting | |
run: black --check --exclude=test/targets test/ | |
linting-tests: | |
runs-on: ubuntu-20.04 | |
name: Linting (tests) | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: "actions/setup-python@v2" | |
with: | |
python-version: "3.10" | |
- name: Install flake8 | |
run: pip install flake8 | |
- name: Lint code | |
run: flake8 --config test/.flake8 test/ | |
coverage: | |
runs-on: ubuntu-20.04 | |
name: Code coverage | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install build dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install libunwind-dev binutils-dev libiberty-dev gcovr | |
- name: Install test dependencies | |
run: | | |
sudo add-apt-repository -y ppa:deadsnakes/ppa | |
sudo apt-get update | |
sudo apt-get -y install \ | |
valgrind \ | |
python2.7 \ | |
python3.{5..11} \ | |
python3.10-full python3.10-dev | |
- name: Compile Austin | |
run: | | |
autoreconf --install | |
./configure --enable-coverage | |
make | |
- name: Run tests | |
run: | | |
ulimit -c unlimited | |
python3.10 -m venv .venv | |
source .venv/bin/activate | |
pip install --upgrade pip | |
pip install -r test/requirements.txt | |
.venv/bin/pytest --pastebin=failed -sr fE -n auto || true | |
sudo -E env PATH="$PATH" .venv/bin/pytest --pastebin=failed -sr fE -n auto || true | |
deactivate | |
- name: Generate Cobertura report | |
run: gcovr --xml ./cobertura.xml -r src/ | |
- name: Upload report to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./cobertura.xml | |
verbose: true | |
check-cog: | |
runs-on: ubuntu-20.04 | |
name: Check cog output | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install cog | |
run: pip install cogapp | |
- name: Compile Austin | |
run: | | |
autoreconf --install | |
./configure | |
make | |
- name: Run cog check | |
run: bash scripts/cog.sh --check |