Code Monkey home page Code Monkey logo

ccache-action's Introduction

Ccache for gh actions

A Github action to speedup building using ccache for C/C++ projects.

Example usage

- name: ccache
  uses: hendrikmuhs/ccache-action@v1

NB! This should always come after the actions/checkout step.

In order to use ccache in your other steps, point the compiler to it, e.g. with run-cmake:

- name: build with cmake
  uses: lukka/run-cmake@v3
  with:
    cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
    cmakeAppendedArgs: '-DCMAKE_BUILD_TYPE=${{ matrix.type }} -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache'
    ...

or by manipulating PATH:

- name: build
  run: |
    export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"

(works for both ubuntu and macos)

Ccache gets installed by this action, if its not installed yet.

Configuration

If you have multiple targets(Debug, Release) and/or multiple OS's, it makes sense to cache them separately. An additional cache key can be specified. You can also specify the maximum cache size - default 500M (500 MB).

- name: ccache
  uses: hendrikmuhs/ccache-action@v1
  with:
    key: ${{ matrix.os }}-${{ matrix.type }}
    max-size: 100M

How it works

This action is based on https://cristianadam.eu/20200113/speeding-up-c-plus-plus-github-actions-using-ccache/

In a nutshell, the .ccache folder is configured in the runner path and the folder is persisted and reloaded using cache. For more details see: https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows.

Stats

Stats are provided as part of the post action, check the output to see if cache is effective.

You may also set verbose input to 1 to enable verbose output from this action or even to 2 to make it even more verbose.

Example workflow

ccache-action's People

Contributors

dependabot[bot] avatar hendrikmuhs avatar hansfn avatar jkflying avatar krlmlr avatar vadz avatar

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.