diff --git a/.github/workflows/checkdiff.yml b/.github/workflows/checkdiff.yml index c2504f2a..0420cce9 100644 --- a/.github/workflows/checkdiff.yml +++ b/.github/workflows/checkdiff.yml @@ -1,4 +1,4 @@ -name: Code coverage checking +name: Diff completeness check on: pull_request jobs: diff --git a/.github/workflows/checkformat.yml b/.github/workflows/checkformat.yml index 857a3256..7a584d57 100644 --- a/.github/workflows/checkformat.yml +++ b/.github/workflows/checkformat.yml @@ -9,4 +9,4 @@ jobs: uses: actions/checkout@v4 - name: Check format run: | - ./contrib/checkformat.bash + contrib/checkformat.bash diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..24d2a7a1 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,30 @@ +name: Code coverage report +on: + - push + - pull_request + +jobs: + coverage: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Install deps + shell: bash + run: | + ./.github/scripts/install_deps.sh ubuntu + - name: Install LCOV + run: | + sudo apt-get install lcov + - name: Install test dependency dependencies + shell: bash + run: | + test/fetch-test-deps.sh --get-deps ubuntu + - name: Generate coverage report + run: | + contrib/coverage.bash false + - name: Upload coverage report + uses: actions/upload-artifact@v4 + with: + name: coverage-report + path: coverage diff --git a/contrib/coverage.bash b/contrib/coverage.bash index 25316568..c0607e18 100755 --- a/contrib/coverage.bash +++ b/contrib/coverage.bash @@ -2,7 +2,6 @@ set -e # Build RGBDS with gcov support - make coverage -j # Run the tests @@ -15,13 +14,20 @@ popd gcov src/**/*.cpp mkdir -p coverage -# Generate coverage report -lcov -c --no-external -d . -o coverage/coverage.info --ignore-errors format,inconsistent,unsupported -genhtml -f -s -o coverage/ coverage/coverage.info --ignore-errors category,corrupt,inconsistent +# Check whether running from coverage.yml workflow +if [ "$1" != "false" ]; then + # Generate coverage report + lcov -c --no-external -d . -o coverage/coverage.info --ignore-errors format,inconsistent,unsupported + genhtml -f -s -o coverage/ coverage/coverage.info --ignore-errors category,corrupt,inconsistent -# Open report in web browser -if [ "$(uname)" == "Darwin" ]; then - open coverage/index.html + # Open report in web browser + if [ "$(uname)" == "Darwin" ]; then + open coverage/index.html + else + xdg-open coverage/index.html + fi else - xdg-open coverage/index.html + # Generate coverage report + lcov -c --no-external -d . -o coverage/coverage.info + genhtml -f -s -o coverage/ coverage/coverage.info fi