Skip to content

Instantly share code, notes, and snippets.

@zachisit
Created February 4, 2021 15:15
Show Gist options
  • Save zachisit/b6c6758ddebb6a2d8cac0aac70f00e2d to your computer and use it in GitHub Desktop.
Save zachisit/b6c6758ddebb6a2d8cac0aac70f00e2d to your computer and use it in GitHub Desktop.
Flutter GitLab CI to test, analyze, and run coverage report
image: cirrusci/flutter:stable
before_script:
- flutter pub get
- flutter clean
- flutter --version
- flutter pub global activate junitreport
stages:
- analyze-and-test
analyze-and-test:
stage: analyze-and-test
script:
- export PATH="$PATH":"$HOME/.pub-cache/bin"
- flutter build aot
- flutter analyze
# - flutter test
- flutter test --machine | tojunit -o report.xml
- flutter test --coverage ./lib
- lcov -r coverage/lcov.info '*/__test*__/*' -o coverage/lcov_cleaned.info
- genhtml coverage/lcov_cleaned.info --output=coverage
artifacts:
when: always
paths:
- rspec.xml
- coverage
reports:
junit:
- report.xml
only:
- master
- merge_requests
except:
variables:
- $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != "master"
@zachisit
Copy link
Author

zachisit commented Feb 4, 2021

You'll need to set a regex line in your Settings->CI->General to have the coverage output returned on the result in the PR screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment