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

[Feature] Github Actions Caching #24

Open
atticusrussell opened this issue Jun 29, 2023 · 0 comments
Open

[Feature] Github Actions Caching #24

atticusrussell opened this issue Jun 29, 2023 · 0 comments

Comments

@atticusrussell
Copy link
Owner

atticusrussell commented Jun 29, 2023

Is your feature request related to a problem? Please describe.
GitHub actions take a long time to run.

Describe the solution you'd like
I want to use caching like the CI actions from ROS_industrial do
Use github actions caching. https://github.com/actions/cache

# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git).
# For troubleshooting, see README (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst)

name: CI Industrial

on: # this determines when this workflow is run
  push:
  #   branches: [ master, melodic-devel ] #  when master or melodic-devel branch is pushed to
  pull_request:
  #   branches: [ master ] # when there is a pull request against master
  # schedule: # uncomment to run periodically
  #  - cron: '0 4 * * *' # every day at 4 AM (UTC)
  workflow_dispatch: # allow manually starting this workflow

jobs:
  industrial_ci:
    name: ROS ${{ matrix.ROS_DISTRO }} (${{ matrix.ROS_REPO }})
    runs-on: ubuntu-latest
    strategy:
      # fail-fast: false # uncomment if failing jobs should not cancel the others immediately
      matrix: # matrix is the product of entries
        # TODO add rolling once ci working
        ROS_DISTRO: [humble]
        ROS_REPO: [main]
        # exclude: # specific configuration can be excludes
        #   - {ROS_DISTRO: melodic, ROS_REPO: testing}
        # include: # add additional configurations
        #   - {ROS_DISTRO: kinetic, ROS_REPO: testing}
    env:
      CCACHE_DIR: "${{ github.workspace }}/.ccache" # directory for ccache (and how we enable ccache in industrial_ci)
    steps:
      - uses: actions/checkout@v3 # clone target repository
      - uses: actions/cache@v2 # fetch/store the directory used by ccache before/after the ci run
        with:
          path: ${{ env.CCACHE_DIR }}
          # This configuration will always create a new ccache cache starting off from the previous one (if any).
          # In this simple version it will be shared between all builds of the same ROS_REPO and ROS_REPO
          # and might need some fine-tuning to match the use case
          key: ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-${{github.run_id}}
          restore-keys: |
            ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-
      - run: |
          sudo apt update
          sudo apt install git -y --no-install-recommends
          sudo apt install build-essential -y --no-install-recommends
      - uses: 'ros-industrial/industrial_ci@master' # run industrial_ci
        env: # either pass all entries explicitly
          ROS_DISTRO: ${{ matrix.ROS_DISTRO }}
          ROS_REPO: ${{ matrix.ROS_REPO }}
        # with: # or pass the full matrix as config
        #    config: ${{toJSON(matrix)}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant