Skip to content

Commit e82b419

Browse files
cache & inherited workflows
1 parent 6650698 commit e82b419

File tree

5 files changed

+74
-52
lines changed

5 files changed

+74
-52
lines changed

.github/workflows/android.yml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,9 @@ on:
88

99
jobs:
1010
build-and-test:
11-
runs-on: macos-latest
11+
uses: [flutter_setup, jdk_setup]
1212
steps:
1313
- uses: actions/checkout@v4
14-
15-
- name: Set up JDK
16-
uses: actions/setup-java@v4
17-
with:
18-
distribution: 'corretto'
19-
java-version: '17'
20-
cache: 'gradle'
21-
22-
- name: Setup Flutter SDK
23-
uses: flutter-actions/setup-flutter@v4
24-
with:
25-
channel: stable
26-
version: 3.27.0
27-
28-
- name: Install dependencies
29-
run: flutter pub get
30-
31-
- name: flutter doctor
32-
run: flutter doctor -v
3314

3415
- name: Set up local.properties
3516
run: |
@@ -39,4 +20,4 @@ jobs:
3920
4021
- name: Build and test
4122
run: |
42-
./example/android/gradlew testDebug -p ./example/android/
23+
./example/android/gradlew testDebug -p ./example/android/

.github/workflows/dart.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,12 @@ on:
77
branches: [ main ]
88

99
jobs:
10+
uses: flutter_setup
11+
1012
build-and-test:
11-
runs-on: macos-latest
12-
1313
steps:
1414
- uses: actions/checkout@v4
1515

16-
- name: Setup Flutter SDK
17-
uses: flutter-actions/setup-flutter@v4
18-
with:
19-
channel: stable
20-
version: 3.27.0
21-
22-
- name: Install dependencies
23-
run: flutter pub get
24-
25-
- name: Flutter doctor
26-
run: flutter doctor -v
27-
2816
- name: Analyze project source
2917
run: dart analyze
3018

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Flutter Setup
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
flutter_setup:
8+
runs-on: macos-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Cache Flutter SDK
14+
uses: actions/cache@v4
15+
with:
16+
path: ${{ runner.tool_cache }}/flutter
17+
key: flutter-${{ runner.os }}-stable-${{ hashFiles('**/.flutter-plugins') }}
18+
restore-keys: |
19+
flutter-${{ runner.os }}-stable-
20+
21+
- name: Setup Flutter SDK
22+
uses: flutter-actions/setup-flutter@v4
23+
with:
24+
channel: stable
25+
version: 3.27.0
26+
skip-install: ${{ steps.cache.outputs.cache-hit }}
27+
28+
- name: Install dependencies
29+
run: |
30+
flutter pub get
31+
cd example/ios
32+
pod install
33+
cd ../..
34+
35+
- name: Verify Flutter Installation
36+
run: flutter doctor -v

.github/workflows/ios.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,23 @@ on:
77
branches: [ main ]
88

99
jobs:
10+
uses: flutter_setup
11+
1012
build-and-test:
11-
runs-on: macOS-latest
1213
steps:
1314
- uses: actions/checkout@v4
1415

15-
- name: Setup Flutter SDK
16-
uses: flutter-actions/setup-flutter@v4
17-
with:
18-
channel: stable
19-
version: 3.27.0
20-
21-
- name: Install dependencies
22-
run: |
23-
flutter pub get
24-
cd example/ios
25-
pod install
26-
cd ../..
27-
2816
- name: Run tests
2917
run: |
3018
xcodebuild test -workspace ./example/ios/Runner.xcworkspace \
3119
-scheme EasyCalendarTests \
3220
-destination 'platform=iOS Simulator,name=iPhone 16,OS=18.1' \
33-
| xcpretty --report html && exit ${PIPESTATUS[0]}
21+
-resultBundlePath build/reports/EasyCalendarTests.xcresult
22+
| exit ${PIPESTATUS[0]}
3423
3524
- name: Upload xcresult file
3625
uses: actions/upload-artifact@v4
3726
if: ${{ failure() }}
3827
with:
39-
name: EasyCalendarTests-${{ github.run_number }}.html
40-
path: build/reports/tests.html
28+
name: EasyCalendarTests-${{ github.run_number }}.xcresult
29+
path: build/reports/EasyCalendarTests.xcresult

.github/workflows/jdk_setup.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: JDK Setup
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
setup:
8+
runs-on: macos-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Cache JDK 17
13+
uses: actions/cache@v4
14+
with:
15+
path: /usr/lib/jvm/java-17
16+
key: jdk-17-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
17+
restore-keys: |
18+
jdk-17-${{ runner.os }}-
19+
20+
- name: Setup JDK 17
21+
if: steps.cache.outputs == ''
22+
with:
23+
distribution: 'corretto'
24+
java-version: '17'
25+
cache: 'gradle'
26+
27+
- name: Verify JDK Installation
28+
run: java -version

0 commit comments

Comments
 (0)