Support passing files to hash in repository-cache
This commit is contained in:
parent
527d41d462
commit
5058960dd0
6 changed files with 60 additions and 23 deletions
22
README.md
22
README.md
|
|
@ -178,8 +178,30 @@ Default `""`.
|
||||||
|
|
||||||
Enable [`repository_cache`][3] and store it on GitHub based on contents of `MODULE.bazel` and `WORKSPACE` files.
|
Enable [`repository_cache`][3] and store it on GitHub based on contents of `MODULE.bazel` and `WORKSPACE` files.
|
||||||
|
|
||||||
|
You can also pass a file (or list of files) which contents are used to calculate cache key.
|
||||||
|
|
||||||
Default `false`.
|
Default `false`.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Examples</summary>
|
||||||
|
|
||||||
|
#### Store a single repository cache
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: p0deje/setup-bazel@0.7.1
|
||||||
|
with:
|
||||||
|
repository-cache: true
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Store a repository cache from a custom location
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: p0deje/setup-bazel@0.7.1
|
||||||
|
with:
|
||||||
|
repository-cache: examples/gem/WORKSPACE
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
## Migrating from [`bazelbuild/setup-bazelisk`][6]
|
## Migrating from [`bazelbuild/setup-bazelisk`][6]
|
||||||
|
|
||||||
You can simply replace `bazelbuild/setup-bazelisk` action with `p0deje/setup-bazel`.
|
You can simply replace `bazelbuild/setup-bazelisk` action with `p0deje/setup-bazel`.
|
||||||
|
|
|
||||||
19
config.js
19
config.js
|
|
@ -46,9 +46,19 @@ if (diskCacheEnabled) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const repositoryCacheEnabled = core.getBooleanInput('repository-cache')
|
const repositoryCacheConfig = core.getInput('repository-cache')
|
||||||
|
const repositoryCacheEnabled = repositoryCacheConfig !== 'false'
|
||||||
|
let repositoryCacheFiles = [
|
||||||
|
'MODULE.bazel',
|
||||||
|
'WORKSPACE.bazel',
|
||||||
|
'WORKSPACE.bzlmod',
|
||||||
|
'WORKSPACE'
|
||||||
|
]
|
||||||
if (repositoryCacheEnabled) {
|
if (repositoryCacheEnabled) {
|
||||||
bazelrc.push(`build --repository_cache=${bazelRepository}`)
|
bazelrc.push(`build --repository_cache=${bazelRepository}`)
|
||||||
|
if (repositoryCacheConfig !== 'true') {
|
||||||
|
repositoryCacheFiles = Array(repositoryCacheConfig).flat()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const googleCredentials = core.getInput('google-credentials')
|
const googleCredentials = core.getInput('google-credentials')
|
||||||
|
|
@ -137,12 +147,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
repositoryCache: {
|
repositoryCache: {
|
||||||
enabled: repositoryCacheEnabled,
|
enabled: repositoryCacheEnabled,
|
||||||
files: [
|
files: repositoryCacheFiles,
|
||||||
'MODULE.bazel',
|
|
||||||
'WORKSPACE.bazel',
|
|
||||||
'WORKSPACE.bzlmod',
|
|
||||||
'WORKSPACE'
|
|
||||||
],
|
|
||||||
name: 'repository',
|
name: 'repository',
|
||||||
paths: [bazelRepository]
|
paths: [bazelRepository]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
19
dist/main/index.js
vendored
19
dist/main/index.js
vendored
|
|
@ -52,9 +52,19 @@ if (diskCacheEnabled) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const repositoryCacheEnabled = core.getBooleanInput('repository-cache')
|
const repositoryCacheConfig = core.getInput('repository-cache')
|
||||||
|
const repositoryCacheEnabled = repositoryCacheConfig !== 'false'
|
||||||
|
let repositoryCacheFiles = [
|
||||||
|
'MODULE.bazel',
|
||||||
|
'WORKSPACE.bazel',
|
||||||
|
'WORKSPACE.bzlmod',
|
||||||
|
'WORKSPACE'
|
||||||
|
]
|
||||||
if (repositoryCacheEnabled) {
|
if (repositoryCacheEnabled) {
|
||||||
bazelrc.push(`build --repository_cache=${bazelRepository}`)
|
bazelrc.push(`build --repository_cache=${bazelRepository}`)
|
||||||
|
if (repositoryCacheConfig !== 'true') {
|
||||||
|
repositoryCacheFiles = Array(repositoryCacheConfig).flat()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const googleCredentials = core.getInput('google-credentials')
|
const googleCredentials = core.getInput('google-credentials')
|
||||||
|
|
@ -143,12 +153,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
repositoryCache: {
|
repositoryCache: {
|
||||||
enabled: repositoryCacheEnabled,
|
enabled: repositoryCacheEnabled,
|
||||||
files: [
|
files: repositoryCacheFiles,
|
||||||
'MODULE.bazel',
|
|
||||||
'WORKSPACE.bazel',
|
|
||||||
'WORKSPACE.bzlmod',
|
|
||||||
'WORKSPACE'
|
|
||||||
],
|
|
||||||
name: 'repository',
|
name: 'repository',
|
||||||
paths: [bazelRepository]
|
paths: [bazelRepository]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
19
dist/post/index.js
vendored
19
dist/post/index.js
vendored
|
|
@ -52,9 +52,19 @@ if (diskCacheEnabled) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const repositoryCacheEnabled = core.getBooleanInput('repository-cache')
|
const repositoryCacheConfig = core.getInput('repository-cache')
|
||||||
|
const repositoryCacheEnabled = repositoryCacheConfig !== 'false'
|
||||||
|
let repositoryCacheFiles = [
|
||||||
|
'MODULE.bazel',
|
||||||
|
'WORKSPACE.bazel',
|
||||||
|
'WORKSPACE.bzlmod',
|
||||||
|
'WORKSPACE'
|
||||||
|
]
|
||||||
if (repositoryCacheEnabled) {
|
if (repositoryCacheEnabled) {
|
||||||
bazelrc.push(`build --repository_cache=${bazelRepository}`)
|
bazelrc.push(`build --repository_cache=${bazelRepository}`)
|
||||||
|
if (repositoryCacheConfig !== 'true') {
|
||||||
|
repositoryCacheFiles = Array(repositoryCacheConfig).flat()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const googleCredentials = core.getInput('google-credentials')
|
const googleCredentials = core.getInput('google-credentials')
|
||||||
|
|
@ -143,12 +153,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
repositoryCache: {
|
repositoryCache: {
|
||||||
enabled: repositoryCacheEnabled,
|
enabled: repositoryCacheEnabled,
|
||||||
files: [
|
files: repositoryCacheFiles,
|
||||||
'MODULE.bazel',
|
|
||||||
'WORKSPACE.bazel',
|
|
||||||
'WORKSPACE.bzlmod',
|
|
||||||
'WORKSPACE'
|
|
||||||
],
|
|
||||||
name: 'repository',
|
name: 'repository',
|
||||||
paths: [bazelRepository]
|
paths: [bazelRepository]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue