From 1b0cb1dee194ca3ef43b6a4a043bb967a5b95bfd Mon Sep 17 00:00:00 2001 From: Ashutosh Date: Tue, 11 Jun 2024 00:18:42 +0530 Subject: [PATCH] workflow (flutter): upgrade actions to latest and using ccache for iOS --- .github/workflows/build-android.yml | 19 +++++++++++++----- .github/workflows/build-ios-simulator.yml | 24 +++++++++++++++++++---- .github/workflows/gh-pages.yml | 4 ++-- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index fa7f7b7..7677013 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -19,15 +19,24 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + + # Optional security step: Validate whether gradle-wrapper.jar is valid or malicious + - name: Validate Gradle Wrapper + uses: gradle/actions/wrapper-validation@v3 # Setup Java environment in order to build the Android app. - name: Setup Java environment - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: '11' - cache: 'gradle' + java-version: '17' + + # Setup gradle using official gradle action + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + add-job-summary: 'on-failure' # Setup the flutter environment. - name: Setup Flutter environment @@ -51,7 +60,7 @@ jobs: # Upload generated apk to the artifacts. - name: Save apk file as artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: flutter-actions-test path: build/app/outputs/flutter-apk/app-release.apk \ No newline at end of file diff --git a/.github/workflows/build-ios-simulator.yml b/.github/workflows/build-ios-simulator.yml index 27679fb..ecb25cd 100644 --- a/.github/workflows/build-ios-simulator.yml +++ b/.github/workflows/build-ios-simulator.yml @@ -17,7 +17,7 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Setup the flutter environment. - name: Setup Flutter environment @@ -25,8 +25,15 @@ jobs: with: cache: true + - uses: hendrikmuhs/ccache-action@v1.2 + name: Xcode Compile Cache + with: + key: ${{ runner.os }}-ccache # makes a unique key w/related restore key internally + create-symlink: true + max-size: 1500M + - name: Restore Pods cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ios/Pods @@ -36,7 +43,16 @@ jobs: restore-keys: ${{ runner.os }}-pods- - name: Build iOS ipa - run: flutter build ios --simulator --no-codesign --obfuscate --split-debug-info --config-only + run: | + export CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros + export CCACHE_FILECLONE=true + export CCACHE_DEPEND=true + export CCACHE_INODECACHE=true + export CCACHE_LIMIT_MULTIPLE=0.95 + ccache -s + set -o pipefail + flutter build ios --simulator --no-codesign --obfuscate --split-debug-info --config-only + ccache -s - name: Store build .app file as zip run: | @@ -46,7 +62,7 @@ jobs: zip -r -y -o output/flutter_github_actions.zip flutter_github_actions.app - name: Save build file as artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: flutter_github_actions path: build/ios/iphonesimulator/output \ No newline at end of file diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index ce4865b..434a108 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Flutter environment uses: subosito/flutter-action@v2 @@ -29,7 +29,7 @@ jobs: run: flutter build web --base-href /test_github_action_delete/ - name: Deploy - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./build/web \ No newline at end of file