Add coverage and pub.dev badges #4
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
name: Check formatting and run tests | |
on: [ push ] | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | |
- run: echo "🖥️ The workflow is now ready to test your code on the runner." | |
- name: List files in the repository | |
run: | | |
ls ${{ github.workspace }} | |
- name: Install and set Flutter version | |
uses: subosito/[email protected] | |
- name: Restore packages | |
run: flutter pub get | |
- name: Analyze | |
run: flutter analyze | |
- name: Check formatting | |
run: dart format --set-exit-if-changed . | |
- name: Generate coverage helper script file | |
run: ./generate_test_coverage_helper.sh json_serializable_helper | |
- name: Run tests | |
run: flutter test --coverage | |
- name: Install lcov | |
run: sudo apt-get install -y lcov | |
- name: Remove generated files from code coverage report | |
run: lcov --remove coverage/lcov.info 'lib/*/*.freezed.dart' 'lib/*/*.g.dart' 'lib/*/*.part.dart' 'lib/generated/*.dart' 'lib/generated/*/*.dart' -o coverage/lcov.info | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: coverage/lcov.info | |
token: "${{ secrets.CODECOV_TOKEN }}" | |
- run: echo "🍏 This job's status is ${{ job.status }}." |