Skip to content

Commit

Permalink
Saves and restores the Kotlin/Native compiler on CI (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
JayShortway authored Sep 23, 2024
1 parent 9f6851a commit 3169ad3
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,29 @@ commands:
command: bundle exec pod install --repo-update
working_directory: iosApp

save-kotlin-native-compiler-to-cache:
steps:
- run:
name: Get the Kotlin version
command: sed -nE 's/^kotlin = "([^"]+)".*/\1/p' gradle/libs.versions.toml > ~/.kotlin_version
# We cannot use the Kotlin version in the cache key directly, so we use the checksum of a file
# containing it instead.
- save_cache:
name: Saving Kotlin/Native compiler to cache
paths: [~/.konan]
key: konan-{{ arch }}-{{ checksum "~/.kotlin_version" }}

restore-kotlin-native-compiler-from-cache:
steps:
- run:
name: Get the Kotlin version
command: sed -nE 's/^kotlin = "([^"]+)".*/\1/p' gradle/libs.versions.toml > ~/.kotlin_version
# We cannot use the Kotlin version in the cache key directly, so we use the checksum of a file
# containing it instead.
- restore_cache:
name: Restoring Kotlin/Native compiler from cache
key: konan-{{ arch }}-{{ checksum "~/.kotlin_version" }}

parameters:
action:
type: enum
Expand Down Expand Up @@ -129,10 +152,12 @@ jobs:
- install-android-sdk-on-macos
- checkout
- android/restore-gradle-cache
- restore-kotlin-native-compiler-from-cache
- run:
name: Validate binary compatibility
command: ./gradlew apiCheck
- android/save-gradle-cache
- save-kotlin-native-compiler-to-cache

build-libraries-android:
executor: android202409
Expand All @@ -156,6 +181,7 @@ jobs:
steps:
- checkout
- android/restore-gradle-cache
- restore-kotlin-native-compiler-from-cache
- revenuecat/install-gem-mac-dependencies:
cache-version: v1
- install-cocoapods-on-macos
Expand All @@ -170,6 +196,7 @@ jobs:
done
./gradlew "${tasks[@]}"
- android/save-gradle-cache
- save-kotlin-native-compiler-to-cache

build-sample-android:
executor: android202409
Expand All @@ -191,6 +218,7 @@ jobs:
steps:
- checkout
- android/restore-gradle-cache
- restore-kotlin-native-compiler-from-cache
- revenuecat/install-gem-mac-dependencies:
cache-version: v1
- install-cocoapods-on-macos
Expand All @@ -203,6 +231,7 @@ jobs:
done
./gradlew "${tasks[@]}"
- android/save-gradle-cache
- save-kotlin-native-compiler-to-cache

public-api-tests-android:
executor: android202409
Expand All @@ -224,6 +253,7 @@ jobs:
steps:
- checkout
- android/restore-gradle-cache
- restore-kotlin-native-compiler-from-cache
- revenuecat/install-gem-mac-dependencies:
cache-version: v1
- install-cocoapods-on-macos
Expand All @@ -236,6 +266,7 @@ jobs:
done
./gradlew "${tasks[@]}"
- android/save-gradle-cache
- save-kotlin-native-compiler-to-cache

unit-tests-android:
executor: android202409
Expand All @@ -257,6 +288,7 @@ jobs:
steps:
- checkout
- android/restore-gradle-cache
- restore-kotlin-native-compiler-from-cache
- run:
name: Execute unit tests for iOS
command: |
Expand All @@ -266,6 +298,7 @@ jobs:
done
./gradlew "${tasks[@]}"
- android/save-gradle-cache
- save-kotlin-native-compiler-to-cache

publish:
description: "Publishes the SDK, either a SNAPSHOT or release version."
Expand All @@ -282,6 +315,7 @@ jobs:
- install-cocoapods-on-macos
- android/restore-gradle-cache
- android/restore-build-cache
- restore-kotlin-native-compiler-from-cache
- when:
condition: << parameters.snapshot >>
steps:
Expand All @@ -296,6 +330,7 @@ jobs:
command: bundle exec fastlane publish_if_release
- android/save-gradle-cache
- android/save-build-cache
- save-kotlin-native-compiler-to-cache

create-github-release:
description: "Creates a GitHub release for the current version"
Expand Down

0 comments on commit 3169ad3

Please sign in to comment.