mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-02 18:00:18 +00:00
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:
@@ -34,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
|
||||
@@ -78,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 exec -i "-self-hosted" -C ./pkg/runner/testdata/ -W ./local-action-js/push.yml
|
||||
|
||||
snapshot:
|
||||
name: snapshot
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
/act_runner
|
||||
/act
|
||||
.env
|
||||
.runner
|
||||
coverage.txt
|
||||
|
||||
8
Makefile
8
Makefile
@@ -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
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user