-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9659e70
commit bb69316
Showing
19 changed files
with
230 additions
and
76 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,17 @@ | ||
|
||
lcov --capture --directory coverage --output-file coverage/lcov.info &> /dev/null | ||
|
||
# Remove unnecessary files from the report | ||
lcov --remove coverage/lcov.info 'lib/*/*.g.dart' 'lib/*/*.freezed.dart' -o coverage/lcov.info &> /dev/null | ||
|
||
# Generate the HTML report | ||
genhtml coverage/lcov.info --output-directory coverage/html &> /dev/null | ||
|
||
# Save output of coverage | ||
output=$(lcov --summary coverage/lcov.info ) | ||
|
||
# Trim output | ||
output="${output##*....:}" | ||
output="${output%%functions*}" | ||
|
||
echo $output |
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 |
---|---|---|
|
@@ -11,6 +11,8 @@ jobs: | |
with: | ||
ref: ${{ github.head_ref }} | ||
repository: ${{github.event.pull_request.head.repo.full_name}} | ||
- name: Install lcov | ||
run: sudo apt-get install -y lcov | ||
- name: Get branch name | ||
id: branch-name | ||
uses: tj-actions/[email protected] | ||
|
@@ -43,20 +45,27 @@ jobs: | |
id: test | ||
run: | | ||
cd example | ||
# Allows code to run after an error. | ||
set -e | ||
# Runs flutter test; saves output and if it fails. | ||
out=$(flutter test) || failed='true' | ||
out=$(flutter test --coverage) || failed='true' | ||
echo "$out" | ||
# Saves output to either success or failure variables. | ||
if [ "$failed" == "true" ]; then | ||
echo "FAILURE=true" >> $GITHUB_OUTPUT | ||
exit 1 | ||
fi | ||
- name: Check test coverage | ||
if: always() | ||
id: coverage | ||
run: | | ||
var=$(sh .github/scripts/parse_coverage.sh) | ||
echo $var | ||
echo "coverage='$(var)'" >> $GITHUB_OUTPUT | ||
- name: Check for modified files | ||
id: git-check | ||
run: echo "modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_ENV | ||
|
@@ -68,8 +77,8 @@ jobs: | |
git add -A | ||
git commit -m '[automated commit] lint format and import sort' | ||
git push | ||
- name: Print outputs | ||
if: always() | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
|
@@ -87,6 +96,12 @@ jobs: | |
template="$template ✅ - All tests passed</br>" | ||
fi | ||
if [ -n "${{steps.coverage.outputs.coverage}}" ]; then | ||
template="$template 🧪 ${{steps.coverage.outputs.coverage}}</br>" | ||
else | ||
echo 'Coverage does not work' | ||
fi | ||
# Add / amend comment on PR. | ||
gh pr comment ${{github.event.pull_request.number}} --body="${template}" --edit-last -R ${{github.repository}} || gh pr comment ${{github.event.pull_request.number}} --body="${template}" -R ${{github.repository}} || echo 'Token not working' | ||
|
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,6 +1,7 @@ | ||
name: CI - Pull Request | ||
on: | ||
pull_request_target: | ||
pull_request: | ||
|
||
jobs: | ||
up-to-date: | ||
|
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
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
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
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
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
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
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
Oops, something went wrong.