Skip to content

Commit

Permalink
feat: add test coverage scripts and GitHub Actions workflow
Browse files Browse the repository at this point in the history
- Introduced new scripts in melos.yaml for running tests with coverage and combining coverage reports from all packages.
- Added a GitHub Actions workflow to automate testing on push and pull request events, including installation of dependencies and uploading coverage reports to Codecov.
- Updated README.md to include a Codecov badge for better visibility of test coverage status.

These changes enhance the testing infrastructure and improve visibility into code coverage for the Tagflow application.
  • Loading branch information
devaryakjha committed Dec 24, 2024
1 parent ec8cf9a commit f7021e5
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable"

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y lcov
flutter pub get
dart pub global activate coverage
dart pub global activate melos
melos bootstrap
- name: Run tests with coverage
run: |
melos run coverage
melos run combine-coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: coverage/lcov.info
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Transform HTML markup into native Flutter widgets with an elegant, customizable

[![pub package](https://img.shields.io/pub/v/tagflow.svg?label=tagflow&color=orange)](https://pub.dev/packages/tagflow)
[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg)](https://pub.dev/packages/very_good_analysis)
[![codecov](https://codecov.io/gh/devaryakjha/tagflow/branch/main/graph/badge.svg)](https://codecov.io/gh/devaryakjha/tagflow)

---

Expand Down
12 changes: 11 additions & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,14 @@ scripts:
run: |
melos clean && \
melos bootstrap
description: Clean and bootstrap workspace
description: Clean and bootstrap workspace

coverage:
run: melos exec -c 1 --fail-fast -- "flutter test --coverage"
description: Run tests with coverage and generate coverage report

combine-coverage:
run: |
mkdir -p coverage
lcov --add-tracefile packages/tagflow/coverage/lcov.info -o coverage/lcov.info
description: Combine coverage reports from all packages

0 comments on commit f7021e5

Please sign in to comment.