Skip to content

Commit

Permalink
cache & inherited workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisChoupault committed Jan 21, 2025
1 parent 6650698 commit 1839f9d
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 47 deletions.
20 changes: 1 addition & 19 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,9 @@ on:
jobs:
build-and-test:
runs-on: macos-latest
needs: [flutter_setup, jdk_setup]
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: |
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,13 @@ on:
branches: [ main ]

jobs:
needs: flutter_setup
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

Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/flutter_setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Flutter Setup

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
flutter_setup:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- name: Cache Flutter SDK
uses: actions/cache@v4
with:
path: ${{ runner.tool_cache }}/flutter
key: flutter-${{ runner.os }}-stable-${{ hashFiles('**/.flutter-plugins') }}
restore-keys: |
flutter-${{ runner.os }}-stable-
- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v4
with:
channel: stable
version: 3.27.0
skip-install: ${{ steps.cache.outputs.cache-hit }}

- name: Install dependencies
run: |
flutter pub get
cd example/ios
pod install
cd ../..
- name: Verify Flutter Installation
run: flutter doctor -v
21 changes: 5 additions & 16 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,23 @@ on:
branches: [ main ]

jobs:
needs: flutter_setup
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
31 changes: 31 additions & 0 deletions .github/workflows/jdk_setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: JDK Setup

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
setup:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: Cache JDK 17
uses: actions/cache@v4
with:
path: /usr/lib/jvm/java-17
key: jdk-17-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
jdk-17-${{ runner.os }}-
- name: Setup JDK 17
if: steps.cache.outputs == ''
with:
distribution: 'corretto'
java-version: '17'
cache: 'gradle'

- name: Verify JDK Installation
run: java -version

0 comments on commit 1839f9d

Please sign in to comment.