From 726ac1cc9051af4d689485c7a130bc3178dcabb0 Mon Sep 17 00:00:00 2001 From: Alexis Choupault Date: Tue, 21 Jan 2025 07:35:29 +0100 Subject: [PATCH] cache & inherited workflows --- .github/workflows/android.yml | 28 +++++++------------------ .github/workflows/dart.yml | 32 ----------------------------- .github/workflows/flutter.yml | 21 +++++++++++++++++++ .github/workflows/flutter_setup.yml | 27 ++++++++++++++++++++++++ .github/workflows/ios.yml | 24 +++++++--------------- .github/workflows/jdk_setup.yml | 19 +++++++++++++++++ 6 files changed, 81 insertions(+), 70 deletions(-) delete mode 100644 .github/workflows/dart.yml create mode 100644 .github/workflows/flutter.yml create mode 100644 .github/workflows/flutter_setup.yml create mode 100644 .github/workflows/jdk_setup.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index d3b8eba..9b48fa2 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -7,29 +7,15 @@ on: branches: [ main ] jobs: + flutter_setup: + uses: ./.github/workflows/flutter_setup.yml + + jdk_setup: + uses: ./.github/workflows/jdk_setup.yml + build-and-test: - runs-on: macos-latest steps: - uses: actions/checkout@v4 - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: 'corretto' - java-version: '17' - cache: 'gradle' - - - name: Setup Flutter SDK - uses: flutter-actions/setup-flutter@v4 - with: - channel: stable - version: 3.27.0 - - - name: Install dependencies - run: flutter pub get - - - name: flutter doctor - run: flutter doctor -v - name: Set up local.properties run: | @@ -39,4 +25,4 @@ jobs: - name: Build and test run: | - ./example/android/gradlew testDebug -p ./example/android/ + ./example/android/gradlew testDebug -p ./example/android/ \ No newline at end of file diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml deleted file mode 100644 index b00e85f..0000000 --- a/.github/workflows/dart.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Flutter Tests - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build-and-test: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v4 - - - name: Setup Flutter SDK - uses: flutter-actions/setup-flutter@v4 - with: - channel: stable - version: 3.27.0 - - - name: Install dependencies - run: flutter pub get - - - name: Flutter doctor - run: flutter doctor -v - - - name: Analyze project source - run: dart analyze - - - name: Run tests - run: flutter test diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml new file mode 100644 index 0000000..b177a86 --- /dev/null +++ b/.github/workflows/flutter.yml @@ -0,0 +1,21 @@ +name: Flutter Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + flutter_setup: + uses: ./.github/workflows/flutter_setup.yml + + build-and-test: + steps: + - uses: actions/checkout@v4 + + - name: Analyze project source + run: dart analyze + + - name: Run tests + run: flutter test diff --git a/.github/workflows/flutter_setup.yml b/.github/workflows/flutter_setup.yml new file mode 100644 index 0000000..f0374d0 --- /dev/null +++ b/.github/workflows/flutter_setup.yml @@ -0,0 +1,27 @@ +name: Flutter Setup + +on: + workflow_call: + +jobs: + flutter_setup: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Flutter SDK + uses: flutter-actions/setup-flutter@v4 + with: + channel: stable + version: 3.27.0 + + - name: Install dependencies + run: | + flutter pub get + cd example/ios + pod install + cd ../.. + + - name: Verify Flutter Installation + run: flutter doctor -v \ No newline at end of file diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 2c73a0c..ac59650 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -7,34 +7,24 @@ on: branches: [ main ] jobs: + flutter_setup: + uses: ./.github/workflows/flutter_setup.yml + build-and-test: - runs-on: macOS-latest steps: - uses: actions/checkout@v4 - - name: Setup Flutter SDK - uses: flutter-actions/setup-flutter@v4 - with: - channel: stable - version: 3.27.0 - - - name: Install dependencies - run: | - flutter pub get - cd example/ios - pod install - cd ../.. - - name: Run tests run: | xcodebuild test -workspace ./example/ios/Runner.xcworkspace \ -scheme EasyCalendarTests \ -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.1' \ - | xcpretty --report html && exit ${PIPESTATUS[0]} + -resultBundlePath build/reports/EasyCalendarTests.xcresult + | exit ${PIPESTATUS[0]} - name: Upload xcresult file uses: actions/upload-artifact@v4 if: ${{ failure() }} with: - name: EasyCalendarTests-${{ github.run_number }}.html - path: build/reports/tests.html + name: EasyCalendarTests-${{ github.run_number }}.xcresult + path: build/reports/EasyCalendarTests.xcresult diff --git a/.github/workflows/jdk_setup.yml b/.github/workflows/jdk_setup.yml new file mode 100644 index 0000000..177e293 --- /dev/null +++ b/.github/workflows/jdk_setup.yml @@ -0,0 +1,19 @@ +name: JDK Setup + +on: + workflow_call: + +jobs: + jdk_setup: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup JDK 17 + with: + distribution: 'corretto' + java-version: '17' + cache: 'gradle' + + - name: Verify JDK Installation + run: java -version \ No newline at end of file