Skip to content

Commit

Permalink
Optimize workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
quoc-huynh-cosee committed Nov 26, 2024
1 parent d2fa05f commit 1014b1e
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 70 deletions.
32 changes: 20 additions & 12 deletions .github/workflows/native_image_cropper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@ jobs:

- name: Cache asdf
uses: actions/cache@v4
id: asdf_cache
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- uses: asdf-vm/actions/install@v3
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-
- name: Install asdf
uses: asdf-vm/actions/install@v3
# See https://github.com/asdf-vm/actions/issues/445
if: steps.cache-asdf.outputs.cache-hit != 'true'

- name: Cache flutter dependencies
uses: actions/cache@v4
id: flutter_cache
with:
path: native_image_cropper/.dart_tool/
key: ${{ runner.os }}-${{ hashFiles('**/pubspec.lock') }}
path: |
~/.pub-cache
native_image_cropper/.dart_tool/
key: ${{ runner.os }}-flutter-${{ hashFiles('example/pubspec.lock') }}
restore-keys: ${{ runner.os }}-flutter-
- name: Install dependencies
run: flutter pub get

Expand All @@ -40,8 +45,6 @@ jobs:
run: dart run dart_code_linter:metrics analyze . --set-exit-on-violation-level=warning
- name: Run tests
run: flutter test
- name: Debug
run: ls -la

pana:
defaults:
Expand All @@ -56,8 +59,12 @@ jobs:
id: asdf_cache
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- uses: asdf-vm/actions/install@v3
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-
- name: Install asdf
uses: asdf-vm/actions/install@v3
# See https://github.com/asdf-vm/actions/issues/445
if: steps.cache-asdf.outputs.cache-hit != 'true'

- name: Install WebP
run: |
Expand All @@ -68,9 +75,10 @@ jobs:
id: flutter_cache
with:
path: |
native_image_cropper/.dart_tool/
~/.pub-cache/
key: ${{ runner.os }}-${{ hashFiles('**/pubspec.lock') }}
native_image_cropper/.dart_tool/
key: ${{ runner.os }}-flutter-${{ hashFiles('example/pubspec.lock') }}
restore-keys: ${{ runner.os }}-flutter-
- name: Install Dependencies
run: |
flutter pub get
Expand Down
34 changes: 22 additions & 12 deletions .github/workflows/native_image_cropper_android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache asdf
uses: actions/cache@v4
id: asdf_cache
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- uses: asdf-vm/actions/install@v3
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-
- name: Install asdf
uses: asdf-vm/actions/install@v3
# See https://github.com/asdf-vm/actions/issues/445
if: steps.cache-asdf.outputs.cache-hit != 'true'

- name: Cache flutter dependencies
uses: actions/cache@v4
id: flutter_cache
with:
path: native_image_cropper_android/.dart_tool/
key: ${{ runner.os }}-android-${{ hashFiles('**/pubspec.lock') }}
path: |
~/.pub-cache
native_image_cropper_android/.dart_tool/
key: ${{ runner.os }}-flutter-android-${{ hashFiles('native_image_cropper_android/example/pubspec.lock') }}
restore-keys: ${{ runner.os }}-flutter-android-
- name: Install dependencies
run: flutter pub get

Expand All @@ -47,22 +53,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache asdf
uses: actions/cache@v4
id: asdf_cache
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- uses: asdf-vm/actions/install@v3
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-
- name: Install asdf
uses: asdf-vm/actions/install@v3
# See https://github.com/asdf-vm/actions/issues/445
if: steps.cache-asdf.outputs.cache-hit != 'true'

- name: Cache flutter dependencies
uses: actions/cache@v4
id: flutter_cache
with:
path: |
~/.pub-cache
native_image_cropper_android/.dart_tool/
~/.pub-cache/
key: ${{ runner.os }}-android-${{ hashFiles('**/pubspec.lock') }}
key: ${{ runner.os }}-flutter-android-${{ hashFiles('native_image_cropper_android/example/pubspec.lock') }}
restore-keys: ${{ runner.os }}-flutter-android-
- name: Install Dependencies
run: |
flutter pub get
Expand Down
34 changes: 22 additions & 12 deletions .github/workflows/native_image_cropper_ios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache asdf
uses: actions/cache@v4
id: asdf_cache
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- uses: asdf-vm/actions/install@v3
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-
- name: Install asdf
uses: asdf-vm/actions/install@v3
# See https://github.com/asdf-vm/actions/issues/445
if: steps.cache-asdf.outputs.cache-hit != 'true'

- name: Cache flutter dependencies
uses: actions/cache@v4
id: flutter_cache
with:
path: native_image_cropper_ios/.dart_tool/
key: ${{ runner.os }}-ios-${{ hashFiles('**/pubspec.lock') }}
path: |
~/.pub-cache
native_image_cropper_ios/.dart_tool/
key: ${{ runner.os }}-flutter-ios-${{ hashFiles('native_image_cropper_ios/example/pubspec.lock') }}
restore-keys: ${{ runner.os }}-flutter-ios-
- name: Install dependencies
run: flutter pub get

Expand All @@ -47,22 +53,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache asdf
uses: actions/cache@v4
id: asdf_cache
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- uses: asdf-vm/actions/install@v3
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-
- name: Install asdf
uses: asdf-vm/actions/install@v3
# See https://github.com/asdf-vm/actions/issues/445
if: steps.cache-asdf.outputs.cache-hit != 'true'

- name: Cache flutter dependencies
uses: actions/cache@v4
id: flutter_cache
with:
path: |
~/.pub-cache
native_image_cropper_ios/.dart_tool/
~/.pub-cache/
key: ${{ runner.os }}-ios-${{ hashFiles('**/pubspec.lock') }}
key: ${{ runner.os }}-flutter-ios-${{ hashFiles('native_image_cropper_ios/example/pubspec.lock') }}
restore-keys: ${{ runner.os }}-flutter-ios-
- name: Install Dependencies
run: |
flutter pub get
Expand Down
34 changes: 22 additions & 12 deletions .github/workflows/native_image_cropper_macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache asdf
uses: actions/cache@v4
id: asdf_cache
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- uses: asdf-vm/actions/install@v3
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-
- name: Install asdf
uses: asdf-vm/actions/install@v3
# See https://github.com/asdf-vm/actions/issues/445
if: steps.cache-asdf.outputs.cache-hit != 'true'

- name: Cache flutter dependencies
uses: actions/cache@v4
id: flutter_cache
with:
path: native_image_cropper_macos/.dart_tool/
key: ${{ runner.os }}-macos-${{ hashFiles('**/pubspec.lock') }}
path: |
~/.pub-cache
native_image_cropper_macos/.dart_tool/
key: ${{ runner.os }}-flutter-macos-${{ hashFiles('native_image_cropper_macos/example/pubspec.lock') }}
restore-keys: ${{ runner.os }}-flutter-macos-
- name: Install dependencies
run: flutter pub get

Expand All @@ -47,22 +53,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache asdf
uses: actions/cache@v4
id: asdf_cache
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- uses: asdf-vm/actions/install@v3
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-
- name: Install asdf
uses: asdf-vm/actions/install@v3
# See https://github.com/asdf-vm/actions/issues/445
if: steps.cache-asdf.outputs.cache-hit != 'true'

- name: Cache flutter dependencies
uses: actions/cache@v4
id: flutter_cache
with:
path: |
~/.pub-cache
native_image_cropper_macos/.dart_tool/
~/.pub-cache/
key: ${{ runner.os }}-macos-${{ hashFiles('**/pubspec.lock') }}
key: ${{ runner.os }}-flutter-macos-${{ hashFiles('native_image_cropper_macos/example/pubspec.lock') }}
restore-keys: ${{ runner.os }}-flutter-macos-
- name: Install Dependencies
run: |
flutter pub get
Expand Down
34 changes: 22 additions & 12 deletions .github/workflows/native_image_cropper_platform_interface.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache asdf
uses: actions/cache@v4
id: asdf_cache
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- uses: asdf-vm/actions/install@v3
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-
- name: Install asdf
uses: asdf-vm/actions/install@v3
# See https://github.com/asdf-vm/actions/issues/445
if: steps.cache-asdf.outputs.cache-hit != 'true'

- name: Cache flutter dependencies
uses: actions/cache@v4
id: flutter_cache
with:
path: native_image_cropper_platform_interface/.dart_tool/
key: ${{ runner.os }}-platform-interface-${{ hashFiles('**/pubspec.lock') }}
path: |
~/.pub-cache
native_image_cropper_platform_interface/.dart_tool/
key: ${{ runner.os }}-flutter-platform-interface-${{ hashFiles('native_image_cropper_platform_interface/example/pubspec.lock') }}
restore-keys: ${{ runner.os }}-flutter-platform-interface-
- name: Install dependencies
run: flutter pub get

Expand All @@ -45,22 +51,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache asdf
uses: actions/cache@v4
id: asdf_cache
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- uses: asdf-vm/actions/install@v3
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-
- name: Install asdf
uses: asdf-vm/actions/install@v3
# See https://github.com/asdf-vm/actions/issues/445
if: steps.cache-asdf.outputs.cache-hit != 'true'

- name: Cache flutter dependencies
uses: actions/cache@v4
id: flutter_cache
with:
path: |
~/.pub-cache
native_image_cropper_platform_interface/.dart_tool/
~/.pub-cache/
key: ${{ runner.os }}-platform-interface-${{ hashFiles('**/pubspec.lock') }}
key: ${{ runner.os }}-flutter-platform-interface-${{ hashFiles('native_image_cropper_platform_interface/example/pubspec.lock') }}
restore-keys: ${{ runner.os }}-flutter-platform-interface-
- name: Install Dependencies
run: |
flutter pub get
Expand Down
31 changes: 21 additions & 10 deletions .github/workflows/native_image_cropper_web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache asdf
uses: actions/cache@v4
id: asdf_cache
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- uses: asdf-vm/actions/install@v3
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-
- name: Install asdf
uses: asdf-vm/actions/install@v3
# See https://github.com/asdf-vm/actions/issues/445
if: steps.cache-asdf.outputs.cache-hit != 'true'

- name: Cache flutter dependencies
uses: actions/cache@v4
id: flutter_cache
with:
path: native_image_cropper_web/.dart_tool/
key: ${{ runner.os }}-web-${{ hashFiles('**/pubspec.lock') }}
path: |
~/.pub-cache
native_image_cropper/.dart_tool/
key: ${{ runner.os }}-flutter-web${{ hashFiles('native_image_cropper_web/example/pubspec.lock') }}
restore-keys: ${{ runner.os }}-flutter-web-
- name: Install dependencies
run: flutter pub get

Expand All @@ -45,13 +51,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Cache asdf
uses: actions/cache@v4
id: asdf_cache
with:
path: ~/.asdf/
key: ${{ runner.os }}-${{ hashFiles('**/.tool-versions') }}
- uses: asdf-vm/actions/install@v3
key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }}
restore-keys: ${{ runner.os }}-asdf-
- name: Install asdf
uses: asdf-vm/actions/install@v3
# See https://github.com/asdf-vm/actions/issues/445
if: steps.cache-asdf.outputs.cache-hit != 'true'

- name: Cache flutter dependencies
uses: actions/cache@v4
Expand All @@ -60,7 +70,8 @@ jobs:
path: |
native_image_cropper_web/.dart_tool/
~/.pub-cache/
key: ${{ runner.os }}-web-${{ hashFiles('**/pubspec.lock') }}
key: ${{ runner.os }}-flutter-web${{ hashFiles('native_image_cropper_web/example/pubspec.lock') }}
restore-keys: ${{ runner.os }}-flutter-web-
- name: Install Dependencies
run: |
flutter pub get
Expand Down

0 comments on commit 1014b1e

Please sign in to comment.