diff --git a/.github/workflows/pr-realm-js.yml b/.github/workflows/pr-realm-js.yml index f84b7ff8d4..98ffad4d05 100644 --- a/.github/workflows/pr-realm-js.yml +++ b/.github/workflows/pr-realm-js.yml @@ -121,6 +121,8 @@ jobs: run: | echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH + # in CI file timestamps change with every run so instead rely on file content hashing + # https://reactnative.dev/docs/build-speed#using-this-approach-on-a-ci - name: Configure ccache if: ${{ runner.os != 'Windows' }} run: ccache --set-config="compiler_check=content" @@ -167,7 +169,7 @@ jobs: MOCHA_REMOTE_EXIT_ON_ERROR: true SPAWN_LOGCAT: true # Pin the Xcode version - DEVELOPER_DIR: /Applications/Xcode_12.5.1.app + DEVELOPER_DIR: /Applications/Xcode_13.1.app runs-on: ${{ matrix.variant.runner }} strategy: fail-fast: false @@ -179,12 +181,12 @@ jobs: #- { os: windows, target: test, runner: windows-latest, environment: node} #- { os: windows, target: "test:main", runner: windows-latest, environment: electron } #- { os: windows, target: "test:renderer", runner: windows-latest, environment: electron } - - { os: darwin, target: "test:main", runner: macos-11, environment: electron } - - { os: darwin, target: "test:renderer", runner: macos-11, environment: electron } - - { os: darwin, target: test, runner: macos-11, environment: node } - - { os: android, target: "test:android", runner: macos-11, environment: react-native } - - { os: ios, target: "test:ios", runner: macos-11, environment: react-native } - #- { os: ios, target: "test:catalyst", runner: macos-11, environment: react-native } + - { os: darwin, target: "test:main", runner: macos-latest, environment: electron } + - { os: darwin, target: "test:renderer", runner: macos-latest, environment: electron } + - { os: darwin, target: test, runner: macos-latest, environment: node } + - { os: android, target: "test:android", runner: macos-latest, environment: react-native, arch: "armeabi-v7a" } + - { os: ios, target: "test:ios", runner: macos-latest, environment: react-native, arch: "apple" } + #- { os: ios, target: "test:catalyst", runner: macos-latest, environment: react-native, arch: "apple" } timeout-minutes: 60 steps: - name: Generate Cluster Differentiator @@ -240,6 +242,19 @@ jobs: if: ${{ runner.os == 'Windows' }} uses: ilammy/msvc-dev-cmd@v1 + - name: ccache + uses: hendrikmuhs/ccache-action@v1 + if: ${{ matrix.variant.environment == 'react-native' }} + with: + key: ${{ runner.os }}-${{ matrix.variant.os }}-${{ matrix.variant.arch }} + max-size: '2.0G' + + # in CI file timestamps change with every run so instead rely on file content hashing + # https://reactnative.dev/docs/build-speed#using-this-approach-on-a-ci + - name: Configure ccache + if: ${{ matrix.variant.environment == 'react-native' }} + run: ccache --set-config="compiler_check=content" + - name: Install IOS tools if: ${{ (matrix.variant.os == 'ios') }} run: | @@ -295,6 +310,17 @@ jobs: timeout-minutes: 45 run: ${{ env.wrapper }} npm run ${{ matrix.variant.target}} --prefix integration-tests/environments/${{ matrix.variant.environment }} + - name: Setup Java Gradle cache for android test app + if: ${{ (matrix.variant.os == 'android') }} + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Setup Android Emulator cache if: ${{ (matrix.variant.os == 'android') }} uses: actions/cache@v3.0.4 diff --git a/integration-tests/environments/react-native/android/gradle.properties b/integration-tests/environments/react-native/android/gradle.properties index b53f0a4ac6..8aeedf6921 100644 --- a/integration-tests/environments/react-native/android/gradle.properties +++ b/integration-tests/environments/react-native/android/gradle.properties @@ -37,4 +37,8 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 # your application. You should enable this flag either if you want # to write custom TurboModules/Fabric components OR use libraries that # are providing them. -newArchEnabled=false \ No newline at end of file +newArchEnabled=false + +# Gradle will try to reuse outputs from previous builds for all builds +# https://docs.gradle.org/current/userguide/build_cache.html#sec:build_cache_enable +org.gradle.caching=true diff --git a/integration-tests/environments/react-native/ios/Podfile b/integration-tests/environments/react-native/ios/Podfile index bda13e9dca..33f5e9c622 100644 --- a/integration-tests/environments/react-native/ios/Podfile +++ b/integration-tests/environments/react-native/ios/Podfile @@ -50,11 +50,13 @@ target 'RealmReactNativeTests' do config.build_settings['CODE_SIGN_IDENTITY[sdk=macosx*]'] = '-' end end - # Applying https://github.com/facebook/folly/issues/1470#issuecomment-943123653 - if target.name == "RCT-Folly" - target.build_configurations.each do |config| + target.build_configurations.each do |config| + if target.name == "RCT-Folly" + # Applying https://github.com/facebook/folly/issues/1470#issuecomment-943123653 config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'FOLLY_HAVE_CLOCK_GETTIME=1'] end + config.build_settings['CC'] = "../../../../../scripts/ccache-clang.sh" + config.build_settings['CXX'] = "../../../../../scripts/ccache-clang++.sh" end end end diff --git a/scripts/ccache-clang++.sh b/scripts/ccache-clang++.sh index 92d4c0d259..d205055002 100755 --- a/scripts/ccache-clang++.sh +++ b/scripts/ccache-clang++.sh @@ -1,9 +1,16 @@ #!/bin/sh if command -v ccache &> /dev/null; then +# reference for xcode specific cacche settings: reactnative docs and ccache manpage +# https://reactnative.dev/docs/build-speed#xcode-specific-setup +# https://ccache.dev/manual/4.3.html export CCACHE_MAXSIZE=10G export CCACHE_CPP2=true + export CCACHE_DIRECT=true + export CCACHE_DEPEND=true export CCACHE_HARDLINK=true - export CCACHE_SLOPPINESS=file_macro,time_macros,include_file_mtime,include_file_ctime,file_stat_matches + export CCACHE_FILECLONE=true + export CCACHE_INODECACHE=true + export CCACHE_SLOPPINESS=file_macro,time_macros,include_file_mtime,include_file_ctime,file_stat_matches,modules,ivfsoverlay,pch_defines,system_headers exec ccache clang++ "$@" else exec clang++ "$@" diff --git a/scripts/ccache-clang.sh b/scripts/ccache-clang.sh index adf64b60f6..7fb31f28af 100755 --- a/scripts/ccache-clang.sh +++ b/scripts/ccache-clang.sh @@ -1,9 +1,16 @@ #!/bin/sh if command -v ccache &> /dev/null; then +# reference for xcode specific cacche settings: reactnative docs and ccache manpage +# https://reactnative.dev/docs/build-speed#xcode-specific-setup +# https://ccache.dev/manual/4.3.html export CCACHE_MAXSIZE=10G export CCACHE_CPP2=true + export CCACHE_DIRECT=true + export CCACHE_DEPEND=true export CCACHE_HARDLINK=true - export CCACHE_SLOPPINESS=file_macro,time_macros,include_file_mtime,include_file_ctime,file_stat_matches + export CCACHE_FILECLONE=true + export CCACHE_INODECACHE=true + export CCACHE_SLOPPINESS=file_macro,time_macros,include_file_mtime,include_file_ctime,file_stat_matches,modules,ivfsoverlay,pch_defines,system_headers exec ccache clang "$@" else exec clang "$@"