Skip to content

Commit

Permalink
Use caching in GHA (#4)
Browse files Browse the repository at this point in the history
This revealed an issue with the `venv` target due to a missing `generates` argument.
  • Loading branch information
pgavlin committed Apr 11, 2024
1 parent 44a6200 commit eac93b6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
name: Test
jobs:
test:
Expand All @@ -22,8 +26,18 @@ jobs:
uses: actions/checkout@v4
- name: Bootstrap
run: go install ./cmd/dawn
- name: Restore cache
uses: actions/cache/restore@v3
with:
path: .dawn/build
key: dawn-build-${{ github.ref }}
- name: Build
run: dawn
- name: Save cache
uses: actions/cache/save@v3
with:
path: .dawn/build
key: dawn-build-${{ github.ref }}
- name: Test
run: go test ./... -coverprofile=coverage.out
- name: Upload coverage data
Expand Down
2 changes: 2 additions & 0 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func (c *cache) get(key string) (starlark.Value, bool) {
// once calls the given callable if and only if key is not present in the cache.
//
// The result is stored in the cache under the given key.
//
// Returns the result of the call or the cached value.
// """
//
//starlark:builtin
Expand Down
2 changes: 1 addition & 1 deletion docs/BUILD.dawn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def run_in_windows_venv(cmd):

run_in_venv = run_in_windows_venv if host.os == "windows" else run_in_posix_venv

@target(sources=["requirements.txt"])
@target(sources=["requirements.txt"], generates=["venv"])
def venv():
"""
Creates a venv for the docs build.
Expand Down
1 change: 1 addition & 0 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dawn
import "go.starlark.net/resolve"

func init() {
// Relax some Starlark restrictions.
resolve.AllowRecursion = true
resolve.AllowGlobalReassign = true
resolve.AllowSet = true
Expand Down

0 comments on commit eac93b6

Please sign in to comment.