Skip to content

Update actions/cache action to v4 #3325

Update actions/cache action to v4

Update actions/cache action to v4 #3325

Workflow file for this run

name: CI
on:
# Only run push on main
push:
branches:
- main
paths-ignore:
- '**/*.md'
# Always run on PRs
pull_request:
branches: [ main ]
merge_group:
concurrency:
group: 'ci-${{ github.event.merge_group.head_ref || github.head_ref }}-${{ github.workflow }}'
cancel-in-progress: true
jobs:
build:
# Necessary to run full tests to cover iOS too
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: 'true'
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '20'
- name: Setup Gradle cache
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
cache-read-only: false
- name: Build and run checks
id: gradle-build
run: |
./gradlew --continue --no-configuration-cache \
check \
:samples:star:apk:assembleDebug \
:samples:counter:linkReleaseFrameworkIosX64 \
detektMain \
detektTest \
assembleAndroidTest
- name: Verify STAR desktop builds
id: gradle-build-star-desktop
run: |
./gradlew :samples:star:jvmJar -Pcircuit.buildDesktop
# Defer these until after the above run, no need to waste resources running them if there are other failures first
- name: Run instrumentation tests via emulator.wtf (main repo only)
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
id: gradle-instrumentation
env:
EW_API_TOKEN: ${{ secrets.EMULATOR_WTF_TOKEN }}
run: ./gradlew testReleaseWithEmulatorWtf
# Forks cannot run emulator.wtf tests due to not being able to use repo secrets, so for them
# we run the tests via the android-emulator-runner action instead
- name: Run instrumentation tests via local emulator (from forks only)
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
id: gradle-instrumentation-fork
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 21
arch: x86_64
disable-animations: true
disk-size: 6000M
heap-size: 600M
script: ./gradlew ciConnectedCheck --daemon
- name: (Fail-only) Upload reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: reports-build
path: |
**/build/reports/**
- name: Publish snapshot (main branch only)
if: github.repository == 'slackhq/circuit' && github.ref == 'refs/heads/main'
run: ./gradlew publish -PmavenCentralUsername=${{ secrets.SONATYPEUSERNAME }} -PmavenCentralPassword=${{ secrets.SONATYPEPASSWORD }} --no-configuration-cache
snapshots:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: 'true'
- name: Check LFS files
uses: actionsdesk/[email protected]
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '20'
- name: Verify Snapshots
id: gradle-snapshots
uses: gradle/gradle-build-action@v2
with:
arguments: verifyRoborazzi
gradle-home-cache-cleanup: true
cache-read-only: false
- name: (Fail-only) Upload reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: reports-snapshots
path: |
**/build/reports/**
**/src/test/snapshots/**/*_compare.png