|
28 | 28 | default: '' |
29 | 29 | required: false |
30 | 30 | type: string |
| 31 | + ccache_dir: |
| 32 | + description: 'Local path to store cache (from "github.workspace"). For standard industrial_ci configuration do not have to be changed' |
| 33 | + default: '.ccache' |
| 34 | + required: false |
| 35 | + type: string |
| 36 | + basedir: |
| 37 | + description: 'Local path to workspace base directory to cache (from "github.workspace"). For standard industrial_ci configuration do not have to be changed' |
| 38 | + default: '.work' |
| 39 | + required: false |
| 40 | + type: string |
31 | 41 |
|
32 | 42 | jobs: |
33 | 43 | reusable_ici: |
34 | 44 | name: ${{ inputs.ros_distro }} ${{ inputs.ros_repo }} ${{ inputs.os_code_name }} |
35 | 45 | runs-on: ubuntu-latest |
36 | 46 | env: |
37 | 47 | DOCKER_RUN_OPTS: '-v /var/run/docker.sock:/var/run/docker.sock --network ursim_net' |
| 48 | + CCACHE_DIR: ${{ github.workspace }}/${{ inputs.ccache_dir }} |
| 49 | + BASEDIR: ${{ github.workspace }}/${{ inputs.basedir }} |
| 50 | + CACHE_PREFIX: ${{ inputs.ros_distro }}-${{ inputs.upstream_workspace }}-${{ inputs.ros_repo }}-${{ github.job }} |
38 | 51 | steps: |
39 | 52 | - name: Checkout ${{ inputs.ref }} when build is not scheduled |
40 | 53 | if: ${{ github.event_name != 'schedule' }} |
|
45 | 58 | with: |
46 | 59 | ref: ${{ inputs.ref_for_scheduled_build }} |
47 | 60 | - run: docker network create --subnet=192.168.56.0/24 ursim_net |
| 61 | + - name: cache target_ws |
| 62 | + if: ${{ ! matrix.env.CCOV }} |
| 63 | + |
| 64 | + with: |
| 65 | + path: ${{ env.BASEDIR }}/target_ws |
| 66 | + key: target_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('**/CMakeLists.txt', '**/package.xml') }}-${{ github.run_id }} |
| 67 | + restore-keys: | |
| 68 | + target_ws-${{ env.CACHE_PREFIX }}-${{ hashFiles('**/CMakeLists.txt', '**/package.xml') }} |
| 69 | + - name: cache ccache |
| 70 | + |
| 71 | + with: |
| 72 | + path: ${{ env.CCACHE_DIR }} |
| 73 | + key: ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }} |
| 74 | + restore-keys: | |
| 75 | + ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }} |
| 76 | + ccache-${{ env.CACHE_PREFIX }} |
48 | 77 | - uses: 'ros-industrial/industrial_ci@master' |
49 | 78 | env: |
50 | 79 | UPSTREAM_WORKSPACE: ${{ inputs.upstream_workspace }} |
51 | 80 | ROS_DISTRO: ${{ inputs.ros_distro }} |
52 | 81 | ROS_REPO: ${{ inputs.ros_repo }} |
53 | 82 | CMAKE_ARGS: -DUR_ROBOT_DRIVER_BUILD_INTEGRATION_TESTS=ON |
| 83 | + - name: prepare target_ws for cache |
| 84 | + if: ${{ always() && ! matrix.env.CCOV }} |
| 85 | + run: | |
| 86 | + du -sh ${{ env.BASEDIR }}/target_ws |
| 87 | + sudo find ${{ env.BASEDIR }}/target_ws -wholename '*/test_results/*' -delete |
| 88 | + sudo rm -rf ${{ env.BASEDIR }}/target_ws/src |
| 89 | + du -sh ${{ env.BASEDIR }}/target_ws |
0 commit comments