-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from bamlab/feat/add-tests-on-ci
Feat/add tests on ci
- Loading branch information
Showing
8 changed files
with
344 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FLUTTER_VERSION=3.22.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Pull request checks | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
workflow_call: | ||
|
||
jobs: | ||
analyze: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- name: 📚 Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- id: dotenv | ||
uses: falti/[email protected] | ||
with: | ||
path: .github/workflows/.env | ||
|
||
- name: 💙 Install Flutter | ||
uses: subosito/[email protected] | ||
with: | ||
flutter-version: ${{ steps.dotenv.outputs.flutter_version }} | ||
channel: "stable" | ||
cache: true | ||
cache-key: ${{ runner.os }}-flutter-${{ steps.dotenv.outputs.flutter_version }} | ||
cache-path: ${{ runner.tool_cache }}/flutter-${{ steps.dotenv.outputs.flutter_version }} | ||
|
||
- name: 🟠 Install Dependencies | ||
uses: bluefireteam/melos-action@v1 | ||
|
||
- name: 🧐 Analyze | ||
run: melos analyze | ||
|
||
test-extensions: | ||
needs: analyze | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- name: 📚 Git Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- id: dotenv | ||
uses: falti/[email protected] | ||
with: | ||
path: .github/workflows/.env | ||
|
||
- name: 💙 Install Flutter | ||
uses: subosito/[email protected] | ||
with: | ||
flutter-version: ${{ steps.dotenv.outputs.flutter_version }} | ||
channel: "stable" | ||
cache: true | ||
cache-key: ${{ runner.os }}-flutter-${{ steps.dotenv.outputs.flutter_version }} | ||
cache-path: ${{ runner.tool_cache }}/flutter-${{ steps.dotenv.outputs.flutter_version }} | ||
|
||
- name: 🟠 Install Dependencies | ||
run: flutter pub get | ||
|
||
- name: ✅ Run tests | ||
run: flutter test --coverage --no-pub --test-randomize-ordering-seed random | ||
|
||
- name: 💯 Check coverage | ||
uses: VeryGoodOpenSource/very_good_coverage@v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
.dart_tool | ||
.dart_tool | ||
*coverage/ | ||
melos_riverpod_community_extensions.iml | ||
*build/ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
## How to Contribute 🤝 | ||
|
||
If you want to report a bug, suggest an enhancement, or contribute to this project, you can leave an issue or open a pull request. Here are some guidelines to help you get started: | ||
|
||
- Be respectful and considerate when interacting with other contributors. | ||
- If you want to report a bug, provide a detailed description of the bug, including the steps to reproduce it. | ||
- Clearly describe the issue or enhancement you are reporting or suggesting. | ||
- When opening a pull request, provide a clear and concise description of the changes you have made. | ||
- Write meaningful commit messages that accurately describe the changes made in each commit. | ||
- Make sure to run tests and ensure that all tests are passing before submitting a pull request. | ||
|
||
## Running Tests 🧪 | ||
|
||
This project uses [melos][melos_link] for convenience scripts such as running tests and coverage. All of these scripts can be run from any directory in the project, and are defined in the root `melos.yaml` file. | ||
|
||
To activate melos, run the following command: | ||
|
||
```sh | ||
dart pub global activate melos | ||
``` | ||
|
||
After that, to run all unit tests: | ||
|
||
```sh | ||
melos test | ||
``` | ||
|
||
To run all tests and generate coverage report: | ||
|
||
```sh | ||
melos test:cov | ||
``` | ||
|
||
To view the generated coverage report using [lcov][lcov_link] in your browser, run: | ||
|
||
```sh | ||
melos open:cov | ||
``` | ||
|
||
If you want to reproduce the CI analyze job locally, you can run: | ||
|
||
```sh | ||
melos analyze | ||
``` | ||
|
||
[melos_link]: https://melos.invertase.dev/ | ||
[lcov_link]: https://github.com/linux-test-project/lcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: riverpod_community_extensions | ||
|
||
packages: | ||
- . | ||
|
||
scripts: | ||
analyze: | ||
exec: | | ||
dart analyze . && \ | ||
dart format --set-exit-if-changed lib test | ||
description: Run analyzer | ||
|
||
test: | ||
exec: flutter test --no-pub --test-randomize-ordering-seed random | ||
description: Run tests | ||
fix: | ||
exec: | | ||
dart fix . --apply && \ | ||
dart format lib test | ||
description: Run fix | ||
test:cov: | ||
exec: | | ||
rm -rf coverage && \ | ||
flutter test --coverage --no-pub --test-randomize-ordering-seed random && \ | ||
genhtml coverage/lcov.info -o coverage && \ | ||
coverde value -i coverage/lcov.info | ||
description: Run test with coverage | ||
test:cov:check: | ||
exec: | | ||
melos test:cov && \ | ||
coverde check 100 -i coverage/lcov.info | ||
description: Check test coverage | ||
open:cov: | ||
exec: | | ||
open coverage/index.html | ||
description: Open test coverage |
Oops, something went wrong.