Skip to content

Bump actions/checkout from 2 to 4 #2

Bump actions/checkout from 2 to 4

Bump actions/checkout from 2 to 4 #2

name: Flutter Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: stable
- name: Install dependencies
run: flutter pub get
- name: Run tests with coverage
run: flutter test --coverage
- name: Generate coverage report
run: |
sudo apt-get install -y lcov
genhtml -o coverage coverage/lcov.info
- name: Calculate Coverage Percentage
id: coverage
run: |
COVERAGE_PERCENT=$(lcov --summary coverage/lcov.info | grep -Po '\d+\.\d+%' | head -1)
echo "coverage=$COVERAGE_PERCENT" >> $GITHUB_ENV
- name: Generate Coverage Badge with Shields.io
run: |
curl -o coverage/coverage-badge.svg "https://img.shields.io/badge/coverage-${{ env.coverage }}25-green"
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./coverage