diff --git a/.github/workflows/code_quality_checks.yml b/.github/workflows/code_quality_checks.yml index 27211437..6bb149ee 100644 --- a/.github/workflows/code_quality_checks.yml +++ b/.github/workflows/code_quality_checks.yml @@ -4,7 +4,9 @@ name: Code Quality Check permissions: contents: read -on: [pull_request] +on: + - pull_request + - workflow_dispatch jobs: pre-commit: @@ -13,11 +15,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: setup environment - run: | - ./dev-setup.sh - - name: run pre-commit hooks + - name: setup environment and run pre-commit hooks + shell: bash run: | + source ./dev-setup.sh pre-commit run --all-files --show-diff-on-failure --color=always - name: Print message on failure if: failure() diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 9396c24a..7e4d38f6 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -17,19 +17,16 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install package - run: | - ./dev-setup.sh - - name: Install xmllint run: | apt-get update apt-get install -y libxml2-utils bc - - - name: Run unit tests with coverage + - name: Install package and run unit tests with coverage id: extract_coverage + shell: bash run: | + source ./dev-setup.sh pytest test/unit -s --cov=nodescraper --cov-report=xml --cov-report=term --cov-fail-under=70 --maxfail=1 --disable-warnings -v - name: Print coverage diff --git a/dev-setup.sh b/dev-setup.sh index 7cafc606..71b78c3f 100755 --- a/dev-setup.sh +++ b/dev-setup.sh @@ -1,6 +1,7 @@ +#!/usr/bin/env bash + # Create venv if not already present if [ ! -d "venv" ]; then - python3 -m pip install venv python3 -m venv venv fi