Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable configuration cache sharing on CI #1812

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ concurrency:
jobs:
build:
runs-on: ubuntu-latest
env:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -36,6 +38,21 @@ jobs:

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
# Only save Gradle User Home state for builds on the 'main' branch.
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/main' }}

# Don't reuse cache entries from any other Job.
gradle-home-cache-strict-match: true

cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

# Limit the size of the cache entry.
# These directories contain instrumented/transformed dependency jars which can be reconstructed relatively quickly.
gradle-home-cache-excludes: |
caches/jars-9
caches/transforms-3

- name: Build and run checks
id: gradle-build
Expand Down Expand Up @@ -93,6 +110,8 @@ jobs:

build-ios:
runs-on: macos-14
env:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

steps:
- name: Checkout
Expand All @@ -118,6 +137,24 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
# Only save Gradle User Home state for builds on the 'main' branch.
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/main' }}

# Don't reuse cache entries from any other Job.
gradle-home-cache-strict-match: true

cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

# Limit the size of the cache entry.
# These directories contain instrumented/transformed dependency jars which can be reconstructed relatively quickly.
gradle-home-cache-excludes: |
caches/jars-9
caches/transforms-3

- run: brew install swiftlint

# TODO re-enable once fastlane fixes it https://github.com/fastlane/fastlane/issues/22191
Expand All @@ -135,6 +172,9 @@ jobs:

snapshots:
runs-on: ubuntu-latest
env:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -153,6 +193,24 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
# Only save Gradle User Home state for builds on the 'main' branch.
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/main' }}

# Don't reuse cache entries from any other Job.
gradle-home-cache-strict-match: true

cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

# Limit the size of the cache entry.
# These directories contain instrumented/transformed dependency jars which can be reconstructed relatively quickly.
gradle-home-cache-excludes: |
caches/jars-9
caches/transforms-3

- name: Verify Snapshots
id: gradle-snapshots
run: ./gradlew verifyRoborazzi --quiet
Expand Down Expand Up @@ -184,5 +242,8 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Publish snapshot (main branch only)
run: ./gradlew publish -PmavenCentralUsername=${{ secrets.SONATYPEUSERNAME }} -PmavenCentralPassword=${{ secrets.SONATYPEPASSWORD }} --no-configuration-cache --quiet