Skip to content

patch-refactoring

patch-refactoring #7

Workflow file for this run

name: Test
on:
push:
branches: [main]
paths-ignore:
- "**/*.md"
- policies/*
- repo-assets/*
- configs/*
pull_request:
types: [review_requested]
paths-ignore:
- "**/*.md"
- policies/*
- repo-assets/*
- configs/*
jobs:
test:
strategy:
fail-fast: false
matrix:
dir:
- packages/screen_pal_core
- .
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ matrix.dir }}
steps:
- name: 📚 Git Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: 🐦 Setup Flutter SDK v3.10.x
uses: subosito/flutter-action@v2
with:
flutter-version: 3.10.x
channel: stable
cache: true
cache-key: |
flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- name: 📦 Get dependencies
run: flutter pub get
- name: ⚙️ Setup environment
run: |
echo "${{secrets.DEV_ENV_FILE}}" > .env
dart run build_runner build -d
- name: ✨ Check Formatting
run: dart format lib --line-length 80 --set-exit-if-changed
- name: 🕵️ Analyze code
id: first-analyze
continue-on-error: true
run: flutter analyze lib test
- name: ♻️🕵️ Re-analyze code
if: steps.first-analyze.outcome == 'failure'
run: |
flutter clean
flutter pub get
flutter analyze lib test
- name: 🧪 Run tests
id: test
run: |
if test -d "test"; then
flutter test --coverage
echo "RESULT=tested" >> "${GITHUB_OUTPUT}"
fi
- name: 📊 Filter and Check Code Coverage
if: ${{steps.test.outputs.RESULT == 'tested'}}
run: |
flutter test --coverage
dart pub global activate clean_coverage
clean_coverage clean coverage/lcov.info --exclusions "**.g.dart","**.freezed.dart","**/interfaces/**"
dart pub global activate dlcov
dlcov -c 80
- name: 📝 Upload coverage to codecov
if: ${{steps.test.outputs.RESULT == 'tested'}}
run: curl -s https://codecov.io/bash | bash