Skip to content

Commit

Permalink
Cache dependencies in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoGrieco committed Jan 25, 2023
1 parent 3516afb commit 1a3f284
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 13 deletions.
60 changes: 47 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
env:
#TODO change with first release after this commit
BipedalLocomotionFramework_TAG: c1cb3fa3329cae7515de6d453bc099dde2cd0645

action-restore-cache: 'true'
jobs:
build:
name: '[${{matrix.os}}@${{matrix.build_type}}]'
Expand All @@ -26,7 +26,12 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Get current day
shell: bash -l {0}
run: |
echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
# Use conda for main dependencies
- uses: conda-incubator/setup-miniconda@v2
Expand All @@ -50,19 +55,38 @@ jobs:
# ============
# DEPENDENCIES
# ============

- name: Restore cached conda based dependencies
if: ${{ env.action-restore-cache == 'true' }}
uses: actions/cache/restore@v3
with:
path: ${{ env.CONDA }}/envs/test
key: ${{ matrix.os }}-conda-${{ hashFiles('.github/workflows/conda-deps.yml') }}-${{ env.DATE }}
id: cache-restore-conda-deps

- name: Dependencies (using conda)
shell: bash -l {0}
if: steps.cache-restore-conda-deps.outputs.cache-hit != 'true'
run: |
# Compilation related dependencies
mamba install cmake compilers make ninja pkg-config
# Actual dependencies
mamba install yarp idyntree
#TODO remove these one once blf is installed with conda
mamba install spdlog
- name: Source-based Dependencies
if: steps.cache-source-deps.outputs.cache-hit != 'true'
mamba env update -f .github/workflows/conda-deps.yml
- name: Cache conda based dependencies
if: ${{ steps.cache-restore-conda-deps.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v3
with:
path: ${{ env.CONDA }}/envs/test
key: ${{ matrix.os }}-conda-${{ hashFiles('.github/workflows/conda-deps.yml') }}-${{ env.DATE }}
id: cache-save-conda-deps

- name: Restore cached source-based dependencies
if: ${{ env.action-restore-cache == 'true' && steps.cache-restore-conda-deps.outputs.cache-hit != 'true' }}
uses: actions/cache/restore@v3
with:
path: ${{env.GITHUB_WORKSPACE}}/install/deps
key: ${{ matrix.os }}-${{ matrix.build_type }}-source-${{env.BipedalLocomotionFramework_TAG}}-${{ env.DATE }}
id: cache-restore-source-deps

- name: Source-based dependencies
if: ${{ steps.cache-restore-conda-deps.outputs.cache-hit != 'true' || steps.cache-restore-source-deps.outputs.cache-hit != 'true' }}
shell: bash -l {0}
run: |
# bipedal-locomotion-framework
Expand All @@ -77,7 +101,17 @@ jobs:
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install/deps
cmake --build . --config ${{matrix.build_type}} --target install
- name: Cache source-based dependencies
if: ${{ steps.cache-restore-source-deps.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v3
with:
path: ${{env.GITHUB_WORKSPACE}}/install/deps
key: ${{ matrix.os }}-${{ matrix.build_type }}-source-${{env.BipedalLocomotionFramework_TAG}}-${{ env.DATE }}
id: cache-save-source-deps



# ===================
# CMAKE-BASED PROJECT
# ===================
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/conda-deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#we use the default conda-incubator/setup-miniconda env name
name: test
dependencies:
- cmake
- compilers
- make
- ninja
- pkg-config
- yarp
- idyntree
- spdlog

0 comments on commit 1a3f284

Please sign in to comment.