Support cache (#25)
See [Caching dependencies to speed up workflows](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows). Reviewed-on: https://gitea.com/gitea/act_runner/pulls/25 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: Zettat123 <zettat123@noreply.gitea.io> Co-authored-by: Jason Song <i@wolfogre.com> Co-committed-by: Jason Song <i@wolfogre.com>
This commit is contained in:
parent
6b85bb17d1
commit
c5c4e275ac
11 changed files with 1096 additions and 3 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"strings"
|
||||
|
||||
runnerv1 "code.gitea.io/actions-proto-go/runner/v1"
|
||||
"codeberg.org/forgejo/runner/artifactcache"
|
||||
"codeberg.org/forgejo/runner/client"
|
||||
)
|
||||
|
||||
|
@ -15,11 +16,17 @@ type Runner struct {
|
|||
Environ map[string]string
|
||||
Client client.Client
|
||||
Labels []string
|
||||
CacheHandler *artifactcache.Handler
|
||||
}
|
||||
|
||||
// Run runs the pipeline stage.
|
||||
func (s *Runner) Run(ctx context.Context, task *runnerv1.Task) error {
|
||||
return NewTask(s.ForgeInstance, task.Id, s.Client, s.Environ, s.platformPicker).Run(ctx, task)
|
||||
env := map[string]string{}
|
||||
for k, v := range s.Environ {
|
||||
env[k] = v
|
||||
}
|
||||
env["ACTIONS_CACHE_URL"] = s.CacheHandler.ExternalURL() + "/"
|
||||
return NewTask(s.ForgeInstance, task.Id, s.Client, env, s.platformPicker).Run(ctx, task)
|
||||
}
|
||||
|
||||
func (s *Runner) platformPicker(labels []string) string {
|
||||
|
|
|
@ -11,13 +11,13 @@ import (
|
|||
"time"
|
||||
|
||||
runnerv1 "code.gitea.io/actions-proto-go/runner/v1"
|
||||
"codeberg.org/forgejo/runner/client"
|
||||
|
||||
"github.com/nektos/act/pkg/artifacts"
|
||||
"github.com/nektos/act/pkg/common"
|
||||
"github.com/nektos/act/pkg/model"
|
||||
"github.com/nektos/act/pkg/runner"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"codeberg.org/forgejo/runner/client"
|
||||
)
|
||||
|
||||
var globalTaskMap sync.Map
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue