Skip to content

Commit

Permalink
fix(caching): fix/simplify cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Aug 8, 2023
1 parent d1a1c61 commit ad9673c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
34 changes: 2 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,48 +127,18 @@ Cache keys are composed from:
- runner OS
- repository owner
- repository name
- release tag
- date
- hash of code.json
- subset of binaries to install (if specified)

With format:

```
modflow-${{ runner.os }}-${{ inputs.owner }}-${{ inputs.repo }}-${{ %Y%m%d }}-${{ hashFiles('code.json') }}
modflow-${{ runner.os }}-${{ inputs.owner }}-${{ inputs.repo }}-${{ inputs.tag }}-${{ %Y%m%d }}
```

If the `subset` input is provided, an additional clause `-${{ inputs.subset }}` is appended to the key.

`code.json` is a version metadata JSON file released with the `executables` distribution, for instance:

```
{
"mf6": {
"current": true,
"dirname": "mf6.4.1_linux",
"double_switch": false,
"shared_object": false,
"srcdir": "src",
"standard_switch": true,
"url": "https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip",
"url_download_asset_date": "12/09/2022",
"version": "6.4.1"
},
"libmf6": {
"current": true,
"dirname": "mf6.4.1_linux",
"double_switch": false,
"shared_object": true,
"srcdir": "srcbmi",
"standard_switch": true,
"url": "https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip",
"url_download_asset_date": "12/09/2022",
"version": "6.4.1"
},
...
}
```

## MODFLOW Resources

- [MODFLOW and related programs](https://water.usgs.gov/ogw/modflow/)
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ runs:
id: cache-key
shell: bash
run: |
key="modflow-${{ runner.os }}-${{ inputs.owner }}-${{ inputs.repo }}-${{ steps.get-date.outputs.date }}-${{ hashFiles(steps.check-release.outputs.code_json) }}"
key="modflow-${{ runner.os }}-${{ inputs.owner }}-${{ inputs.repo }}-${{ inputs.tag }}-${{ steps.get-date.outputs.date }}"
if [[ "${{ inputs.subset }}" != "" ]]; then
subset="${{ inputs.subset }}"
subset=${subset//,/-} # replace commas with dashes
Expand Down

0 comments on commit ad9673c

Please sign in to comment.