Skip to content

Commit 5580812

Browse files
Ryanmergify[bot]
andauthored
feat: add node16 support (#922)
* feat: add node16 support Signed-off-by: hackercat <[email protected]> * feat: bump images to node16 Signed-off-by: hackercat <[email protected]> * lint(editorconfig): ignore *.md due to mixed style Signed-off-by: hackercat <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 9868e13 commit 5580812

File tree

27 files changed

+9200
-32
lines changed

27 files changed

+9200
-32
lines changed

IMAGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
| ----------------------------------- | ------------------------------------------------------ |
1313
| [`node:12-buster`][hub/_/node] | ![`buster-size`][hub/_/node/12-buster/size] |
1414
| [`node:12-buster-slim`][hub/_/node] | ![`micro-buster-size`][hub/_/node/12-buster-slim/size] |
15+
| [`node:16-buster`][hub/_/node] | ![`buster-size`][hub/_/node/16-buster/size] |
16+
| [`node:16-buster-slim`][hub/_/node] | ![`micro-buster-size`][hub/_/node/16-buster-slim/size] |
1517

1618
**Note: `catthehacker/ubuntu` images are based on Ubuntu root filesystem**
1719

@@ -44,6 +46,8 @@ Feel free to make a pull request with your image added here
4446
[hub/_/node]: https://hub.docker.com/r/_/node
4547
[hub/_/node/12-buster/size]: https://img.shields.io/docker/image-size/_/node/12-buster
4648
[hub/_/node/12-buster-slim/size]: https://img.shields.io/docker/image-size/_/node/12-buster-slim
49+
[hub/_/node/16-buster/size]: https://img.shields.io/docker/image-size/_/node/16-buster
50+
[hub/_/node/16-buster-slim/size]: https://img.shields.io/docker/image-size/_/node/16-buster-slim
4751
[ghcr/catthehacker/ubuntu]: https://github.com/catthehacker/docker_images/pkgs/container/ubuntu
4852
[hub/nektos/act-environments-ubuntu]: https://hub.docker.com/r/nektos/act-environments-ubuntu
4953
[hub/nektos/act-environments-ubuntu/18.04/size]: https://img.shields.io/docker/image-size/nektos/act-environments-ubuntu/18.04

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ GitHub Actions offers managed [virtual environments](https://help.github.com/en/
243243

244244
| GitHub Runner | Micro Docker Image | Medium Docker Image | Large Docker Image |
245245
| --------------- | ------------------------------ | --------------------------------------------------------- | ---------------------------------------------------------- |
246-
| `ubuntu-latest` | [`node:12-buster-slim`][micro] | [`ghcr.io/catthehacker/ubuntu:act-latest`][docker_images] | [`ghcr.io/catthehacker/ubuntu:full-latest`][docker_images] |
247-
| `ubuntu-20.04` | [`node:12-buster-slim`][micro] | [`ghcr.io/catthehacker/ubuntu:act-20.04`][docker_images] | [`ghcr.io/catthehacker/ubuntu:full-20.04`][docker_images] |
248-
| `ubuntu-18.04` | [`node:12-buster-slim`][micro] | [`ghcr.io/catthehacker/ubuntu:act-18.04`][docker_images] | [`ghcr.io/catthehacker/ubuntu:full-18.04`][docker_images] |
246+
| `ubuntu-latest` | [`node:16-buster-slim`][micro] | [`ghcr.io/catthehacker/ubuntu:act-latest`][docker_images] | [`ghcr.io/catthehacker/ubuntu:full-latest`][docker_images] |
247+
| `ubuntu-20.04` | [`node:16-buster-slim`][micro] | [`ghcr.io/catthehacker/ubuntu:act-20.04`][docker_images] | [`ghcr.io/catthehacker/ubuntu:full-20.04`][docker_images] |
248+
| `ubuntu-18.04` | [`node:16-buster-slim`][micro] | [`ghcr.io/catthehacker/ubuntu:act-18.04`][docker_images] | [`ghcr.io/catthehacker/ubuntu:full-18.04`][docker_images] |
249249

250250
[micro]: https://hub.docker.com/_/buildpack-deps
251251
[docker_images]: https://github.com/catthehacker/docker_images
@@ -289,7 +289,7 @@ If you use multiple platforms in your workflow, you have to specify them to chan
289289
For example, if your workflow uses `ubuntu-18.04`, `ubuntu-16.04` and `ubuntu-latest`, specify all platforms like below
290290

291291
```sh
292-
act -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04 -P ubuntu-latest=ubuntu:latest -P ubuntu-16.04=node:12-buster-slim
292+
act -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04 -P ubuntu-latest=ubuntu:latest -P ubuntu-16.04=node:16-buster-slim
293293
```
294294

295295
# Secrets

cmd/platforms.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66

77
func (i *Input) newPlatforms() map[string]string {
88
platforms := map[string]string{
9-
"ubuntu-latest": "node:12-buster-slim",
10-
"ubuntu-20.04": "node:12-buster-slim",
11-
"ubuntu-18.04": "node:12-buster-slim",
9+
"ubuntu-latest": "node:16-buster-slim",
10+
"ubuntu-20.04": "node:16-buster-slim",
11+
"ubuntu-18.04": "node:16-buster-slim",
1212
}
1313

1414
for _, p := range i.platforms {

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ func defaultImageSurvey(actrc string) error {
325325
case "Medium":
326326
option = "-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest\n-P ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04\n-P ubuntu-18.04=ghcr.io/catthehacker/ubuntu:act-18.04\n"
327327
case "Micro":
328-
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"
328+
option = "-P ubuntu-latest=node:16-buster-slim\n-P ubuntu-20.04=node:16-buster-slim\n-P ubuntu-18.04=node:16-buster-slim\n"
329329
}
330330

331331
f, err := os.Create(actrc)

pkg/artifacts/server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func TestArtifactFlow(t *testing.T) {
244244
defer cancel()
245245

246246
platforms := map[string]string{
247-
"ubuntu-latest": "node:12.20.1-buster-slim",
247+
"ubuntu-latest": "node:16-buster-slim",
248248
}
249249

250250
tables := []TestJobFileInfo{

pkg/container/docker_images_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,28 @@ func TestImageExistsLocally(t *testing.T) {
4040

4141
// Chose alpine latest because it's so small
4242
// maybe we should build an image instead so that tests aren't reliable on dockerhub
43-
readerDefault, err := cli.ImagePull(ctx, "node:12-buster-slim", types.ImagePullOptions{
43+
readerDefault, err := cli.ImagePull(ctx, "node:16-buster-slim", types.ImagePullOptions{
4444
Platform: "linux/amd64",
4545
})
4646
assert.Nil(t, err)
4747
defer readerDefault.Close()
4848
_, err = ioutil.ReadAll(readerDefault)
4949
assert.Nil(t, err)
5050

51-
imageDefaultArchExists, err := ImageExistsLocally(ctx, "node:12-buster-slim", "linux/amd64")
51+
imageDefaultArchExists, err := ImageExistsLocally(ctx, "node:16-buster-slim", "linux/amd64")
5252
assert.Nil(t, err)
5353
assert.Equal(t, true, imageDefaultArchExists)
5454

5555
// Validate if another architecture platform can be pulled
56-
readerArm64, err := cli.ImagePull(ctx, "node:12-buster-slim", types.ImagePullOptions{
56+
readerArm64, err := cli.ImagePull(ctx, "node:16-buster-slim", types.ImagePullOptions{
5757
Platform: "linux/arm64",
5858
})
5959
assert.Nil(t, err)
6060
defer readerArm64.Close()
6161
_, err = ioutil.ReadAll(readerArm64)
6262
assert.Nil(t, err)
6363

64-
imageArm64Exists, err := ImageExistsLocally(ctx, "node:12-buster-slim", "linux/arm64")
64+
imageArm64Exists, err := ImageExistsLocally(ctx, "node:16-buster-slim", "linux/arm64")
6565
assert.Nil(t, err)
6666
assert.Equal(t, true, imageArm64Exists)
6767
}

pkg/model/action.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ func (a *ActionRunsUsing) UnmarshalYAML(unmarshal func(interface{}) error) error
2020
// Force input to lowercase for case insensitive comparison
2121
format := ActionRunsUsing(strings.ToLower(using))
2222
switch format {
23-
case ActionRunsUsingNode12, ActionRunsUsingDocker, ActionRunsUsingComposite:
23+
case ActionRunsUsingNode16, ActionRunsUsingNode12, ActionRunsUsingDocker, ActionRunsUsingComposite:
2424
*a = format
2525
default:
2626
return fmt.Errorf(fmt.Sprintf("The runs.using key in action.yml must be one of: %v, got %s", []string{
2727
ActionRunsUsingComposite,
2828
ActionRunsUsingDocker,
2929
ActionRunsUsingNode12,
30+
ActionRunsUsingNode16,
3031
}, format))
3132
}
3233
return nil
@@ -35,6 +36,8 @@ func (a *ActionRunsUsing) UnmarshalYAML(unmarshal func(interface{}) error) error
3536
const (
3637
// ActionRunsUsingNode12 for running with node12
3738
ActionRunsUsingNode12 = "node12"
39+
// ActionRunsUsingNode12 for running with node16
40+
ActionRunsUsingNode16 = "node16"
3841
// ActionRunsUsingDocker for running with docker
3942
ActionRunsUsingDocker = "docker"
4043
// ActionRunsUsingComposite for running composite

pkg/runner/runner_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/nektos/act/pkg/model"
1717
)
1818

19-
var baseImage = "node:12-buster-slim"
19+
var baseImage = "node:16-buster-slim"
2020

2121
func init() {
2222
if p := os.Getenv("ACT_TEST_IMAGE"); p != "" {
@@ -102,7 +102,7 @@ func TestRunEvent(t *testing.T) {
102102
// {"testdata", "shells/custom", "push", "", map[string]string{"ubuntu-latest": "ghcr.io/justingrote/act-pwsh:latest"}, ""}, // custom image with pwsh
103103
{"testdata", "shells/pwsh", "push", "", map[string]string{"ubuntu-latest": "ghcr.io/justingrote/act-pwsh:latest"}, ""}, // custom image with pwsh
104104
{"testdata", "shells/bash", "push", "", platforms, ""},
105-
{"testdata", "shells/python", "push", "", map[string]string{"ubuntu-latest": "node:12-buster"}, ""}, // slim doesn't have python
105+
{"testdata", "shells/python", "push", "", map[string]string{"ubuntu-latest": "node:16-buster"}, ""}, // slim doesn't have python
106106
{"testdata", "shells/sh", "push", "", platforms, ""},
107107
{"testdata", "job-container", "push", "", platforms, ""},
108108
{"testdata", "job-container-non-root", "push", "", platforms, ""},

pkg/runner/step_context.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ func (sc *StepContext) runAction(actionDir string, actionPath string, actionRepo
532532
}
533533

534534
switch action.Runs.Using {
535-
case model.ActionRunsUsingNode12:
535+
case model.ActionRunsUsingNode12, model.ActionRunsUsingNode16:
536536
if err := maybeCopyToActionDir(); err != nil {
537537
return err
538538
}
@@ -547,6 +547,7 @@ func (sc *StepContext) runAction(actionDir string, actionPath string, actionRepo
547547
return fmt.Errorf(fmt.Sprintf("The runs.using key must be one of: %v, got %s", []string{
548548
model.ActionRunsUsingDocker,
549549
model.ActionRunsUsingNode12,
550+
model.ActionRunsUsingNode16,
550551
model.ActionRunsUsingComposite,
551552
}, action.Runs.Using))
552553
}

pkg/runner/testdata/actions/docker-local/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Container image that runs your code
2-
FROM node:12-buster-slim
2+
FROM node:16-buster-slim
33

44
# Copies your code file from your action repository to the filesystem path `/` of the container
55
COPY entrypoint.sh /entrypoint.sh

0 commit comments

Comments
 (0)