Code Monkey home page Code Monkey logo

buildcache-action's Introduction

Archived - feel free to fork!

With apologies, I no longer use buildcache at all (ccache started working with react-native compiles shortly after I tried buildcache, so I started using ccache)

I helped document ccache integration here https://reactnative.dev/docs/build-speed#use-a-compiler-cache

As such I have no particular interest in this software and will not be maintaining it. Please feel free to fork it and continue development if you like

Accelerate builds using buildcache

Use this GitHub Action to accelerate compilation in your GitHub workflows using buildcache

Compilation Improvement Example

Usage

  1. Workflow integration
  2. Build integration
  3. ??
  4. Profit

Workflow Integration

Default Style

The defaults fit most projects well.

The defaults definitely fit react-native projects well.

jobs:
  ios:
  runs-on: macos-latest # also runs on ubuntu and windows
  steps:
    - uses: mikehardy/buildcache-action@v2
  • 500MB cache, cache is in $GITHUB_WORKSPACE, just needs build integration and you're set!

When using with actions/checkout@v2, add this action as a step after the checkout, or the buildcache binary will be clobbered in the post-job cleanup of the checkout action:

steps:
  - uses: actions/checkout@v3
  - uses: mikehardy/buildcache-action@v2

Customize if you need to

All buildcache options are available to override via environment variables set in the workflow env area

A few options are used internally by this action, but if you override them this action will respect the override you have set.

jobs:
  ios:
    env: # overrides: https://github.com/mbitsnbites/buildcache/blob/master/doc/configuration.md
      BUILDCACHE_DIR: ../.buildcache # optional: Put the cache somewhere else
      BUILDCACHE_DEBUG: 2 # optional: If you need more logging?
      BUILDCACHE_MAX_CACHE_SIZE: 1000000000 # optional: Need a bigger cache?
      BUILDCACHE_LOG_FILE: ../buildcache.log # optional: Log where you like
  runs-on: macos-latest
  steps:
    - uses: mikehardy/buildcache-action@v2
      with:
        cache_key: ${{ matrix.os }} # optional: separate caches maybe?
        upload_buildcache_log: 'true' # optional: 100% cache misses? Find out why
        zero_buildcache_stats: 'false' # optional: lifetime vs per-run stats?

Build Integration

buildcache is available now, but is unused until you call clang andclang++ wrapped by buildcache.

Xcode puts clang and clang++ on your PATH (in /usr/bin), and this action puts buildcache wrappers for it in your PATH first, before the normal Xcode ones.

This PATH manipulation is the key to an easy build integration.

You may rely on calling clang and clang++ from PATH at all times, instead of via fully-specified paths. In environments where buildcache is availble, it will work. In environments that do not have buildcache, it will still work

Minimal change: override compiler on command line

If you want to isolate the integration to the Github Actions CI environment, run your Xcode build using specific overrides.

xcodebuild CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ <all other parameters>`

Here is a real example of a project integrating it this way

Maximum change: allow buildcache use everywhere

After seeing the acceleration, you may want to use buildcache locally as well (I do!)

This is possible if you change your project definition to override the compiler to use the value from PATH all the time. This should be backwards-compatible - it should still work on machines that do not have buildcache installed, but it is more intrusive because it changes your Xcode project file.

You can may do this via a Podfile hook like this:

    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings["CC"] = "clang"
        config.build_settings["LD"] = "clang"
        config.build_settings["CXX"] = "clang++"
        config.build_settings["LDPLUSPLUS"] = "clang++"
      end
    end

Verification

How do you know it is working?

The overall buid time should make it obvious, but the real test is your cache hit/miss rate.

To verify things are working using the default configuration, look at the output of the workflow run, expand the "Post buildcache" step and check the statistics printed out. If you you "Re-run jobs" using the GitHub Actions web interface to re-run a job a second time, you should see 100% hit rate, on quite a few objects.

The output of this repositories react-native compile test action are a good example.

If you need more information, the default BUILDCACHE_DEBUG level of 2 is likely enough, you just need to add the upload_buildcache_log flag to your workflow integration and set it to true, then you may examine the actual output of buildcache as it worked, using the logfile attached as an artifact to the workflow run. If that still is not enough you may need a debug level of 1 See Debugging Buildcache for more information.

In practice, that is all I have needed to do to be certain the integration was successful in other projects.

Benchmarks - 40-50% improvement

iOS compile performance improvements of approximately 40-50% may be expected when using this action

  • macos-latest, warm cache, react-native-firebase app with all modules: 5min 52s (vs 10min)
  • macos-latest, warm cache, react-native 0.64 demo app without Flipper: 2min 55s (vs 5min 20s)
  • macos-latest, warm cache, react-native-vision-camera: 7min 13s (vs 13min 13s)

The first build - the "cold" cache case - will be slower by around 15%, since buildcache has overhead to determine if it can use the cached object or not. On the cache miss case it then delegates to the compiler and stores the object for the next run which takes longer than a normal compile call.

If you experience low cache hit rates on a project with a largely static codebase (i.e., one that should be very cacheable and 2 runs with nearly no changes do not cache for some reason), you should definitely increase the debugging level for the buildcache log and examine stats output before and after each run. A common and easy fix may be as simple as increasing your cache size.

Implementation Details

Approach

This action does these things - if they interact poorly with your project, perhaps they could be altered slightly and made to work better if you propose a PR:

  • fetches the latest version of buildcache
  • installs it in your project directory as buiildcache/bin/buildcache
  • makes symoblic links from buildcache to clang and clang++
  • adds that directory to your $GITHUB_PATH for future steps
  • configures the cache directory (defaults to .buildcache in your project directory if not set via environment variable)
  • configures buildcache storage limit (defaults to 500MB if not set via environment variable)
  • restores previous caches, and at the end saves the current one
  • turns on BUILDCACHE_DEBUG=2 if not set in environment variable
  • will upload debug log if BUILDCACHE_DEBUG is not -1 and if upload_buildcache_log is true
  • zeros cache stats by default after restore, so you get clean stats per-run, zero_buildcache_stats can disable it

Things that don't work

  • Direct mode did not work in testing when compiling react-native apps. Dependency files aren't created, but are needed. Direct mode is not enabled.
  • ccache did not work when compiling react-native apps. It can't handle "multiple source files" so cache misses all the time.
  • copying buildcache to clang and clang++, it has to be symbolic links. This means this is not quite a drop-in replacement on windows

Contributing

If you set up a personal access token on GitHub, then export it as well as a couple other items, the whole thing runs well from a local mac for development.

export GITHUB_TOKEN=PERSONALACCESSTOKENHERE

I usually have two terminals open side by side, one with yarn build-watch and one to run yarn test

PRs are welcome. This action is new and is in the "works for me" and "works for react-native-firebase" state, so it is useful, but maybe not generic enough to be useful for others yet.

Inspiration + Gratitude

I work on react-native-firebase and FlutterFire for Invertase and they have a truly inspiring dedication to automated testing. I sincerely love it, but...CI is slow for iOS testing!

I was inspired to try iOS compile acceleration after seeing Codified applying ccache with 10-20% improvements to CI Xcode builds, but it wasn't packaged up or redistributable

I then found ccache-action - Henrik has done a great job there! Unfortunately in my testing with react-native projets ccache did not speed things up much because ccache misses cache on "multiple_source_files" compile calls, and that is seemingly all react-native projects do. ccache-action was the inspiration for this action though, thanks Hendrik!

Then I found buildcache and saw with a quick test I could achieve nearly 50% performance improvements

Combining the motivation to try it, the template of the idea already existing with ccache, and the good performance of buildcache and here we are.

buildcache-action's People

Contributors

casconed avatar dependabot[bot] avatar gillycheesesteak avatar johanblumenberg avatar mikehardy avatar orgads avatar radko93 avatar xtvaser avatar yjose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

buildcache-action's Issues

Is this action working with yukiarrr/[email protected]

Hey @mikehardy, thank you for the great work on this action ๐Ÿ™

I would like to know if this action is supposed to work with yukiarrr/ios-build-action as I didn't see any time reduction after integrating it with our workflow

Here is the complete workflow :

name: IOS Build

on:
  workflow_dispatch:
  release:
    types: [published]

jobs:
  ios-build:
    name: IOS Build
    runs-on: macOS-latest
    defaults:
      run:
        working-directory: ios

    steps:
      - name: Cancel Previous Runs
        uses: styfle/[email protected]
        with:
          access_token: ${{ github.token }}
      - name: Check out Git repository
        uses: actions/checkout@v2

      - name: Get yarn cache directory path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)"
      - name: Restore node_modules from cache
        uses: actions/cache@v2
        id: yarn-cache
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-
      - name: Install dependencies
        run: yarn install --frozen-lockfile --network-timeout 300000

      - name: Restore buildcache
        uses: mikehardy/buildcache-action@v1
        continue-on-error: true

      - name: Setup Ruby (bundle)
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 2.6
          bundler-cache: true

      - name: Restore Pods cache
        uses: actions/cache@v2
        with:
          path: |
            ios/Pods
            ~/Library/Caches/CocoaPods
            ~/.cocoapods
          key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-pods-
      - name: Install Pods
        run: yarn setup:ios

      - name: Build IOS App
        uses: yukiarrr/[email protected]
        with:
          project-path: ios/TestApp.xcodeproj
          p12-base64: ${{ secrets.P12_BASE64 }}
          mobileprovision-base64: ${{ secrets.MOBILEPROVISION_BASE64 }}
          code-signing-identity: 'iPhone Distribution'
          team-id: ${{ secrets.TEAM_ID }}
          certificate-password: ${{ secrets.CERTIFICATE_PASSWORD }}
          workspace-path: ios/TestApp.xcworkspace

      - name: Upload Artifact
        uses: actions/upload-artifact@v2
        with:
          name: Test IOS IPA
          path: 'output.ipa'

      - name: 'Upload app to TestFlight'
        uses: apple-actions/upload-testflight-build@v1
        with:
          app-path: 'output.ipa'
          issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
          api-key-id: ${{ secrets.APPSTORE_API_KEY_ID }}
          api-private-key: ${{ secrets.APPSTORE_API_PRIVATE_KEY }}

Need to mention that I am seeing a warning message at the end related to mikehardy/buildcache-action@v1
buildcache: unable to delete buildcache.log Error: ENOENT: no such file or directory, unlink '/Users/runner/work/test-mobile/test-mobile/.buildcache/buildcache.log'

Not working for Expo - buildcache: not saving empty cache.

I'm trying to use this as part of my workflow where I run eas build with the --local option so that the build happens in the actions runner. There is no cache saved in this case. Am I missing something or does this action not support expo?

Post Run output :

Post job cleanup.
/home/runner/work/expo-demo/expo-demo/buildcache/bin/buildcache -s
Cache status:
  Entries in cache:  0
  Cache size:        0 bytes (0.0%)
  Direct hits:       0
  Direct misses:     0
  Local hits:        0
  Local misses:      0
  Remote hits:       0
  Remote misses:     0
  Misses:            0
  Direct hit ratio:  0.0%
  Local hit ratio:   0.0%
  Remote hit ratio:  0.0%
  Hit ratio:         0.0%
Warning: buildcache: unable to delete buildcache.log Error: ENOENT: no such file or directory, unlink '/home/runner/work/expo-demo/expo-demo/.buildcache/buildcache.log'
buildcache: not saving empty cache.

After using the action, the cache is stil empty.

Hi, thanks for providing such a cool project ๐Ÿ˜„

I tried to set up the action and integrate it into our build. However, I am having some trouble to get it to work, I am not sure if the issue is me (most probably), the action, or buildcache itself.

I made this PR to enable the usage on my project:
https://github.com/continental/ecal/pull/503/files

For CMake I am enabling buildcache with CMake variables, like suggested in the buildcache docs.

I build first the branch, then the PR. I assumed that the branch build would store the Cache. Then the PR build could use.

On my Ubuntu build, it says a cache has been stored, but then none was retrieved in the consecutive build.

On Windows, it seems that even after the build, the cache is empty.

Are there any suggestions for me or other resources? Do additional steps need to be taken to successfully restore the cache? Under what circumstances does it work on Window?

Thanks a lot!

Finish semantic-release install + configure

semantic-release correctly doing changelog generation and release type + tag, but:

  • the changelog was generated but not committed before the tag+push
  • github release was not created - the tag exists but it would be better to create a release + include the changelog chunk as notes automagically
  • it should be run from a github workflow

Originally posted by @mikehardy in #36 (comment)

can i use with gym

Hi
I'm using Fastlane and building ios with gym and I cant quietly figure out how to make it work I will appreciate it if you can help me
thanks

Node.js 12 actions are deprecated

I'm getting this error while running the buildcache-action:

Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/

Is it possible to update your action.yml to reflect a newer version of node?

Add option to silent failures

Sometimes this action will fail in the setup or cleanup step in a GHA job. See an example log.

I'm not 100% sure why it fails, but Firebase uses this action extensively so it may be related to PRs that trigger a lot of CI jobs.

What do you think about a config option to silent such failures? The idea would be that the action runs on a best effort basis and never causes the action to fail when something like a transient network error occurs in either the cache setup or teardown steps?

Error in post job cleanup

Using this action with

- name: Use build cache
  uses: mikehardy/buildcache-action@v1

I get the following error in the post-job cleanup:

Post job cleanup.
(node:1069) UnhandledPromiseRejectionWarning: Error: Unable to locate executable file: buildcache. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
    at Object.<anonymous> (/Users/runner/work/_actions/mikehardy/buildcache-action/v1/dist/webpack:/buildcache-action/node_modules/@actions/io/lib/io.js:187:1)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/runner/work/_actions/mikehardy/buildcache-action/v1/dist/webpack:/buildcache-action/node_modules/@actions/io/lib/io.js:5:1)
(node:1069) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1069) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Subsequent runs have a cache status with zeros across the board:

Cache status:
  Entries in cache:  0
  Cache size:        0 bytes (0.0%)
  Direct hits:       0
  Direct misses:     0
  Local hits:        0
  Local misses:      0
  Remote hits:       0
  Remote misses:     0
  Misses:            0
  Direct hit ratio:  0.0%
  Local hit ratio:   0.0%
  Remote hit ratio:  0.0%
  Hit ratio:         0.0%

Here are the full logs from the first step:

Run mikehardy/buildcache-action@v1
  with:
    access_token: ***
    install_dir: /Users/runner/work/***/***
    upload_buildcache_log: false
    zero_buildcache_stats: true
  env:
    CI: true
    FIREBASE_TOKEN: ***
    MY_KEYCHAIN: tmp-keychain
buildcache: release file based on runner os is buildcache-macos.zip
buildcache: installing from https://github.com/mbitsnbites/buildcache/releases/download/v0.27.1/buildcache-macos.zip
buildcache: download path /Users/runner/work/_temp/9b149fea-5053-46ef-abe1-a5b18d373e01
/usr/bin/unzip -q /Users/runner/work/_temp/9b149fea-5053-46ef-abe1-a5b18d373e01
buildcache: unpacked folder /Users/runner/work/***/***
/bin/ln -s /Users/runner/work/***/***/buildcache/bin/buildcache /Users/runner/work/***/***/buildcache/bin/clang
/bin/ln -s /Users/runner/work/***/***/buildcache/bin/buildcache /Users/runner/work/***/***/buildcache/bin/clang++
buildcache: no cache for key buildcache-2021-10-02T05:29:57.900Z or buildcache - cold cache or invalid key
/Users/runner/work/***/***/buildcache/bin/buildcache -c
Configuration file: /Users/runner/work/***/***/.buildcache/config.json

  BUILDCACHE_ACCURACY:               DEFAULT
  BUILDCACHE_CACHE_LINK_COMMANDS:    false
  BUILDCACHE_COMPRESS:               true
  BUILDCACHE_COMPRESS_FORMAT:        DEFAULT
  BUILDCACHE_COMPRESS_LEVEL:         -1
  BUILDCACHE_DEBUG:                  2
  BUILDCACHE_DIR:                    /Users/runner/work/***/***/.buildcache
  BUILDCACHE_DIRECT_MODE:            false
  BUILDCACHE_DISABLE:                false
  BUILDCACHE_HARD_LINKS:             false
  BUILDCACHE_HASH_EXTRA_FILES:       
  BUILDCACHE_IMPERSONATE:            
  BUILDCACHE_LOG_FILE:               /Users/runner/work/***/***/.buildcache/buildcache.log
  BUILDCACHE_LUA_PATH:               /Users/runner/work/***/***/.buildcache/lua
  BUILDCACHE_MAX_CACHE_SIZE:         500000000 (476.8 MiB)
  BUILDCACHE_MAX_LOCAL_ENTRY_SIZE:   134217728 (128.0 MiB)
  BUILDCACHE_MAX_REMOTE_ENTRY_SIZE:  134217728 (128.0 MiB)
  BUILDCACHE_PERF:                   false
  BUILDCACHE_PREFIX:                 
  BUILDCACHE_READ_ONLY:              false
  BUILDCACHE_READ_ONLY_REMOTE:       false
  BUILDCACHE_REMOTE:                 
  BUILDCACHE_REMOTE_LOCKS:           false
  BUILDCACHE_S3_ACCESS:              
  BUILDCACHE_S3_SECRET:              
  BUILDCACHE_TERMINATE_ON_MISS:      false
/Users/runner/work/***/***/buildcache/bin/buildcache -s
Cache status:
  Entries in cache:  0
  Cache size:        0 bytes (0.0%)
  Direct hits:       0
  Direct misses:     0
  Local hits:        0
  Local misses:      0
  Remote hits:       0
  Remote misses:     0
  Misses:            0
  Direct hit ratio:  0.0%
  Local hit ratio:   0.0%
  Remote hit ratio:  0.0%
  Hit ratio:         0.0%
buildcache: zeroing stats - stats display in cleanup task will be for this run only.
/Users/runner/work/***/***/buildcache/bin/buildcache -z

Allow config of all parts of buildcache

Not sure how to do that, maybe offer a full copy of the JSON file or something - I'd like to not have to track the options from upstream - better to just allow a full passthrough behavior

Fix github react-native compile workflow to upload from non-relative path

These are actually more serious - I'm not sure exactly how to fail the react-native compile test based on this type of failure (I did not spend much time investigating though, TBH - I just visually inspect), but there's a problem here

https://github.com/mikehardy/buildcache-action/pull/34/checks?check_run_id=3125987994#step:27:20


Warning: buildcache: unable to upload buildlog: Error: File ../custom_buildcache.log does not exist
Warning: buildcache: unable to delete buildcache.log Error: ENOENT: no such file or directory, unlink '../custom_buildcache.log'
buildcache: saving cache with key "buildcache-react-native-compile-2021-07-21T16:28:25.384Z".
Warning: buildcache: caching not working: AssertionError [ERR_ASSERTION]: Invalid pattern '../custom_buildcache_dir'. Relative pathing '.' and '..' is not allowed.

Originally posted by @mikehardy in #34 (comment)

Action fails on Windows

See for example this run on this commit.

Output:

Run mikehardy/buildcache-action@v1
  with:
    cache_key: x64-windows
    access_token: ***
    install_dir: D:\a\scummvm\scummvm
    upload_buildcache_log: false
    zero_buildcache_stats: true
  env:
    CONFIGURATION: Analysis
    PLATFORM: x64
    BUILDCACHE_MAX_CACHE_SIZE: 2000000000
    BUILDCACHE_IMPERSONATE: cl.exe
    CLToolExe: buildcache.exe
buildcache: release file based on runner os is buildcache-windows.zip
buildcache: installing from https://github.com/mbitsnbites/buildcache/releases/download/v0.27.1/buildcache-windows.zip
buildcache: download path D:\a\_temp\bf03fceb-a1fc-4964-b976-6b7bb4acb7b3
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('D:\a\_temp\bf03fceb-a1fc-4964-b976-6b7bb4acb7b3', 'D:\a\scummvm\scummvm')"
buildcache: unpacked folder D:\a\scummvm\scummvm
buildcache: no cache for key buildcache-x64-windows-2021-07-18T20:07:51.073Z or buildcache-x64-windows - cold cache or invalid key
D:\a\scummvm\scummvm\buildcache\bin\buildcache.exe -c
BuildCache[5308] (FATAL) Unexpected error: Could not find the executable file.
Error: buildcache: failure during restore: Error: The process 'D:\a\scummvm\scummvm\buildcache\bin\buildcache.exe' failed with exit code 1
Error: Error: The process 'D:\a\scummvm\scummvm\buildcache\bin\buildcache.exe' failed with exit code 1

buildcache: failure during restore - /buildcache/bin/clang: File exists

My first run after setting this up completed successfully and wrote to the cache, but then when trying again I'm getting this error trying to restore from the cache:

Run mikehardy/buildcache-action@v2
buildcache: release file based on runner os is buildcache-macos.zip
buildcache: installing from https://github.com/mbitsnbites/buildcache/releases/download/v0.28.2/buildcache-macos.zip
##[debug]Downloading https://github.com/mbitsnbites/buildcache/releases/download/v0.28.2/buildcache-macos.zip
##[debug]Destination /Users/runner/work/_temp/1dfa4221-bd80-4a48-b622-9[37](https://github.com/***/***-app-v4/actions/runs/4567835920/jobs/8062288634#step:4:38)474b53ace
##[debug]download complete
buildcache: download path /Users/runner/work/_temp/1dfa4221-bd80-4a48-b622-937474b53ace
/usr/bin/unzip -o /Users/runner/work/_temp/1dfa4221-bd80-4a48-b622-937474b53ace
Archive:  /Users/runner/work/_temp/1dfa[42](https://github.com/***/***-app-v4/actions/runs/4567835920/jobs/8062288634#step:4:43)21-bd80-4a48-b622-937474b53ace
  inflating: buildcache/bin/buildcache  
  inflating: buildcache/share/lua-examples/echo_wrapper.lua  
  inflating: buildcache/share/lua-examples/ti_c6x_wrapper.lua  
  inflating: buildcache/share/lua-examples/gcc_wrapper.lua  
  inflating: buildcache/share/lua-examples/clang_tidy_wrapper.lua  
buildcache: unpacked folder /Users/runner/work/***-app-v4/***-app-v4
/bin/ln -s /Users/runner/work/***-app-v4/***-app-v4/buildcache/bin/buildcache /Users/runner/work/***-app-v4/***-app-v4/buildcache/bin/clang
ln: /Users/runner/work/***-app-v4/***-app-v4/buildcache/bin/clang: File exists
Error: buildcache: failure during restore: Error: The process '/bin/ln' failed with exit code 1
Error: Error: The process '/bin/ln' failed with exit code 1
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Run mikehardy/buildcache-action@v2

Here's the first 3 steps of my GitHub action:

    steps:
      - uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: 'latest-stable'

      - uses: actions/checkout@v3

      - uses: mikehardy/buildcache-action@v2

buildcache very small with Flutter

You mention FlutterFire in the Readme, so I'm assuming you have some advice. The size of the buildcache is quite small on my Flutter project. Do you have any recommendations for different config I could try?

Post job cleanup.
/Users/runner/work/my-app/my-app/buildcache/bin/buildcache -s
Cache status:
Entries in cache:  3
Cache size:        534.1 KiB (0.1%)
Direct hits:       0
Direct misses:     0
Local hits:        0
Local misses:      3
Remote hits:       0
Remote misses:     0
Misses:            3
Direct hit ratio:  0.0%
Local hit ratio:   0.0%
Remote hit ratio:  0.0%
Hit ratio:         0.0%
Starting artifact upload
For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging
Artifact name is valid!
Container for artifact "buildcache_log" successfully created. Starting upload of file(s)
Total size of all the files uploaded is 150 bytes
File upload process has finished. Finalizing the artifact upload
Artifact has been finalized. All files have been successfully uploaded!

The raw size of all the files that were specified for upload is 213 bytes
The size of all the files that were uploaded is 150 bytes. This takes into account any gzip compression used to reduce the upload size, time and storage

Note: The size of downloaded zips can differ significantly from the reported size. For more information see: https://github.com/actions/upload-artifact#zipped-artifact-downloads 

buildcache: uploaded buildcache.log file (consumed 150 bytes of artifact storage)
buildcache: saving cache with key "buildcache-2022-08-27T16:22:36.994Z".
/usr/local/bin/gtar --posix --use-compress-program zstd -T0 -cf cache.tzst --exclude cache.tzst -P -C /Users/runner/work/my-app/my-app --files-from manifest.txt --delay-directory-restore
Cache Size: ~0 MB (407961 B)
Cache saved successfully

Integration to any CI/CD or even in Local

Hi !
First of all, thanks for your work, amazing !
I was wondering if it was possible to get some help to make this more "available" for everyone, people who don't run Github Actions in particular. Any ideas on how to achieve that ? I found this link here that explains how to setup buildcache, but not how to cache builds, etc. Would be awesome if you could shed some light here !
Thanks in advance.

Add the ability to disable automatic symlink

Hi! Thank you for the awesome action.
Could you add an option to disable symlinks? I use this action to build CMake C++ projects with different compilers and use it by simply passing -D CMAKE_C_COMPILER_LAUNCHER=buildcache to configure arguments. And when I need clang as a compiler, then I have problems with duplicate buildcache.

Action giving zero hits for macOS Xcode Swift project

I am trying to integrate this action into my workflow:

jobs:
  build:
    name: Build
    runs-on: macos-11
    timeout-minutes: 30
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.head.sha }}
      - name: Setup Xcode
        uses: my_company/github-actions/setup-xcode@master
      - name: Restore buildcache
        uses: mikehardy/buildcache-action@v1
        continue-on-error: true
        with:
          upload_buildcache_log: "true"
      - name: Install SwiftLint
        run: |
          rm -f '/usr/local/bin/swiftlint'
          brew reinstall swiftlint
      - name: Lint Swift source files
        run: |
          swiftlint lint --strict --quiet
      - name: Install XcodeGen
        run: |
          brew install xcodegen
      - name: Cache SPM dependencies
        uses: actions/cache@v2
        with:
          path: |
            .buildSPM
          key: ${{ runner.os }}-spm-${{ hashFiles('MyProject.xcodeproj/**/Package.resolved') }}
          # Fallback key if Package.resolved cannot be found (since we regenerate the project)
          restore-keys: |
            ${{ runner.os }}-spm-
      - name: Generate Xcode project
        run: |
          xcodegen generate
      - name: Install xcpretty
        run: |
          gem install xcpretty
      - name: Build
        # Specify clonedSourcePackagesDirPath for SPM caching to work
        run: |
          xcodebuild CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ -derivedDataPath build -UseModernBuildSystem=YES -project MyProject.xcodeproj -clonedSourcePackagesDirPath .buildSPM -scheme MainScheme CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO OTHER_CFLAGS="-Wno-ambiguous-macro" build -quiet

The project is written in Swift with SPM and it's macOS project.

It only shows hits on some dependencies:

build/Build/Intermediates.noindex/Sentry.build

I cannot make it work. Should it work or macOS is not supported?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.