130 lines
3.1 KiB
YAML
130 lines
3.1 KiB
YAML
name: Flutter
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "develop"
|
|
- "main"
|
|
pull_request:
|
|
|
|
jobs:
|
|
generate_licenses:
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/develop
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Flutter
|
|
uses: subosito/flutter-action@v1.5.3
|
|
with:
|
|
flutter-version: '3.32.1'
|
|
channel: "stable"
|
|
|
|
- name: Get dependencies
|
|
run: flutter pub get
|
|
|
|
- name: Generate oss_licenses.dart
|
|
run: flutter pub run flutter_oss_licenses:generate.dart -o lib/presentation/views/about/licenses/oss_licenses.dart
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set Up Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: '3.32.1'
|
|
channel: 'stable'
|
|
|
|
- name: Check Formatting
|
|
run: flutter analyze
|
|
|
|
format:
|
|
runs-on: ubuntu-latest
|
|
needs: lint
|
|
if: ${{ failure() && needs.lint.result == 'failure' && 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.32.1'
|
|
channel: 'stable'
|
|
|
|
- name: Get & upgrade dependencies
|
|
run: |
|
|
flutter pub get
|
|
flutter pub upgrade --major-versions
|
|
|
|
- name: Auto-format
|
|
run: |
|
|
dart format .
|
|
dart fix --apply
|
|
|
|
- name: Check for changes
|
|
id: check_changes
|
|
run: |
|
|
if [[ $(git status --porcelain) ]]; then
|
|
echo "changes_detected=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "changes_detected=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Commit Changes
|
|
if: steps.check_changes.outputs.changes_detected == 'true'
|
|
run: |
|
|
git config --global user.name "GitHub Actions"
|
|
git config --global user.email "actions@github.com"
|
|
git add .
|
|
git commit -m "Actions: Auto-formatting [skip ci]"
|
|
git push
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
if: always()
|
|
needs: [lint, format]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set Up Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: '3.32.1'
|
|
channel: 'stable'
|
|
|
|
- name: Get dependencies
|
|
run: flutter pub get
|
|
|
|
- name: Run Tests
|
|
run: flutter test
|
|
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
if: false # skips job
|
|
needs: [lint, format, test]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set Up Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: '3.32.1'
|
|
channel: 'stable'
|
|
|
|
- name: Get dependencies
|
|
run: flutter pub get
|
|
|
|
- name: Analyze project source
|
|
run: flutter analyze --fatal-infos
|
|
|
|
- name: Run App
|
|
run: flutter run
|