Update Makefile

* skip integration tests in make test
* build act standalone binary
* update gitignore
* mark more tests as integration test
This commit is contained in:
Christopher Homberger
2026-02-27 11:25:49 +01:00
parent 4fed07ffc4
commit 58855dfc6b
8 changed files with 59 additions and 17 deletions

View File

@@ -34,18 +34,6 @@ jobs:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
with: with:
fetch-depth: 2 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 - name: Set up QEMU
if: '!env.NO_QEMU' if: '!env.NO_QEMU'
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3
@@ -78,9 +66,9 @@ jobs:
env: env:
SERVER_URL: ${{ github.server_url }} SERVER_URL: ${{ github.server_url }}
- name: Run act from cli - 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 - 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 exec -i "-self-hosted" -C ./pkg/runner/testdata/ -W ./local-action-js/push.yml
snapshot: snapshot:
name: snapshot name: snapshot

1
.gitignore vendored
View File

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

View File

@@ -1,5 +1,6 @@
DIST := dist DIST := dist
EXECUTABLE := act_runner EXECUTABLE := act_runner
ACT_EXECUTABLE := act
GOFMT ?= gofumpt -l GOFMT ?= gofumpt -l
DIST_DIRS := $(DIST)/binaries $(DIST)/release DIST_DIRS := $(DIST)/binaries $(DIST)/release
GO ?= go GO ?= go
@@ -137,7 +138,7 @@ tidy-check: tidy
fi fi
test: fmt-check security-check 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 .PHONY: vet
vet: vet:
@@ -148,11 +149,14 @@ vet:
install: $(GOFILES) install: $(GOFILES)
$(GO) install -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' $(GO) install -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)'
build: go-check $(EXECUTABLE) build: go-check $(EXECUTABLE) $(ACT_EXECUTABLE)
$(EXECUTABLE): $(GOFILES) $(EXECUTABLE): $(GOFILES)
$(GO) build -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o $@ $(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 .PHONY: deps-backend
deps-backend: deps-backend:
$(GO) mod download $(GO) mod download

View File

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

View File

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

View File

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

View File

@@ -16,6 +16,10 @@ import (
) )
func TestJobExecutor(t *testing.T) { func TestJobExecutor(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
tables := []TestJobFileInfo{ tables := []TestJobFileInfo{
{workdir, "uses-and-run-in-one-step", "push", "Invalid run/uses syntax for job:test step:Test", platforms, secrets}, {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}, {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) ctx := common.WithDryrun(context.Background(), true)
for _, table := range tables { for _, table := range tables {
t.Run(table.workflowPath, func(t *testing.T) { 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) { func TestGetGitHubContext(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
log.SetLevel(log.DebugLevel) log.SetLevel(log.DebugLevel)
cwd, err := os.Getwd() cwd, err := os.Getwd()