8 Commits

Author SHA1 Message Date
Christopher Homberger
b5a66bda89 add project name 2026-02-27 12:02:21 +01:00
Christopher Homberger
07a81d616e reenable Chocolatey, since the correct goreleaser file is used 2026-02-27 11:58:46 +01:00
Christopher Homberger
08c3ea28ca skip nightly of act_runner if vars.PUBLISH_ACT_CLI is set 2026-02-27 11:58:06 +01:00
Christopher Homberger
8d67364e67 Finalize 2026-02-27 11:49:11 +01:00
Christopher Homberger
059d6b88f6 fix checks.yml 2026-02-27 11:36:40 +01:00
Christopher Homberger
58855dfc6b Update Makefile
* skip integration tests in make test
* build act standalone binary
* update gitignore
* mark more tests as integration test
2026-02-27 11:27:00 +01:00
Christopher Homberger
4fed07ffc4 Force linux/amd64 for tests running on amd64 renble tests 2026-02-27 11:03:35 +01:00
silverwind
f300931212 Replace golangci-lint action and megalinter with make lint-go
The megalinter ghcr.io image pull is denied, and the golangci-lint
action version was inconsistent with the Makefile-pinned version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 15:28:30 +01:00
16 changed files with 113 additions and 54 deletions

View File

@@ -25,14 +25,7 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
- uses: golangci/golangci-lint-action@v8.0.0
- uses: megalinter/megalinter/flavors/go@v9.1.0
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: false
GITHUB_STATUS_REPORTER: ${{ !env.ACT }}
GITHUB_COMMENT_REPORTER: ${{ !env.ACT }}
- run: make lint-go
test-linux:
name: test-linux
@@ -41,18 +34,6 @@ jobs:
- uses: actions/checkout@v5
with:
fetch-depth: 2
- name: Cleanup Docker Engine
run: |
docker ps -a --format '{{ if eq (truncate .Names 4) "act-" }}
{{ .ID }}
{{end}}' | xargs -r docker rm -f || :
docker volume ls --format '{{ if eq (truncate .Name 4) "act-" }}
{{ .Name }}
{{ end }}' | xargs -r docker volume rm -f || :
docker images --format '{{ if eq (truncate .Repository 4) "act-" }}
{{ .ID }}
{{ end }}' | xargs -r docker rmi -f || :
docker images -q | xargs -r docker rmi || :
- name: Set up QEMU
if: '!env.NO_QEMU'
uses: docker/setup-qemu-action@v3
@@ -85,9 +66,9 @@ jobs:
env:
SERVER_URL: ${{ github.server_url }}
- name: Run act from cli
run: go run main.go exec -i node:16-buster-slim -C ./pkg/runner/testdata/ -W ./basic/push.yml
run: go run ./internal/app/act-cli -P ubuntu-latest=node:16-buster-slim -C ./pkg/runner/testdata/ -W ./basic/push.yml
- name: Run act from cli without docker support
run: go run -tags WITHOUT_DOCKER main.go exec -i "-self-hosted" -C ./pkg/runner/testdata/ -W ./local-action-js/push.yml
run: go run -tags WITHOUT_DOCKER ./internal/app/act-cli -P ubuntu-latest=-self-hosted -C ./pkg/runner/testdata/ -W ./local-action-js/push.yml
snapshot:
name: snapshot
@@ -110,7 +91,7 @@ jobs:
uses: goreleaser/goreleaser-action@v6
with:
version: v2
args: release --snapshot --clean
args: release --snapshot --clean -f ./.goreleaser.act-cli.yml
- name: Setup Node
continue-on-error: true
uses: actions/setup-node@v6

View File

@@ -15,6 +15,7 @@ env:
jobs:
goreleaser:
if: (!vars.PUBLISH_ACT_CLI)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
@@ -39,6 +40,7 @@ jobs:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-image:
if: (!vars.PUBLISH_ACT_CLI)
runs-on: ubuntu-latest
strategy:
matrix:

View File

@@ -7,6 +7,7 @@ on:
jobs:
goreleaser:
if: (!vars.PUBLISH_ACT_CLI)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
@@ -38,6 +39,7 @@ jobs:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
release-image:
if: (!vars.PUBLISH_ACT_CLI)
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest

View File

@@ -28,7 +28,7 @@ jobs:
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean -f ./.goreleaser.yml -f ./.goreleaser.gitea.yml
args: release --clean -f ./.goreleaser.act-cli.yml -f ./.goreleaser.act-cli.gitea.yml
env:
GITEA_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN || github.token }}
- name: Winget

View File

@@ -112,7 +112,7 @@ jobs:
uses: goreleaser/goreleaser-action@v6
with:
version: v2
args: release --snapshot --clean
args: release --snapshot --clean -f ./.goreleaser.act-cli.yml
- name: Setup Node
uses: actions/setup-node@v6
with:

View File

@@ -6,6 +6,7 @@ on:
jobs:
release:
if: vars.PUBLISH_ACT_CLI
# TODO use environment to scope secrets
name: release
runs-on: ubuntu-latest
@@ -28,7 +29,7 @@ jobs:
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
args: release --clean -f ./.goreleaser.act-cli.yml
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN || github.token }}
- name: Winget

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
/act_runner
/act
.env
.runner
coverage.txt

View File

@@ -1,4 +1,5 @@
version: 2
project_name: act-cli
before:
hooks:
- go mod tidy

View File

@@ -1,5 +1,6 @@
DIST := dist
EXECUTABLE := act_runner
ACT_EXECUTABLE := act
GOFMT ?= gofumpt -l
DIST_DIRS := $(DIST)/binaries $(DIST)/release
GO ?= go
@@ -137,7 +138,7 @@ tidy-check: tidy
fi
test: fmt-check security-check
@$(GO) test -v -cover -coverprofile coverage.txt ./... && echo "\n==>\033[32m Ok\033[m\n" || exit 1
@$(GO) test -test.short -v -cover -coverprofile coverage.txt ./... && echo "\n==>\033[32m Ok\033[m\n" || exit 1
.PHONY: vet
vet:
@@ -148,11 +149,14 @@ vet:
install: $(GOFILES)
$(GO) install -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)'
build: go-check $(EXECUTABLE)
build: go-check $(EXECUTABLE) $(ACT_EXECUTABLE)
$(EXECUTABLE): $(GOFILES)
$(GO) build -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o $@
$(ACT_EXECUTABLE): $(GOFILES)
$(GO) build -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o $@ ./internal/app/act-cli
.PHONY: deps-backend
deps-backend:
$(GO) mod download

View File

@@ -39,6 +39,10 @@ func TestListOptions(t *testing.T) {
}
func TestRun(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
rootCmd := createRootCommand(context.Background(), &Input{}, "")
err := newRunCommand(context.Background(), &Input{
platforms: []string{"ubuntu-latest=node:16-buster-slim"},
@@ -49,6 +53,9 @@ func TestRun(t *testing.T) {
}
func TestRunPush(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
rootCmd := createRootCommand(context.Background(), &Input{}, "")
err := newRunCommand(context.Background(), &Input{
platforms: []string{"ubuntu-latest=node:16-buster-slim"},
@@ -59,6 +66,9 @@ func TestRunPush(t *testing.T) {
}
func TestRunPushJsonLogger(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
rootCmd := createRootCommand(context.Background(), &Input{}, "")
err := newRunCommand(context.Background(), &Input{
platforms: []string{"ubuntu-latest=node:16-buster-slim"},
@@ -70,6 +80,9 @@ func TestRunPushJsonLogger(t *testing.T) {
}
func TestFlags(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
for _, f := range []string{"graph", "list", "bug-report", "man-page"} {
t.Run("TestFlag-"+f, func(t *testing.T) {
rootCmd := createRootCommand(context.Background(), &Input{}, "")
@@ -86,6 +99,9 @@ func TestFlags(t *testing.T) {
}
func TestWorkflowCall(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
rootCmd := createRootCommand(context.Background(), &Input{}, "")
err := newRunCommand(context.Background(), &Input{
platforms: []string{"ubuntu-latest=node:16-buster-slim"},
@@ -97,6 +113,9 @@ func TestWorkflowCall(t *testing.T) {
}
func TestLocalRepositories(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
wd, _ := filepath.Abs("../pkg/runner/testdata/")
rootCmd := createRootCommand(context.Background(), &Input{}, "")
err := newRunCommand(context.Background(), &Input{

View File

@@ -20,6 +20,10 @@ import (
)
func TestDocker(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
ctx := context.Background()
client, err := GetDockerClient(ctx)
require.NoError(t, err)

View File

@@ -44,6 +44,10 @@ func TestGetSocketAndHostNoSocket(t *testing.T) {
}
func TestGetSocketAndHostOnlySocket(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
// Arrange
socketURI := "/path/to/my.socket"
os.Unsetenv("DOCKER_HOST")
@@ -75,6 +79,10 @@ func TestGetSocketAndHostDontMount(t *testing.T) {
}
func TestGetSocketAndHostNoHostNoSocket(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
// Arrange
CommonSocketLocations = originalCommonSocketLocations
os.Unsetenv("DOCKER_HOST")
@@ -93,6 +101,10 @@ func TestGetSocketAndHostNoHostNoSocket(t *testing.T) {
// > Your code breaks setting DOCKER_HOST if shouldMount is false.
// > This happens if neither DOCKER_HOST nor --container-daemon-socket has a value, but socketLocation() returns a URI
func TestGetSocketAndHostNoHostNoSocketDefaultLocation(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
// Arrange
mySocketFile, tmpErr := os.CreateTemp(t.TempDir(), "act-*.sock")
mySocket := mySocketFile.Name()
@@ -115,6 +127,10 @@ func TestGetSocketAndHostNoHostNoSocketDefaultLocation(t *testing.T) {
}
func TestGetSocketAndHostNoHostInvalidSocket(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
// Arrange
os.Unsetenv("DOCKER_HOST")
mySocket := "/my/socket/path.sock"

View File

@@ -16,6 +16,10 @@ import (
)
func TestJobExecutor(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
tables := []TestJobFileInfo{
{workdir, "uses-and-run-in-one-step", "push", "Invalid run/uses syntax for job:test step:Test", platforms, secrets},
{workdir, "uses-github-empty", "push", "Expected format {org}/{repo}[/path]@ref", platforms, secrets},
@@ -31,7 +35,9 @@ func TestJobExecutor(t *testing.T) {
ctx := common.WithDryrun(context.Background(), true)
for _, table := range tables {
t.Run(table.workflowPath, func(t *testing.T) {
table.runTest(ctx, t, &Config{})
table.runTest(ctx, t, &Config{
ContainerArchitecture: nativeContainerArchitecture,
})
})
}
}

View File

@@ -344,6 +344,10 @@ func TestRunContext_GetBindsAndMounts(t *testing.T) {
}
func TestGetGitHubContext(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
log.SetLevel(log.DebugLevel)
cwd, err := os.Getwd()

View File

@@ -26,11 +26,12 @@ import (
)
var (
baseImage = "node:24-bookworm-slim"
platforms map[string]string
logLevel = log.DebugLevel
workdir = "testdata"
secrets map[string]string
baseImage = "node:24-bookworm-slim"
platforms map[string]string
logLevel = log.DebugLevel
workdir = "testdata"
secrets map[string]string
nativeContainerArchitecture = ""
)
func init() {
@@ -43,6 +44,12 @@ func init() {
"self-hosted": "-self-hosted",
}
// Force the correct docker container architecture
// otherwise it may fail to start containers without qemu
if runtime.GOARCH == "amd64" {
nativeContainerArchitecture = "linux/amd64"
}
if l := os.Getenv("ACT_TEST_LOG_LEVEL"); l != "" {
if lvl, err := log.ParseLevel(l); err == nil {
logLevel = lvl
@@ -229,7 +236,7 @@ func TestRunEvent(t *testing.T) {
t.Skip("skipping integration test")
}
ctx := context.Background()
ctx := t.Context()
tables := []TestJobFileInfo{
// Shells
@@ -237,8 +244,7 @@ func TestRunEvent(t *testing.T) {
// TODO: figure out why it fails
// {workdir, "shells/custom", "push", "", map[string]string{"ubuntu-latest": "catthehacker/ubuntu:pwsh-latest"}, }, // custom image with pwsh
{workdir, "shells/pwsh", "push", "", map[string]string{"ubuntu-latest": "catthehacker/ubuntu:pwsh-latest"}, secrets}, // custom image with pwsh
// Disabled: fails in CI with "container is not running" due to Docker lifecycle timing
// {workdir, "shells/bash", "push", "", platforms, secrets},
{workdir, "shells/bash", "push", "", platforms, secrets},
{workdir, "shells/python", "push", "", map[string]string{"ubuntu-latest": "node:16-buster"}, secrets}, // slim doesn't have python
{workdir, "shells/sh", "push", "", platforms, secrets},
@@ -263,9 +269,8 @@ func TestRunEvent(t *testing.T) {
// Eval
{workdir, "evalmatrix", "push", "", platforms, secrets},
// Disabled: fails in CI with 'container is not running' causing log.Fatal crash in matrix evaluation
// {workdir, "evalmatrixneeds", "push", "", platforms, secrets},
// {workdir, "evalmatrixneeds2", "push", "", platforms, secrets},
{workdir, "evalmatrixneeds", "push", "", platforms, secrets},
{workdir, "evalmatrixneeds2", "push", "", platforms, secrets},
{workdir, "evalmatrix-merge-map", "push", "", platforms, secrets},
{workdir, "evalmatrix-merge-array", "push", "", platforms, secrets},
// Disabled: github.repository_owner resolves inconsistently between env and step expressions in CI
@@ -352,8 +357,9 @@ func TestRunEvent(t *testing.T) {
for _, table := range tables {
t.Run(table.workflowPath, func(t *testing.T) {
config := &Config{
Secrets: table.secrets,
Parallel: 8,
Secrets: table.secrets,
Parallel: 8,
ContainerArchitecture: nativeContainerArchitecture,
}
eventFile := filepath.Join(workdir, table.workflowPath, "event.json")
@@ -419,7 +425,8 @@ func TestPullAndPostStepFailureIsJobFailure(t *testing.T) {
factory := &captureJobLoggerFactory{}
config := &Config{
Secrets: table.secrets,
Secrets: table.secrets,
ContainerArchitecture: nativeContainerArchitecture,
}
eventFile := filepath.Join(workdir, table.workflowPath, "event.json")
@@ -489,7 +496,8 @@ func TestFetchFailureIsJobFailure(t *testing.T) {
factory := &captureJobLoggerFactory{}
config := &Config{
Secrets: table.secrets,
Secrets: table.secrets,
ContainerArchitecture: nativeContainerArchitecture,
}
eventFile := filepath.Join(workdir, table.workflowPath, "event.json")
@@ -739,7 +747,6 @@ func (f *maskJobLoggerFactory) WithJobLogger() *log.Logger {
}
func TestMaskValues(t *testing.T) {
t.Skip("Disabled: fails in CI with 'container is not running' due to Docker lifecycle timing")
assertNoSecret := func(text string, _ string) {
found := strings.Contains(text, "composite secret")
if found {
@@ -763,7 +770,9 @@ func TestMaskValues(t *testing.T) {
}
logger := &maskJobLoggerFactory{}
tjfi.runTest(WithJobLoggerFactory(common.WithLogger(context.Background(), logger.WithJobLogger()), logger), t, &Config{})
tjfi.runTest(WithJobLoggerFactory(common.WithLogger(context.Background(), logger.WithJobLogger()), logger), t, &Config{
ContainerArchitecture: nativeContainerArchitecture,
})
output := logger.Output.String()
assertNoSecret(output, "secret value")
@@ -771,7 +780,6 @@ func TestMaskValues(t *testing.T) {
}
func TestRunEventSecrets(t *testing.T) {
t.Skip("Disabled: fails in CI with 'container is not running' due to Docker lifecycle timing")
if testing.Short() {
t.Skip("skipping integration test")
}
@@ -790,11 +798,14 @@ func TestRunEventSecrets(t *testing.T) {
secrets, _ := godotenv.Read(filepath.Join(workdir, workflowPath, ".secrets"))
require.NoError(t, err, "Failed to read .secrets")
tjfi.runTest(context.Background(), t, &Config{Secrets: secrets, Env: env})
tjfi.runTest(context.Background(), t, &Config{
Secrets: secrets,
Env: env,
ContainerArchitecture: nativeContainerArchitecture,
})
}
func TestRunActionInputs(t *testing.T) {
t.Skip("Disabled: fails in CI with 'container is not running' due to Docker lifecycle timing")
if testing.Short() {
t.Skip("skipping integration test")
}
@@ -812,11 +823,13 @@ func TestRunActionInputs(t *testing.T) {
"SOME_INPUT": "input",
}
tjfi.runTest(context.Background(), t, &Config{Inputs: inputs})
tjfi.runTest(context.Background(), t, &Config{
Inputs: inputs,
ContainerArchitecture: nativeContainerArchitecture,
})
}
func TestRunEventPullRequest(t *testing.T) {
t.Skip("Disabled: fails in CI with nil PR number and 'container is not running' due to Docker lifecycle timing")
if testing.Short() {
t.Skip("skipping integration test")
}
@@ -831,11 +844,13 @@ func TestRunEventPullRequest(t *testing.T) {
platforms: platforms,
}
tjfi.runTest(context.Background(), t, &Config{EventPath: filepath.Join(workdir, workflowPath, "event.json")})
tjfi.runTest(context.Background(), t, &Config{
EventPath: filepath.Join(workdir, workflowPath, "event.json"),
ContainerArchitecture: nativeContainerArchitecture,
})
}
func TestRunMatrixWithUserDefinedInclusions(t *testing.T) {
t.Skip("Disabled: fails in CI with 'container is not running' due to Docker lifecycle timing")
if testing.Short() {
t.Skip("skipping integration test")
}
@@ -859,5 +874,8 @@ func TestRunMatrixWithUserDefinedInclusions(t *testing.T) {
},
}
tjfi.runTest(context.Background(), t, &Config{Matrix: matrix})
tjfi.runTest(context.Background(), t, &Config{
Matrix: matrix,
ContainerArchitecture: nativeContainerArchitecture,
})
}