Coder Social home page Coder Social logo

cache-conda-envs's People

Contributors

epassaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cache-conda-envs's Issues

Simplify matrix usage

Thanks for the examples and blog post about this. I had trouble working with your example because you defined each matrix environment separately so you could define a label and prefix. However, I usually use lists for my matrix entries like:

      matrix:
        os: ["windows-latest", "ubuntu-latest", "macos-latest"]
        python-version: ["3.9", "3.10"]

which means I can't easily define prefix/label (as far as I know). I cam up with an alternative that doesn't require the user to know what platform they are on by updating the DATE job:

      - name: Set cache environment variables
        shell: bash -l {0}
        run: |
          echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
          CONDA_PREFIX=$(python -c "import sys; print(sys.prefix)")
          echo "CONDA_PREFIX=$CONDA_PREFIX" >> $GITHUB_ENV

I also updated my cache entry to include the python version:

      - uses: actions/cache@v3
        with:
          path: ${{ env.CONDA_PREFIX }}
          key: ${{ matrix.os }}-${{matrix.python-version}}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
        id: cache

Document how to manually invalidate cache

Hello, thanks for this code and the great blog post explaining it! This has been very helpful for setting up decent GitHub actions with Conda environments.

I'm wondering if you might be able to explain here, or add to the documentation, the process for manually triggering a new build via the CACHE_NUMBER variable? That is, how is this variable incremented to invalidate the cache? Does this require changing the variable value in the workflow script (therefore requiring a new commit), or can it be done externally somehow when running the workflow? I think the latter might be possible using the repository secret variables, but I might be missing how to do it with the regular environment variables in the workflow as designed. Thanks!

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.