From bb165fbc298277fa60e484d4667aa974bfad0055 Mon Sep 17 00:00:00 2001 From: Felix Date: Sat, 26 Apr 2025 17:06:34 +0200 Subject: [PATCH 01/11] Create dart.yml --- .github/workflows/dart.yml | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/dart.yml diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml new file mode 100644 index 0000000..79739e8 --- /dev/null +++ b/.github/workflows/dart.yml @@ -0,0 +1,42 @@ +# 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: Dart + +on: + push: + branches: [ "develop" ] + pull_request: + branches: [ "develop" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + # Note: This workflow uses the latest stable version of the Dart SDK. + # You can specify other versions if desired, see documentation here: + # https://github.com/dart-lang/setup-dart/blob/main/README.md + # - uses: dart-lang/setup-dart@v1 + - uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603 + + - name: Install dependencies + run: dart pub get + + # Uncomment this step to verify the use of 'dart format' on each commit. + # - name: Verify formatting + # run: dart format --output=none --set-exit-if-changed . + + # Consider passing '--fatal-infos' for slightly stricter analysis. + - name: Analyze project source + run: dart analyze + + # Your project will need to have tests in test/ and a dependency on + # package:test for this step to succeed. Note that Flutter projects will + # want to change this to 'flutter test'. + - name: Run tests + run: dart test From 59c6b0ff6f1fd1c05c0152f987f63d6949716201 Mon Sep 17 00:00:00 2001 From: Felix Date: Sat, 26 Apr 2025 17:12:27 +0200 Subject: [PATCH 02/11] Changed pipeline to push on all branches --- .github/workflows/dart.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 79739e8..705ff84 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -7,7 +7,7 @@ name: Dart on: push: - branches: [ "develop" ] + branches-ignore: [] pull_request: branches: [ "develop" ] From a2571786f91d00e96243257fc215f4907b1d3d10 Mon Sep 17 00:00:00 2001 From: Felix Date: Sat, 26 Apr 2025 17:18:56 +0200 Subject: [PATCH 03/11] Implemented second job --- .github/workflows/dart.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 705ff84..7f329e3 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -25,7 +25,7 @@ jobs: - uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603 - name: Install dependencies - run: dart pub get + run: flutter pub get # Uncomment this step to verify the use of 'dart format' on each commit. # - name: Verify formatting @@ -33,10 +33,18 @@ jobs: # Consider passing '--fatal-infos' for slightly stricter analysis. - name: Analyze project source - run: dart analyze + run: flutter analyze --fatal-infos + + - name: Run App + run: flutter run + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603 # Your project will need to have tests in test/ and a dependency on # package:test for this step to succeed. Note that Flutter projects will # want to change this to 'flutter test'. - name: Run tests - run: dart test + run: flutter test From 4d0c38dd476f8c07ffe3c7bac65f5ba1244d1dad Mon Sep 17 00:00:00 2001 From: Felix Date: Sat, 26 Apr 2025 17:22:18 +0200 Subject: [PATCH 04/11] Changed env to flutter --- .github/workflows/dart.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 7f329e3..07a890f 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -17,12 +17,12 @@ jobs: steps: - uses: actions/checkout@v4 - - # Note: This workflow uses the latest stable version of the Dart SDK. - # You can specify other versions if desired, see documentation here: - # https://github.com/dart-lang/setup-dart/blob/main/README.md - # - uses: dart-lang/setup-dart@v1 - - uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603 + + - name: Set Up Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: '3.22.2' + channel: 'stable' - name: Install dependencies run: flutter pub get From ad032afcd8a343063469099d9e48c3f4ddc8fbb4 Mon Sep 17 00:00:00 2001 From: Felix Date: Sat, 26 Apr 2025 17:25:30 +0200 Subject: [PATCH 05/11] Fixed flutter version --- .github/workflows/dart.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 07a890f..53c5956 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -21,7 +21,7 @@ jobs: - name: Set Up Flutter uses: subosito/flutter-action@v2 with: - flutter-version: '3.22.2' + flutter-version: '3.29.2' channel: 'stable' - name: Install dependencies @@ -39,9 +39,16 @@ jobs: run: flutter run test: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 - - uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603 + + - name: Set Up Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: '3.29.2' + channel: 'stable' + # Your project will need to have tests in test/ and a dependency on # package:test for this step to succeed. Note that Flutter projects will From 03633d9d248dc5c43efc7cb4bab235ae5d016631 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 26 Apr 2025 17:28:59 +0200 Subject: [PATCH 06/11] Implemented first basic test --- test/main_test.dart | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test/main_test.dart diff --git a/test/main_test.dart b/test/main_test.dart new file mode 100644 index 0000000..77a09b1 --- /dev/null +++ b/test/main_test.dart @@ -0,0 +1,7 @@ +import 'package:flutter_test/flutter_test.dart'; + +void main() { + test('Counter value should be incremented', () { + expect(1, 1); + }); +} From daf7b549ddf5b37623fc16aeaa422d60bbbc1ba5 Mon Sep 17 00:00:00 2001 From: Felix Date: Sat, 26 Apr 2025 17:29:39 +0200 Subject: [PATCH 07/11] Changed platform to macos --- .github/workflows/dart.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 53c5956..4bdc740 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -13,7 +13,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v4 @@ -38,7 +38,7 @@ jobs: - name: Run App run: flutter run test: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v4 From e4a621a42c29c81e74e239efcedfaf4607865762 Mon Sep 17 00:00:00 2001 From: Felix Date: Sun, 27 Apr 2025 14:58:12 +0200 Subject: [PATCH 08/11] Update dart.yml --- .github/workflows/dart.yml | 66 ++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 13 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 4bdc740..b2b2689 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -3,18 +3,66 @@ # separate terms of service, privacy policy, and support # documentation. -name: Dart +name: Flutter on: push: branches-ignore: [] pull_request: - branches: [ "develop" ] + 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: Linting project + run: flutter analyze + + format: + runs-on: macos-latest + needs: lint + # Only when lint fails, and its a push to develop branch + if: ${{ 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.29.2' + channel: 'stable' + + - name: Get & upgrade dependencies + run: | + flutter pub get + flutter pub upgrade --major-versions + - name: Formatting Code + run: | + flutter analyze + dart fix --apply + dart format . --set-exit-if-changed || true + + - name: Commit Format Changes + #if: failure() && steps.format.outcome == 'failure' + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + git add . + git commit -m "Pipeline: Auto-formatting" + git push + + build: runs-on: macos-latest - steps: - uses: actions/checkout@v4 @@ -27,16 +75,12 @@ jobs: - name: Install dependencies run: flutter pub get - # Uncomment this step to verify the use of 'dart format' on each commit. - # - name: Verify formatting - # run: dart format --output=none --set-exit-if-changed . - - # Consider passing '--fatal-infos' for slightly stricter analysis. - name: Analyze project source run: flutter analyze --fatal-infos - name: Run App run: flutter run + test: runs-on: macos-latest @@ -48,10 +92,6 @@ jobs: with: flutter-version: '3.29.2' channel: 'stable' - - - # Your project will need to have tests in test/ and a dependency on - # package:test for this step to succeed. Note that Flutter projects will - # want to change this to 'flutter test'. + - name: Run tests run: flutter test From e65a957f85cc2e62548b68972f714236414da6c4 Mon Sep 17 00:00:00 2001 From: Felix Date: Sun, 27 Apr 2025 15:15:26 +0200 Subject: [PATCH 09/11] Update dart.yml --- .github/workflows/dart.yml | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index b2b2689..52b7956 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -23,15 +23,22 @@ jobs: flutter-version: '3.29.2' channel: 'stable' - - name: Linting project - run: flutter analyze + - 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() }} && github.event_name == 'push' #&& github.ref == 'refs/heads/develop' - + if: | + failure() && + needs.lint.outputs.needs_formatting == 'true' && + github.event_name == 'push' && + github.ref == 'refs/heads/develop' + steps: - uses: actions/checkout@v4 @@ -44,25 +51,25 @@ jobs: - name: Get & upgrade dependencies run: | flutter pub get - flutter pub upgrade --major-versions - - name: Formatting Code + # flutter pub upgrade --major-versions + + - name: Auto-format run: | - flutter analyze - dart fix --apply - dart format . --set-exit-if-changed || true - - - name: Commit Format Changes - #if: failure() && steps.format.outcome == 'failure' + 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 "Pipeline: Auto-formatting" + git commit -m "style: Auto-formatting [skip ci]" git push build: runs-on: macos-latest + if: false # skips job steps: - uses: actions/checkout@v4 From 783ee7f36af8c851420679b44d3c362403e1e485 Mon Sep 17 00:00:00 2001 From: Felix Date: Sun, 27 Apr 2025 15:20:26 +0200 Subject: [PATCH 10/11] Update dart.yml --- .github/workflows/dart.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 52b7956..073c374 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -26,9 +26,10 @@ jobs: - name: Check Formatting id: check_format run: | - dart format --set-exit-if-changed . || echo "::set-output name=needs_formatting::true" - flutter analyze - + if ! dart format --set-exit-if-changed .; then + echo "needs_formatting=true" >> $GITHUB_OUTPUT + fi + flutter analyze # Standard-Linting format: runs-on: macos-latest needs: lint From 8ba7c73e2b204d1c5ce6717b4a5a88010cd040b2 Mon Sep 17 00:00:00 2001 From: Felix Date: Sun, 27 Apr 2025 15:35:31 +0200 Subject: [PATCH 11/11] Update and rename dart.yml to flutter.yml --- .github/workflows/{dart.yml => flutter.yml} | 52 ++++++++++----------- 1 file changed, 25 insertions(+), 27 deletions(-) rename .github/workflows/{dart.yml => flutter.yml} (81%) diff --git a/.github/workflows/dart.yml b/.github/workflows/flutter.yml similarity index 81% rename from .github/workflows/dart.yml rename to .github/workflows/flutter.yml index 073c374..dfe6316 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/flutter.yml @@ -1,15 +1,11 @@ -# 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: [] + branches: + - "develop" + - "main" pull_request: - branches: [ "develop", "prod" ] jobs: lint: @@ -24,7 +20,6 @@ jobs: channel: 'stable' - name: Check Formatting - id: check_format run: | if ! dart format --set-exit-if-changed .; then echo "needs_formatting=true" >> $GITHUB_OUTPUT @@ -56,21 +51,39 @@ jobs: - name: Auto-format run: | - dart format . # Korrigiert Formatierung - dart fix --apply # Behebt einfache Issues + dart format . + dart fix --apply - 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 commit -m "Actions: Auto-formatting [skip ci]" git push - + + test: + runs-on: macos-latest + needs: lint + 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 + + build: runs-on: macos-latest + needs: test if: false # skips job + steps: - uses: actions/checkout@v4 @@ -88,18 +101,3 @@ jobs: - 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