Update images, fix extrapath (#723)
* fix: typo * fix: remove debug for git references it generates a massive amount of logs * feat: read values from env allows to test act on GHA when it's not a main repo * fix: merge extrapath with PATH * fix(tests): add additional shells for testing * fix(image): update images pin node to major version only, current node version: 12.22.1 replace most images with `node:12-buster-slim` to prevent errors on macOS runner due to DockerHub pull limit replace ocaml image Co-authored-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
parent
a9295c9db2
commit
a9fe038347
23 changed files with 121 additions and 68 deletions
18
IMAGES.md
18
IMAGES.md
|
@ -9,11 +9,11 @@
|
||||||
**Note 2: `node` `-slim` images don't have `python` installed, if you want to use actions or software that is depending on `python`, you need to specify image manually**
|
**Note 2: `node` `-slim` images don't have `python` installed, if you want to use actions or software that is depending on `python`, you need to specify image manually**
|
||||||
|
|
||||||
| Image | Size |
|
| Image | Size |
|
||||||
| ----------------------------------------- | ------------------------------------------------------------- |
|
| ------------------------------------ | -------------------------------------------------------- |
|
||||||
| [`node:12.20.1-buster`][hub/_/node] | ![`buster-size`][hub/_/node/12.20.1-buster/size] |
|
| [`node:12-buster`][hub/_/node] | ![`buster-size`][hub/_/node/12-buster/size] |
|
||||||
| [`node:12.20.1-buster-slim`][hub/_/node] | ![`micro-buster-size`][hub/_/node/12.20.1-buster-slim/size] |
|
| [`node:12-buster-slim`][hub/_/node] | ![`micro-buster-size`][hub/_/node/12-buster-slim/size] |
|
||||||
| [`node:12.20.1-stretch`][hub/_/node] | ![`stretch-size`][hub/_/node/12.20.1-stretch/size] |
|
| [`node:12-stretch`][hub/_/node] | ![`stretch-size`][hub/_/node/12-stretch/size] |
|
||||||
| [`node:12.20.1-stretch-slim`][hub/_/node] | ![`micro-stretch-size`][hub/_/node/12.20.1-stretch-slim/size] |
|
| [`node:12-stretch-slim`][hub/_/node] | ![`micro-stretch-size`][hub/_/node/12-stretch-slim/size] |
|
||||||
|
|
||||||
**Note: `catthehacker/ubuntu` images are based on Ubuntu root filesystem**
|
**Note: `catthehacker/ubuntu` images are based on Ubuntu root filesystem**
|
||||||
|
|
||||||
|
@ -48,10 +48,10 @@ Feel free to make a pull request with your image added here
|
||||||
|
|
||||||
[hub/_/buildpack-deps]: https://hub.docker.com/_/buildpack-deps
|
[hub/_/buildpack-deps]: https://hub.docker.com/_/buildpack-deps
|
||||||
[hub/_/node]: https://hub.docker.com/r/_/node
|
[hub/_/node]: https://hub.docker.com/r/_/node
|
||||||
[hub/_/node/12.20.1-buster/size]: https://img.shields.io/docker/image-size/_/node/12.20.1-buster
|
[hub/_/node/12-buster/size]: https://img.shields.io/docker/image-size/_/node/12-buster
|
||||||
[hub/_/node/12.20.1-buster-slim/size]: https://img.shields.io/docker/image-size/_/node/12.20.1-buster-slim
|
[hub/_/node/12-buster-slim/size]: https://img.shields.io/docker/image-size/_/node/12-buster-slim
|
||||||
[hub/_/node/12.20.1-stretch/size]: https://img.shields.io/docker/image-size/_/node/12.20.1-stretch
|
[hub/_/node/12-stretch/size]: https://img.shields.io/docker/image-size/_/node/12-stretch
|
||||||
[hub/_/node/12.20.1-stretch-slim/size]: https://img.shields.io/docker/image-size/_/node/12.20.1-stretch-slim
|
[hub/_/node/12-stretch-slim/size]: https://img.shields.io/docker/image-size/_/node/12-stretch-slim
|
||||||
[hub/catthehacker/ubuntu]: https://hub.docker.com/r/catthehacker/ubuntu
|
[hub/catthehacker/ubuntu]: https://hub.docker.com/r/catthehacker/ubuntu
|
||||||
[hub/catthehacker/ubuntu/act-latest/size]: https://img.shields.io/docker/image-size/catthehacker/ubuntu/act-latest
|
[hub/catthehacker/ubuntu/act-latest/size]: https://img.shields.io/docker/image-size/catthehacker/ubuntu/act-latest
|
||||||
[hub/catthehacker/ubuntu/act-20.04/size]: https://img.shields.io/docker/image-size/catthehacker/ubuntu/act-20.04
|
[hub/catthehacker/ubuntu/act-20.04/size]: https://img.shields.io/docker/image-size/catthehacker/ubuntu/act-20.04
|
||||||
|
|
14
README.md
14
README.md
|
@ -139,7 +139,7 @@ It will save that information to `~/.actrc`, please refer to [Configuration](#co
|
||||||
--detect-event Use first event type from workflow as event that triggered the workflow
|
--detect-event Use first event type from workflow as event that triggered the workflow
|
||||||
-C, --directory string working directory (default ".")
|
-C, --directory string working directory (default ".")
|
||||||
-n, --dryrun dryrun mode
|
-n, --dryrun dryrun mode
|
||||||
--env stringArray env to make available to actions with optional value (e.g. --e myenv=foo or -s myenv)
|
--env stringArray env to make available to actions with optional value (e.g. --env myenv=foo or --env myenv)
|
||||||
--env-file string environment file to read and use as env in the containers (default ".env")
|
--env-file string environment file to read and use as env in the containers (default ".env")
|
||||||
-e, --eventpath string path to event JSON file
|
-e, --eventpath string path to event JSON file
|
||||||
--github-instance string GitHub instance to use. Don't use this if you are not using GitHub Enterprise Server. (default "github.com")
|
--github-instance string GitHub instance to use. Don't use this if you are not using GitHub Enterprise Server. (default "github.com")
|
||||||
|
@ -193,11 +193,11 @@ If the `path:` value doesn't match the name of the repository, a `MODULE_NOT_FOU
|
||||||
GitHub Actions offers managed [virtual environments](https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners) for running workflows. In order for `act` to run your workflows locally, it must run a container for the runner defined in your workflow file. Here are the images that `act` uses for each runner type and size:
|
GitHub Actions offers managed [virtual environments](https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners) for running workflows. In order for `act` to run your workflows locally, it must run a container for the runner defined in your workflow file. Here are the images that `act` uses for each runner type and size:
|
||||||
|
|
||||||
| GitHub Runner | Micro Docker Image | Medium Docker Image | Large Docker Image |
|
| GitHub Runner | Micro Docker Image | Medium Docker Image | Large Docker Image |
|
||||||
| --------------- | ------------------------------------ | ------------------------------------------ | --------------------------------------------------- |
|
| --------------- | ------------------------------- | ------------------------------------------ | --------------------------------------------------- |
|
||||||
| `ubuntu-latest` | [`node:12.20.1-buster-slim`][micro] | [`catthehacker/ubuntu:act-latest`][medium] | [`catthehacker/ubuntu:full-20.04`][large-cat] |
|
| `ubuntu-latest` | [`node:12-buster-slim`][micro] | [`catthehacker/ubuntu:act-latest`][medium] | [`catthehacker/ubuntu:full-20.04`][large-cat] |
|
||||||
| `ubuntu-20.04` | [`node:12.20.1-buster-slim`][micro] | [`catthehacker/ubuntu:act-20.04`][medium] | [`catthehacker/ubuntu:full-20.04`][large-cat] |
|
| `ubuntu-20.04` | [`node:12-buster-slim`][micro] | [`catthehacker/ubuntu:act-20.04`][medium] | [`catthehacker/ubuntu:full-20.04`][large-cat] |
|
||||||
| `ubuntu-18.04` | [`node:12.20.1-buster-slim`][micro] | [`catthehacker/ubuntu:act-18.04`][medium] | [`nektos/act-environments-ubuntu:18.04`][large-act] |
|
| `ubuntu-18.04` | [`node:12-buster-slim`][micro] | [`catthehacker/ubuntu:act-18.04`][medium] | [`nektos/act-environments-ubuntu:18.04`][large-act] |
|
||||||
| `ubuntu-16.04` | [`node:12.20.1-stretch-slim`][micro] | [`catthehacker/ubuntu:act-16.04`][medium] | `unavailable` |
|
| `ubuntu-16.04` | [`node:12-stretch-slim`][micro] | [`catthehacker/ubuntu:act-16.04`][medium] | `unavailable` |
|
||||||
|
|
||||||
[micro]: https://hub.docker.com/_/buildpack-deps
|
[micro]: https://hub.docker.com/_/buildpack-deps
|
||||||
[medium]: https://github.com/catthehacker/docker_images
|
[medium]: https://github.com/catthehacker/docker_images
|
||||||
|
@ -249,7 +249,7 @@ If you use multiple platforms in your workflow, you have to specify them to chan
|
||||||
For example, if your workflow uses `ubuntu-18.04`, `ubuntu-16.04` and `ubuntu-latest`, specify all platforms like below
|
For example, if your workflow uses `ubuntu-18.04`, `ubuntu-16.04` and `ubuntu-latest`, specify all platforms like below
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
act -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04 -P ubuntu-latest=ubuntu:latest -P ubuntu-16.04=node:12.20.1-buster-slim
|
act -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04 -P ubuntu-latest=ubuntu:latest -P ubuntu-16.04=node:12-buster-slim
|
||||||
```
|
```
|
||||||
|
|
||||||
# Secrets
|
# Secrets
|
||||||
|
|
|
@ -6,10 +6,10 @@ import (
|
||||||
|
|
||||||
func (i *Input) newPlatforms() map[string]string {
|
func (i *Input) newPlatforms() map[string]string {
|
||||||
platforms := map[string]string{
|
platforms := map[string]string{
|
||||||
"ubuntu-latest": "node:12.20.1-buster-slim",
|
"ubuntu-latest": "node:12-buster-slim",
|
||||||
"ubuntu-20.04": "node:12.20.1-buster-slim",
|
"ubuntu-20.04": "node:12-buster-slim",
|
||||||
"ubuntu-18.04": "node:12.20.1-buster-slim",
|
"ubuntu-18.04": "node:12-buster-slim",
|
||||||
"ubuntu-16.04": "node:12.20.1-stretch-slim",
|
"ubuntu-16.04": "node:12-stretch-slim",
|
||||||
"windows-latest": "",
|
"windows-latest": "",
|
||||||
"windows-2019": "",
|
"windows-2019": "",
|
||||||
"macos-latest": "",
|
"macos-latest": "",
|
||||||
|
|
|
@ -39,7 +39,7 @@ func Execute(ctx context.Context, version string) {
|
||||||
rootCmd.Flags().BoolP("graph", "g", false, "draw workflows")
|
rootCmd.Flags().BoolP("graph", "g", false, "draw workflows")
|
||||||
rootCmd.Flags().StringP("job", "j", "", "run job")
|
rootCmd.Flags().StringP("job", "j", "", "run job")
|
||||||
rootCmd.Flags().StringArrayVarP(&input.secrets, "secret", "s", []string{}, "secret to make available to actions with optional value (e.g. -s mysecret=foo or -s mysecret)")
|
rootCmd.Flags().StringArrayVarP(&input.secrets, "secret", "s", []string{}, "secret to make available to actions with optional value (e.g. -s mysecret=foo or -s mysecret)")
|
||||||
rootCmd.Flags().StringArrayVarP(&input.envs, "env", "", []string{}, "env to make available to actions with optional value (e.g. --e myenv=foo or -s myenv)")
|
rootCmd.Flags().StringArrayVarP(&input.envs, "env", "", []string{}, "env to make available to actions with optional value (e.g. --env myenv=foo or --env myenv)")
|
||||||
rootCmd.Flags().StringArrayVarP(&input.platforms, "platform", "P", []string{}, "custom image to use per platform (e.g. -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04)")
|
rootCmd.Flags().StringArrayVarP(&input.platforms, "platform", "P", []string{}, "custom image to use per platform (e.g. -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04)")
|
||||||
rootCmd.Flags().BoolVarP(&input.reuseContainers, "reuse", "r", false, "reuse action containers to maintain state")
|
rootCmd.Flags().BoolVarP(&input.reuseContainers, "reuse", "r", false, "reuse action containers to maintain state")
|
||||||
rootCmd.Flags().BoolVarP(&input.bindWorkdir, "bind", "b", false, "bind working directory to container, rather than copy")
|
rootCmd.Flags().BoolVarP(&input.bindWorkdir, "bind", "b", false, "bind working directory to container, rather than copy")
|
||||||
|
@ -303,7 +303,7 @@ func defaultImageSurvey(actrc string) error {
|
||||||
case "Medium":
|
case "Medium":
|
||||||
option = "-P ubuntu-latest=catthehacker/ubuntu:act-latest\n-P ubuntu-20.04=catthehacker/ubuntu:act-20.04\n-P ubuntu-18.04=catthehacker/ubuntu:act-18.04\nubuntu-16.04=catthehacker/ubuntu:act-16.04"
|
option = "-P ubuntu-latest=catthehacker/ubuntu:act-latest\n-P ubuntu-20.04=catthehacker/ubuntu:act-20.04\n-P ubuntu-18.04=catthehacker/ubuntu:act-18.04\nubuntu-16.04=catthehacker/ubuntu:act-16.04"
|
||||||
case "Micro":
|
case "Micro":
|
||||||
option = "-P ubuntu-latest=node:12.20.1-buster-slim\n-P ubuntu-20.04=node:12.20.1-buster-slim\n-P ubuntu-18.04=node:12.20.1-buster-slim\n-P ubuntu-16.04=node:12.20.1-stretch-slim"
|
option = "-P ubuntu-latest=node:12-buster-slim\n-P ubuntu-20.04=node:12-buster-slim\n-P ubuntu-18.04=node:12-buster-slim\n-P ubuntu-16.04=node:12-stretch-slim"
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := os.Create(actrc)
|
f, err := os.Create(actrc)
|
||||||
|
|
|
@ -86,7 +86,7 @@ func FindGitRef(file string) (string, error) {
|
||||||
if r == nil || err != nil {
|
if r == nil || err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
log.Debugf("Reference: name=%s sha=%s", r.Name().String(), r.Hash().String())
|
// log.Debugf("Reference: name=%s sha=%s", r.Name().String(), r.Hash().String())
|
||||||
if r.Hash().String() == ref {
|
if r.Hash().String() == ref {
|
||||||
if r.Name().IsTag() {
|
if r.Name().IsTag() {
|
||||||
refTag = r.Name().String()
|
refTag = r.Name().String()
|
||||||
|
|
|
@ -40,7 +40,7 @@ func TestImageExistsLocally(t *testing.T) {
|
||||||
|
|
||||||
// Chose alpine latest because it's so small
|
// Chose alpine latest because it's so small
|
||||||
// maybe we should build an image instead so that tests aren't reliable on dockerhub
|
// maybe we should build an image instead so that tests aren't reliable on dockerhub
|
||||||
readerDefault, err := cli.ImagePull(ctx, "alpine:latest", types.ImagePullOptions{
|
readerDefault, err := cli.ImagePull(ctx, "node:12-buster-slim", types.ImagePullOptions{
|
||||||
Platform: "linux/amd64",
|
Platform: "linux/amd64",
|
||||||
})
|
})
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
@ -48,12 +48,12 @@ func TestImageExistsLocally(t *testing.T) {
|
||||||
_, err = ioutil.ReadAll(readerDefault)
|
_, err = ioutil.ReadAll(readerDefault)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
imageDefaultArchExists, err := ImageExistsLocally(ctx, "alpine:latest", "linux/amd64")
|
imageDefaultArchExists, err := ImageExistsLocally(ctx, "node:12-buster-slim", "linux/amd64")
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, true, imageDefaultArchExists)
|
assert.Equal(t, true, imageDefaultArchExists)
|
||||||
|
|
||||||
// Validate if another architecture platform can be pulled
|
// Validate if another architecture platform can be pulled
|
||||||
readerArm64, err := cli.ImagePull(ctx, "alpine:latest", types.ImagePullOptions{
|
readerArm64, err := cli.ImagePull(ctx, "node:12-buster-slim", types.ImagePullOptions{
|
||||||
Platform: "linux/arm64",
|
Platform: "linux/arm64",
|
||||||
})
|
})
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
@ -61,7 +61,7 @@ func TestImageExistsLocally(t *testing.T) {
|
||||||
_, err = ioutil.ReadAll(readerArm64)
|
_, err = ioutil.ReadAll(readerArm64)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
imageArm64Exists, err := ImageExistsLocally(ctx, "alpine:latest", "linux/arm64")
|
imageArm64Exists, err := ImageExistsLocally(ctx, "node:12-buster-slim", "linux/arm64")
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, true, imageArm64Exists)
|
assert.Equal(t, true, imageArm64Exists)
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,13 +308,28 @@ func TestGetGitHubContext(t *testing.T) {
|
||||||
|
|
||||||
log.Debugf("%v", ghc)
|
log.Debugf("%v", ghc)
|
||||||
|
|
||||||
|
actor := "nektos/act"
|
||||||
|
if a := os.Getenv("ACT_ACTOR"); a != "" {
|
||||||
|
actor = a
|
||||||
|
}
|
||||||
|
|
||||||
|
repo := "nektos/act"
|
||||||
|
if r := os.Getenv("ACT_REPOSITORY"); r != "" {
|
||||||
|
repo = r
|
||||||
|
}
|
||||||
|
|
||||||
|
owner := "nektos"
|
||||||
|
if o := os.Getenv("ACT_OWNER"); o != "" {
|
||||||
|
owner = o
|
||||||
|
}
|
||||||
|
|
||||||
assert.Equal(t, ghc.RunID, "1")
|
assert.Equal(t, ghc.RunID, "1")
|
||||||
assert.Equal(t, ghc.Workspace, rc.Config.containerPath(cwd))
|
assert.Equal(t, ghc.Workspace, rc.Config.containerPath(cwd))
|
||||||
assert.Equal(t, ghc.RunNumber, "1")
|
assert.Equal(t, ghc.RunNumber, "1")
|
||||||
assert.Equal(t, ghc.RetentionDays, "0")
|
assert.Equal(t, ghc.RetentionDays, "0")
|
||||||
assert.Equal(t, ghc.Actor, "nektos/act")
|
assert.Equal(t, ghc.Actor, actor)
|
||||||
assert.Equal(t, ghc.Repository, "nektos/act")
|
assert.Equal(t, ghc.Repository, repo)
|
||||||
assert.Equal(t, ghc.RepositoryOwner, "nektos")
|
assert.Equal(t, ghc.RepositoryOwner, owner)
|
||||||
assert.Equal(t, ghc.RunnerPerflog, "/dev/null")
|
assert.Equal(t, ghc.RunnerPerflog, "/dev/null")
|
||||||
assert.Equal(t, ghc.EventPath, ActPath+"/workflow/event.json")
|
assert.Equal(t, ghc.EventPath, ActPath+"/workflow/event.json")
|
||||||
assert.Equal(t, ghc.Token, rc.Config.Secrets["GITHUB_TOKEN"])
|
assert.Equal(t, ghc.Token, rc.Config.Secrets["GITHUB_TOKEN"])
|
||||||
|
|
|
@ -16,6 +16,14 @@ import (
|
||||||
"github.com/nektos/act/pkg/model"
|
"github.com/nektos/act/pkg/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var baseImage string = "node:12-buster-slim"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if p := os.Getenv("ACT_TEST_IMAGE"); p != "" {
|
||||||
|
baseImage = p
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestGraphEvent(t *testing.T) {
|
func TestGraphEvent(t *testing.T) {
|
||||||
planner, err := model.NewWorkflowPlanner("testdata/basic", true)
|
planner, err := model.NewWorkflowPlanner("testdata/basic", true)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
@ -81,7 +89,7 @@ func TestRunEvent(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
platforms := map[string]string{
|
platforms := map[string]string{
|
||||||
"ubuntu-latest": "node:12.20.1-buster-slim",
|
"ubuntu-latest": baseImage,
|
||||||
}
|
}
|
||||||
|
|
||||||
tables := []TestJobFileInfo{
|
tables := []TestJobFileInfo{
|
||||||
|
@ -89,8 +97,10 @@ func TestRunEvent(t *testing.T) {
|
||||||
{"testdata", "fail", "push", "exit with `FAILURE`: 1", platforms, ""},
|
{"testdata", "fail", "push", "exit with `FAILURE`: 1", platforms, ""},
|
||||||
{"testdata", "runs-on", "push", "", platforms, ""},
|
{"testdata", "runs-on", "push", "", platforms, ""},
|
||||||
{"testdata", "checkout", "push", "", platforms, ""},
|
{"testdata", "checkout", "push", "", platforms, ""},
|
||||||
// Pwsh is not available in default worker (yet) so we use a separate image for testing
|
{"testdata", "shells/pwsh", "push", "", map[string]string{"ubuntu-latest": "ghcr.io/justingrote/act-pwsh:latest"}, ""}, // custom image with pwsh
|
||||||
{"testdata", "powershell", "push", "", map[string]string{"ubuntu-latest": "ghcr.io/justingrote/act-pwsh:latest"}, ""},
|
{"testdata", "shells/bash", "push", "", platforms, ""},
|
||||||
|
{"testdata", "shells/python", "push", "", map[string]string{"ubuntu-latest": "node:12-buster"}, ""}, // slim doesn't have python
|
||||||
|
{"testdata", "shells/sh", "push", "", platforms, ""},
|
||||||
{"testdata", "job-container", "push", "", platforms, ""},
|
{"testdata", "job-container", "push", "", platforms, ""},
|
||||||
{"testdata", "job-container-non-root", "push", "", platforms, ""},
|
{"testdata", "job-container-non-root", "push", "", platforms, ""},
|
||||||
{"testdata", "uses-docker-url", "push", "", platforms, ""},
|
{"testdata", "uses-docker-url", "push", "", platforms, ""},
|
||||||
|
@ -131,7 +141,7 @@ func TestRunEventSecrets(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
platforms := map[string]string{
|
platforms := map[string]string{
|
||||||
"ubuntu-latest": "node:12.20.1-buster-slim",
|
"ubuntu-latest": baseImage,
|
||||||
}
|
}
|
||||||
|
|
||||||
workflowPath := "secrets"
|
workflowPath := "secrets"
|
||||||
|
@ -172,7 +182,7 @@ func TestRunEventPullRequest(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
platforms := map[string]string{
|
platforms := map[string]string{
|
||||||
"ubuntu-latest": "node:12.20.1-buster-slim",
|
"ubuntu-latest": baseImage,
|
||||||
}
|
}
|
||||||
|
|
||||||
workflowPath := "pull-request"
|
workflowPath := "pull-request"
|
||||||
|
|
|
@ -125,9 +125,13 @@ func (sc *StepContext) mergeEnv() map[string]string {
|
||||||
env = mergeMaps(rc.GetEnv(), step.GetEnv())
|
env = mergeMaps(rc.GetEnv(), step.GetEnv())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if env["PATH"] == "" {
|
||||||
env["PATH"] = `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`
|
env["PATH"] = `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`
|
||||||
if (rc.ExtraPath != nil) && (len(rc.ExtraPath) > 0) {
|
}
|
||||||
|
if rc.ExtraPath != nil && len(rc.ExtraPath) > 0 {
|
||||||
|
p := env["PATH"]
|
||||||
env["PATH"] = strings.Join(rc.ExtraPath, `:`)
|
env["PATH"] = strings.Join(rc.ExtraPath, `:`)
|
||||||
|
env["PATH"] += `:` + p
|
||||||
}
|
}
|
||||||
|
|
||||||
sc.Env = rc.withGithubEnv(env)
|
sc.Env = rc.withGithubEnv(env)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
func TestStepContextExecutor(t *testing.T) {
|
func TestStepContextExecutor(t *testing.T) {
|
||||||
platforms := map[string]string{
|
platforms := map[string]string{
|
||||||
"ubuntu-latest": "node:12.20.1-buster-slim",
|
"ubuntu-latest": baseImage,
|
||||||
}
|
}
|
||||||
tables := []TestJobFileInfo{
|
tables := []TestJobFileInfo{
|
||||||
{"testdata", "uses-and-run-in-one-step", "push", "Invalid run/uses syntax for job:test step:Test", platforms, ""},
|
{"testdata", "uses-and-run-in-one-step", "push", "Invalid run/uses syntax for job:test step:Test", platforms, ""},
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Container image that runs your code
|
# Container image that runs your code
|
||||||
FROM alpine:3.13
|
FROM node:12-buster-slim
|
||||||
|
|
||||||
# Copies your code file from your action repository to the filesystem path `/` of the container
|
# Copies your code file from your action repository to the filesystem path `/` of the container
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
|
@ -8,8 +8,7 @@ inputs:
|
||||||
default: World
|
default: World
|
||||||
runs:
|
runs:
|
||||||
using: docker
|
using: docker
|
||||||
#image: docker://alpine:3.13
|
image: docker://node:12-buster-slim
|
||||||
image: docker://node:12-alpine
|
|
||||||
env:
|
env:
|
||||||
TEST: enabled
|
TEST: enabled
|
||||||
args:
|
args:
|
||||||
|
|
6
pkg/runner/testdata/basic/push.yml
vendored
6
pkg/runner/testdata/basic/push.yml
vendored
|
@ -10,7 +10,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- run: echo ${{ env.TEST }} | grep value
|
- run: echo ${{ env.TEST }} | grep value
|
||||||
- run: env
|
- run: env
|
||||||
- uses: docker://alpine:3.13
|
- uses: docker://node:12-buster-slim
|
||||||
with:
|
with:
|
||||||
somekey: ${{ env.TEST }}
|
somekey: ${{ env.TEST }}
|
||||||
args: echo ${INPUT_SOMEKEY} | grep somevalue
|
args: echo ${INPUT_SOMEKEY} | grep somevalue
|
||||||
|
@ -29,10 +29,10 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build]
|
needs: [build]
|
||||||
steps:
|
steps:
|
||||||
- uses: docker://ubuntu:18.04
|
- uses: docker://node:12-buster-slim
|
||||||
with:
|
with:
|
||||||
args: env
|
args: env
|
||||||
- uses: docker://ubuntu:18.04
|
- uses: docker://node:12-buster-slim
|
||||||
with:
|
with:
|
||||||
entrypoint: /bin/echo
|
entrypoint: /bin/echo
|
||||||
args: ${{github.event_name}}
|
args: ${{github.event_name}}
|
||||||
|
|
4
pkg/runner/testdata/commands/push.yml
vendored
4
pkg/runner/testdata/commands/push.yml
vendored
|
@ -14,8 +14,8 @@ jobs:
|
||||||
id: set_output
|
id: set_output
|
||||||
run: echo "::set-output name=zoo::zar"
|
run: echo "::set-output name=zoo::zar"
|
||||||
|
|
||||||
#- run: echo "::add-path::/zip"
|
- run: echo "::add-path::/zip"
|
||||||
#- run: echo $PATH | grep /zip
|
- run: echo $PATH | grep /zip
|
||||||
|
|
||||||
- name: TEST conditional
|
- name: TEST conditional
|
||||||
if: steps.set_output.outputs.zoo
|
if: steps.set_output.outputs.zoo
|
||||||
|
|
2
pkg/runner/testdata/fail/push.yml
vendored
2
pkg/runner/testdata/fail/push.yml
vendored
|
@ -5,7 +5,7 @@ jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: node:12.20.1-buster
|
image: node:12-buster-slim
|
||||||
env:
|
env:
|
||||||
TEST_ENV: test-value
|
TEST_ENV: test-value
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -5,6 +5,6 @@ jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: ocaml/opam2:debian-9-opam
|
image: ghcr.io/catthehacker/ubuntu:runner-latest # image with user 'runner:runner' built on tag 'act-latest'
|
||||||
steps:
|
steps:
|
||||||
- run: echo PASS
|
- run: echo PASS
|
||||||
|
|
4
pkg/runner/testdata/job-container/push.yml
vendored
4
pkg/runner/testdata/job-container/push.yml
vendored
|
@ -5,7 +5,7 @@ jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: node:12.20.1-buster
|
image: node:12-buster-slim
|
||||||
env:
|
env:
|
||||||
TEST_ENV: test-value
|
TEST_ENV: test-value
|
||||||
steps:
|
steps:
|
||||||
|
@ -13,7 +13,7 @@ jobs:
|
||||||
|
|
||||||
test2:
|
test2:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: node:12.20.1-buster
|
container: node:12-buster-slim
|
||||||
steps:
|
steps:
|
||||||
- run: echo ${TEST_ENV} | grep test-value
|
- run: echo ${TEST_ENV} | grep test-value
|
||||||
env:
|
env:
|
||||||
|
|
2
pkg/runner/testdata/parallel/push.yml
vendored
2
pkg/runner/testdata/parallel/push.yml
vendored
|
@ -15,7 +15,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build]
|
needs: [build]
|
||||||
steps:
|
steps:
|
||||||
- uses: docker://ubuntu:18.04
|
- uses: docker://node:12-buster-slim
|
||||||
with:
|
with:
|
||||||
args: echo ${GITHUB_REF} | grep nektos/act
|
args: echo ${GITHUB_REF} | grep nektos/act
|
||||||
- uses: ./actions/docker-url
|
- uses: ./actions/docker-url
|
||||||
|
|
10
pkg/runner/testdata/shells/bash/push.yml
vendored
Normal file
10
pkg/runner/testdata/shells/bash/push.yml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
on: push
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ -n "$PATH" ]] ; then
|
||||||
|
echo "I'm Bash!"
|
||||||
|
fi
|
|
@ -1,12 +1,8 @@
|
||||||
name: powershell
|
|
||||||
on: push
|
on: push
|
||||||
|
|
||||||
env:
|
|
||||||
TEST: value
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- shell: pwsh
|
- shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
echo "hello test"
|
$PSVersionTable
|
9
pkg/runner/testdata/shells/python/push.yml
vendored
Normal file
9
pkg/runner/testdata/shells/python/push.yml
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
on: push
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- shell: python
|
||||||
|
run: |
|
||||||
|
import platform
|
||||||
|
print(platform.python_version())
|
10
pkg/runner/testdata/shells/sh/push.yml
vendored
Normal file
10
pkg/runner/testdata/shells/sh/push.yml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
on: push
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- shell: sh
|
||||||
|
run: |
|
||||||
|
if [ -n "$PATH" ] ; then
|
||||||
|
echo "I'm sh!"
|
||||||
|
fi
|
2
pkg/runner/testdata/uses-docker-url/push.yml
vendored
2
pkg/runner/testdata/uses-docker-url/push.yml
vendored
|
@ -5,7 +5,7 @@ jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: docker://alpine:3.13
|
- uses: docker://node:12-buster-slim
|
||||||
with:
|
with:
|
||||||
somekey: somevalue
|
somekey: somevalue
|
||||||
args: echo ${INPUT_SOMEKEY} | grep somevalue
|
args: echo ${INPUT_SOMEKEY} | grep somevalue
|
||||||
|
|
Loading…
Add table
Reference in a new issue