Skip to content

Commit

Permalink
Include bin hash in cache key (#228)
Browse files Browse the repository at this point in the history
Co-authored-by: Pavel Zwerschke <[email protected]>
  • Loading branch information
bhperry and pavelzw authored Oct 2, 2024
1 parent e751044 commit 59b1132
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./
- run: |
micromamba info | grep -q "environment : None (not found)"
micromamba info | grep -q "environment : base"
shell: bash -el {0}
micromamba-old-version-1:
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
condarc-file: 'test/.condarc'
- run: | # this should only work when the pytorch channel is loaded, i.e., the custom condarc is used
micromamba search pytorch=2.0.0
micromamba search pytorch=2.0.0 | grep -q "pytorch 2.0.0 py3.10_cpu_0"
micromamba search pytorch=2.0.0 | grep -q "pytorch 2.0.0 py3.10_cpu_0"
shell: bash -el {0}
conda-lock:
Expand Down
3 changes: 2 additions & 1 deletion dist/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-micromamba",
"version": "1.9.0",
"version": "1.10.0",
"private": true,
"description": "Action to setup micromamba",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const generateEnvironmentKey = (options: Options, prefix: string) => {
const envName = options.environmentName ? `-${options.environmentName}` : ''
const createArgs = options.createArgs ? `-args-${sha256Short(JSON.stringify(options.createArgs))}` : ''
const rootPrefix = `-root-${sha256Short(options.micromambaRootPath)}`
const key = `${prefix}${arch}${envName}${createArgs}${rootPrefix}`
const binHash = fs.readFile(options.micromambaBinPath).then(sha256)

const key = `${prefix}${arch}${envName}${createArgs}${rootPrefix}-bin-${binHash}`

if (options.environmentFile) {
return fs.readFile(options.environmentFile, 'utf-8').then((content) => {
Expand Down

0 comments on commit 59b1132

Please sign in to comment.