Add comprehensive test suite with GitHub Actions CI/CD

- Refactor code into testable bot.py module with MastodonRSSBot class
- Create 20+ unit tests covering core functionality and edge cases
- Create 10+ integration tests for RSS parsing and Mastodon posting
- Add GitHub Actions workflow for automated testing
  - Unit tests on Python 3.10, 3.11, 3.12
  - Integration tests with mocked external services
  - Code quality checks (flake8, black, mypy)
  - Docker build validation
- Configure pytest with 80% minimum coverage requirement
- Add test dependencies in requirements-test.txt
- Update .gitignore to exclude test artifacts
- Add comprehensive TESTING.md documentation
- Add test status badge to README
- Maintain full backward compatibility with existing setup
This commit is contained in:
aserper
2025-12-12 23:30:38 -05:00
parent 70a23fdb75
commit c8618ec3b7
11 changed files with 1624 additions and 78 deletions

View File

@@ -3,6 +3,7 @@
# Masto-RSS
[![Build Status](https://img.shields.io/github/actions/workflow/status/aserper/masto-rss/masto-rss.yml?style=for-the-badge&logo=github&label=Build)](https://github.com/aserper/masto-rss/actions/workflows/masto-rss.yml)
[![Tests](https://img.shields.io/github/actions/workflow/status/aserper/masto-rss/test.yml?style=for-the-badge&logo=github&label=Tests)](https://github.com/aserper/masto-rss/actions/workflows/test.yml)
[![Docker Hub](https://img.shields.io/badge/docker%20hub-amitserper%2Fmasto--rss-blue?style=for-the-badge&logo=docker&logoColor=white)](https://hub.docker.com/r/amitserper/masto-rss)
[![GHCR](https://img.shields.io/badge/ghcr.io-masto--rss-blue?style=for-the-badge&logo=docker&logoColor=white)](https://github.com/aserper/masto-rss/pkgs/container/masto-rss)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-yellow.svg?style=for-the-badge)](LICENSE)
@@ -181,17 +182,6 @@ The bot maintains state in `/state/processed_entries.txt` to track which feed it
**Important:** Always mount `/state` as a volume to preserve this state file.
## CI/CD
The project uses GitHub Actions for automated multiarch builds and deployments:
- Builds on every push to `main`
- Creates images for both amd64 and arm64 architectures
- Automatically pushes to Docker Hub and GitHub Container Registry
- Uses Docker layer caching for faster builds
See [.github/workflows/masto-rss.yml](.github/workflows/masto-rss.yml) for the full pipeline.
## Contributing
Contributions are welcome! Feel free to: