Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add tests on ci #18

Merged
merged 7 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FLUTTER_VERSION=3.22.2
65 changes: 65 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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: 🧐 Analyze
run: |
dart analyze . && \
dart format --set-exit-if-changed lib test

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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.dart_tool
.dart_tool
*coverage/
melos_riverpod_community_extensions.iml
*build/
1 change: 1 addition & 0 deletions .idea/.name
giboin marked this conversation as resolved.
Show resolved Hide resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/runConfigurations/melos_bootstrap.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/runConfigurations/melos_clean.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/runConfigurations/melos_run_analyze.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/runConfigurations/melos_run_fix.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/runConfigurations/melos_run_open_cov.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/runConfigurations/melos_run_test.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/runConfigurations/melos_run_test_cov.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/runConfigurations/melos_run_test_cov_check.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions melos.yaml
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
Loading