Skip to content

Commit

Permalink
Merge pull request #846 from DroidKaigi/chore/cache-konan
Browse files Browse the repository at this point in the history
chore: cache .konan & SPM directory
  • Loading branch information
RyuNen344 authored Aug 21, 2023
2 parents 73b2e35 + b2e083d commit aebe25a
Show file tree
Hide file tree
Showing 19 changed files with 587 additions and 70 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root=true

[*]
charset=utf-8
end_of_line=lf
indent_style=space
insert_final_newline=true

[{*.bash,*.sh,*.zsh}]
indent_size=2
tab_width=2
15 changes: 14 additions & 1 deletion .github/actions/setup-java/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: 'Setup JDK'
name: "Setup JDK"
description: "setup JDK and gradle caching"

inputs:
java-version:
Expand Down Expand Up @@ -28,3 +29,15 @@ runs:
uses: gradle/gradle-build-action@a4cf152f482c7ca97ef56ead29bf08bcd953284c # v2.7.0
with:
gradle-version: wrapper

- name: set konan cache key
id: konan-cache-key
shell: bash
run: echo "KOTLIN_VERSION=$(grep -oE 'kotlin\s*=\s*"[0-9.]*"' gradle/libs.versions.toml | grep -oE '[0-9.]+')" >> $GITHUB_OUTPUT

- name: cache Konan
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: |
~/.konan
key: v1-konan-${{ runner.os }}-${{ hashFiles('.xcode-version') }}-${{ steps.konan-cache-key.outputs.KOTLIN_VERSION }}
28 changes: 28 additions & 0 deletions .github/actions/spm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "cache SPM"
description: "save and restore SPM cache"
runs:
using: "composite"
steps:
- uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
id: cache-spm
with:
path: |
./app-ios/build/DerivedData/SourcePackages
key: v1-spm-${{ runner.os }}-${{ hashFiles('.xcode-version') }}-${{ hashFiles('app-ios/Modules/Package.swift') }}-${{ hashFiles('app-ios/App/DroidKaigi2023/DroidKaigi2023.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}

- if: ${{ steps.cache-spm.outputs.cache-hit != 'true' }}
shell: bash
working-directory: app-ios
run: bundle exec fastlane shared

- if: ${{ steps.cache-spm.outputs.cache-hit != 'true' }}
shell: bash
working-directory: app-ios
run: bundle exec fastlane resolved_package

- if: ${{ steps.cache-spm.outputs.cache-hit != 'true' }}
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: |
./app-ios/build/DerivedData/SourcePackages
key: v1-spm-${{ runner.os }}-${{ hashFiles('.xcode-version') }}-${{ hashFiles('app-ios/Modules/Package.swift') }}-${{ hashFiles('app-ios/App/DroidKaigi2023/DroidKaigi2023.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
15 changes: 15 additions & 0 deletions .github/actions/xcode-select/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "select xcode"
description: "select xcode defined at .xcode-version"
runs:
using: "composite"
steps:
- name: read .xcode-version
shell: bash
run: |
echo "XCODE_VERSION=$(grep -oE "\d+(\.\d+)+" .xcode-version | awk -F. '{print $1 ".0"}' | uniq)" >> $GITHUB_ENV
- name: execute xcode-select
shell: bash
run: |
echo "select $XCODE_VERSION"
sudo xcode-select --switch "/Applications/Xcode_$XCODE_VERSION.app"
6 changes: 1 addition & 5 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ jobs:

- uses: ./.github/actions/setup-java

- name: Build all build type and flavor permutations
uses: gradle/gradle-build-action@243af859f8ca30903d9d7f7936897ca0358ba691 # v2
with:
gradle-home-cache-cleanup: true
arguments: assemble --stacktrace
- run: ./gradlew :app-android:assemble --stacktrace

- name: Upload build outputs (APKs)
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/CompareScreenshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ jobs:
workflow: UnitTest.yml
branch: main

- name: compare screenshot test
id: compare-screenshot-test
uses: gradle/gradle-build-action@243af859f8ca30903d9d7f7936897ca0358ba691 # v2
with:
gradle-home-cache-cleanup: true
arguments: compareRoborazziDebug compareRoborazziDevDebug --stacktrace -Pscreenshot
- run: ./gradlew compareRoborazziDebug compareRoborazziDevDebug --stacktrace -Pscreenshot

- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ always() }}
Expand Down
41 changes: 29 additions & 12 deletions .github/workflows/Format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,41 @@ jobs:

- uses: reviewdog/[email protected]

- name: Check detekt
id: detekt
uses: gradle/gradle-build-action@a4cf152f482c7ca97ef56ead29bf08bcd953284c # v2
with:
gradle-home-cache-cleanup: true
arguments: detekt reportMerge --continue
# - uses: reviewdog/[email protected]
#
# - name: Check detekt
# id: detekt
# uses: gradle/gradle-build-action@a4cf152f482c7ca97ef56ead29bf08bcd953284c # v2
# with:
# gradle-home-cache-cleanup: true
# arguments: detekt reportMerge --continue
#
# - name: Run report with ReviewDog
# if: steps.detekt.outcome == 'failure'
# env:
# REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: cat ./build/reports/detekt/merge.xml |
# reviewdog -f=checkstyle -name="detekt" -reporter="github-pr-review"
#
# - name: Comment lint check success
# if: steps.detekt.outcome == 'success'
# uses: marocchino/sticky-pull-request-comment@v2
# with:
# header: detekt
# recreate: true
# message: |
# :sparkles: :sparkles: **That's perfect, passed the PR lint check perfectly!** :sparkles: :sparkles:
- id: detekt
run: ./gradlew detekt reportMerge --continue

- name: Run report with ReviewDog
if: steps.detekt.outcome == 'failure'
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: cat ./build/reports/detekt/merge.xml |
reviewdog -f=checkstyle -name="detekt" -reporter="github-pr-review"
run: |
< ./build/reports/detekt/merge.xml reviewdog -f=checkstyle -name="detekt" -reporter="github-pr-review"
- name: Check lint
uses: gradle/gradle-build-action@243af859f8ca30903d9d7f7936897ca0358ba691 # v2
with:
arguments: lintDebug lintDevDebug --stacktrace
- run: ./gradlew lintDebug lintDevDebug --stacktrace

- name: Upload lint reports
if: always()
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/UnitTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,9 @@ jobs:
name: event-payload
path: ${{ github.event_path }}

- name: Run local tests
uses: gradle/gradle-build-action@243af859f8ca30903d9d7f7936897ca0358ba691 # v2
with:
gradle-home-cache-cleanup: true
arguments: testDevDebugUnitTest testDebugUnitTest --stacktrace
- run: ./gradlew testDevDebugUnitTest testDebugUnitTest --stacktrace

- name: Get test coverage
uses: gradle/gradle-build-action@243af859f8ca30903d9d7f7936897ca0358ba691 # v2
with:
gradle-home-cache-cleanup: true
arguments: koverHtmlReportDebug koverHtmlReportDevDebug --stacktrace
- run: ./gradlew koverHtmlReportDebug koverHtmlReportDevDebug --stacktrace

- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: ${{ always() }}
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/iOSBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,19 @@ jobs:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Select Xcode
run: sudo xcode-select -s '/Applications/Xcode_15.0.app'

- uses: ./.github/actions/setup-java

- name: Set up Ruby
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
with:
bundler-cache: true

- uses: ./.github/actions/xcode-select

- uses: ./.github/actions/setup-java

- name: Set up XCFramework arch filter
run: echo "arch=x86_64" >> local.properties

- name: Build KMM Module
uses: gradle/gradle-build-action@243af859f8ca30903d9d7f7936897ca0358ba691 # v2
with:
gradle-home-cache-cleanup: true
arguments: :app-ios-shared:assembleSharedReleaseXCFramework --stacktrace
- uses: ./.github/actions/spm

- name: Build App
- run: bundle exec fastlane build
working-directory: app-ios
run: bundle exec fastlane build_project
Loading

0 comments on commit aebe25a

Please sign in to comment.