Skip to content

Commit

Permalink
Merge pull request #3 from bosenqu/bosenqu/update-ci-summary
Browse files Browse the repository at this point in the history
Update GitHub CI to add additional summary on coverage, and reconfigure ruff
  • Loading branch information
bosenqu authored Dec 28, 2023
2 parents 54b485c + 7acca79 commit a6fb5bc
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 20 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/python-app.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python application
name: Python Application CI

on:
push:
Expand All @@ -7,9 +7,10 @@ on:
branches: [ "master" ]

permissions:
contents: read
actions: read
checks: write
contents: read
pull-requests: write

jobs:
test:
Expand All @@ -31,19 +32,24 @@ jobs:
- name: Run unit and feature tests
run: make test-ci
- name: Create test report
uses: dorny/test-reporter@v1
uses: n-ryu/test-reporter@v0.0.2
if: always()
with:
name: Test report
path: "reports/**/*.xml"
reporter: java-junit
list-tests: "failed"
- name: Create test Summary
uses: test-summary/action@v2
if: always()
with:
paths: "reports/**/*.xml"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Create test summary
uses: test-summary/action@v2
if: always()
with:
paths: "reports/**/*.xml"
- name: Add coverage report to summary
if: always()
run: |
echo "**Test Coverage Report**" >> $GITHUB_STEP_SUMMARY
cat reports/coverage_report.md >> $GITHUB_STEP_SUMMARY
16 changes: 7 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ test:
# Run unit and feature tests with test (junit) and coverage (cobertura) report
.PHONNY: test-ci
test-ci:
rm -rf $(REPORTS)/unit_tests $(REPORTS)/feature_tests
$(PYTHON) -m coverage run --data-file $(REPORTS)/unit_tests/coverage.dat --source src \
rm -fr $(REPORTS)
$(PYTHON) -m coverage run --data-file $(REPORTS)/unit_tests/coverage.dat \
-m pytest -v --junitxml=$(REPORTS)/unit_tests/junit.xml
$(PYTHON) -m coverage run --data-file $(REPORTS)/feature_tests/coverage.dat --source src \
$(PYTHON) -m coverage run --data-file $(REPORTS)/feature_tests/coverage.dat \
-m behave -v --junit --junit-directory=$(REPORTS)/feature_tests
$(PYTHON) -m coverage combine $(REPORTS)/*/*.dat
$(PYTHON) -m coverage xml
$(PYTHON) -m coverage report
$(PYTHON) -m coverage report --format=markdown > $(REPORTS)/coverage_report.md

# Run isort, ruff, and reformat-gherkin formatter
.PHONNY: format
Expand All @@ -64,14 +64,12 @@ lint:
$(VENV)/bin/reformat-gherkin --check tests/features
$(PYTHON) -m mypy .

# Run ruff and reformat-gherkin format checker. In addition, run mypy with text report
# Run make lint with more verbose messages
.PHONNY: lint-ci
lint-ci:
$(PYTHON) -m ruff check .
$(PYTHON) -m ruff check -v .
$(VENV)/bin/reformat-gherkin --check tests/features
rm -rf $(REPORTS)/mypy
$(PYTHON) -m mypy --txt-report $(REPORTS)/mypy .
cat $(REPORTS)/mypy/index.txt
$(PYTHON) -m mypy -v .

# Clean project
.PHONNY: clean
Expand Down
14 changes: 13 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ strip_extras = true
[tool.pytest.ini_options]
testpaths = ["tests/unit"]

[tool.coverage.run]
source = ["src"]

[tool.mypy]
exclude = ["steps.py"]
strict = true
Expand All @@ -41,4 +44,13 @@ profile = "black"

[tool.ruff]
line-length = 120
extend-select = ["B", "I", "Q"]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
"Q", # flake8-quotes
"UP", # pyupgrade
]
2 changes: 1 addition & 1 deletion tests/features/basic.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Feature: showing off behave
Feature: Showing off behave

Scenario: run a simple test
# This is a basic comment
Expand Down
2 changes: 1 addition & 1 deletion tests/features/person.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Feature: test person
Feature: Test behave table feature

Scenario: test find age
# This is a basic comment
Expand Down

0 comments on commit a6fb5bc

Please sign in to comment.