Files
cabo-counter/.github/workflows/dart.yml
2025-04-27 15:15:26 +02:00

105 lines
2.5 KiB
YAML

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Flutter
on:
push:
branches-ignore: []
pull_request:
branches: [ "develop", "prod" ]
jobs:
lint:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set Up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.29.2'
channel: 'stable'
- name: Check Formatting
id: check_format
run: |
dart format --set-exit-if-changed . || echo "::set-output name=needs_formatting::true"
flutter analyze
format:
runs-on: macos-latest
needs: lint
# Only when lint fails, and its a push to develop branch
if: |
failure() &&
needs.lint.outputs.needs_formatting == 'true' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/develop'
steps:
- uses: actions/checkout@v4
- name: Set Up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.29.2'
channel: 'stable'
- name: Get & upgrade dependencies
run: |
flutter pub get
# flutter pub upgrade --major-versions
- name: Auto-format
run: |
dart format . # Korrigiert Formatierung
dart fix --apply # Behebt einfache Issues
- name: Commit Changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git add .
git commit -m "style: Auto-formatting [skip ci]"
git push
build:
runs-on: macos-latest
if: false # skips job
steps:
- uses: actions/checkout@v4
- name: Set Up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.29.2'
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Analyze project source
run: flutter analyze --fatal-infos
- name: Run App
run: flutter run
test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set Up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.29.2'
channel: 'stable'
- name: Run tests
run: flutter test