diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c01fcf..4b136fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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}}]' @@ -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 @@ -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 @@ -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 # =================== diff --git a/.github/workflows/conda-deps.yml b/.github/workflows/conda-deps.yml new file mode 100644 index 0000000..a232488 --- /dev/null +++ b/.github/workflows/conda-deps.yml @@ -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 +