Skip to content

Commit

Permalink
Add codecov integration
Browse files Browse the repository at this point in the history
  • Loading branch information
serra committed Oct 16, 2024
1 parent 915a841 commit c5c072b
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 30 deletions.
13 changes: 13 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[run]
source = src/floridayvine

[report]
exclude_lines =
pragma: no cover
def __repr__
if self.debug:
if __name__ == .__main__.:
raise NotImplementedError
pass
except ImportError:
def main
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,18 @@ jobs:
- name: Install dependencies
run: |
make update
- name: Run quality checks
- name: Run quality checks and tests with coverage
run: |
make quality
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: true
- name: Package
run: |
make docker_image
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.12] - 2024-10-11

### Changed

- Refactored CLI structure: renamed 'floriday' command to 'inventory'
- Updated 'about' command with new subcommands: 'show-info' and 'version'
- Added new subcommands to 'inventory': 'list-direct-sales', 'list-trade-items', and 'sync'

## [0.11] - 2024-10-10

### Added

- New script `scripts/verify_env_vars.py` to verify environment variables
- Deployment directory with documentation and configuration files for Serra Vine deployment
- Automatic CHANGELOG.md update process in Makefile for releases

### Removed

- Minio functionality has been completely removed from the project

### Changed

- Updated Makefile to automatically update CHANGELOG.md during the release process
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# vine-floriday-adapter

[![Coverage](https://codecov.io/gh/serraict/vine-floriday-adapter/branch/main/graph/badge.svg)](https://codecov.io/gh/serraict/vine-floriday-adapter)

This adapter will make trade information from [Floriday] available on a [Serra Vine] instance of choice.

See the [backlog] to learn what's next and planned.
Expand Down
16 changes: 11 additions & 5 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ update:
pip install -e .
console:
test:
pytest -m "not integration"
coverage run -m pytest -m "not integration"
coverage report
test-integration:
pytest -m "integration"
coverage run -m pytest -m "integration"
coverage report
coverage:
coverage run -m pytest
coverage report
coverage html
build:
python -m build
documentation:
Expand Down Expand Up @@ -65,7 +71,7 @@ quality:
@echo "Running code quality checks..."
flake8 src tests
black --check src tests
pre-commit run --all-files
@echo "Running tests..."
pytest -m "not integration"
@echo "Running tests with coverage..."
coverage run -m pytest
coverage report
@echo "Code quality checks completed."
45 changes: 21 additions & 24 deletions work/backlog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,37 @@

## Doing

Set up Codecov:

- [x] Create a Codecov account and link it to the GitHub repository
- [x] Add CODECOV_TOKEN to GitHub repository secrets
- [ ] Verify Codecov integration by pushing a change and checking the coverage report

## Next

Improve test coverage:

- Target: Achieve 70-80% overall coverage
- Focus areas:
1. `__main__.py` (currently 0%)
2. `config.py` (currently 0%)
3. `persistence.py` (currently 19%)
4. `floriday/misc.py` (currently 51%)
- Add unit tests for uncovered functions and methods
- Add integration tests for key workflows

## Later

* Goal: show open quotations for a supplier on Floriday.
* Create a Serra Vine dashboard for open quotations
* Implement consistent logging throughout the application
* Define logging standards and best practices
* Add appropriate log levels (INFO, WARNING, ERROR, etc.)
* Ensure all modules use the logging system consistently
* Add contextual information to log messages
* Configure log output format and destination

## Later

* Goal: show open quotations for a supplier on Floriday.
* Create a Serra Vine dashboard for open quotations

* Consider implementing improvements suggested during manual testing:
* Add more detailed logging for troubleshooting purposes
* Implement a dry-run option for the sync command to preview changes without persisting them

## Out of Scope

## Done

* Implemented sync command for supply lines
* Added a new command in the sync.py file for syncing supply lines
* Implemented the following steps in the sync command:
1. Get the highest generated sequence number
2. Sync supply lines and batch sequence number using the Floriday API
3. Process and store the returned supply lines in the local database
* Ensured prerequisites are met:
- Checked if organizations are present in the system
- Verified tradeitem and batch information is available
* Added error handling and logging
* Updated CLI documentation to include the new command
* Tested the new command with the staging environment
* Updated persistence.py to handle storage and retrieval of supply lines
* Performed manual testing of the supply lines sync command
* Improved unit tests for the sync_supply_lines function, covering various scenarios and edge cases

0 comments on commit c5c072b

Please sign in to comment.