test: add tests for the todo application #15
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
lint: | |
env: | |
FLUTTER_VERSION: "3.24.5" | |
name: Lint and Format Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- run: flutter pub get | |
- run: dart analyze . --fatal-infos | |
- run: dart format $(find lib -name "*.dart" -not \( -name "*.*freezed.dart" -o -name "*.*g.dart" \) ) --set-exit-if-changed | |
unit_and_widget_tests: | |
needs: lint | |
env: | |
FLUTTER_VERSION: "3.24.5" | |
name: Unit and Widget tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- name: Install coverage package | |
run: flutter pub global activate coverage | |
- name: Run tests with coverage | |
run: flutter test --coverage | |
- name: Upload failure artifacts | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: golden-failure-artifacts | |
path: | | |
test/failures/ | |
test/goldens/ | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
file: coverage/lcov.info | |
fail_ci_if_error: false | |
integration_test: | |
needs: lint | |
env: | |
FLUTTER_VERSION: "3.24.5" | |
name: Integration tests | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: futureware-tech/simulator-action@v3 | |
with: | |
model: "iPhone 15" | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- run: flutter pub get | |
- run: flutter test integration_test |