mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-20 11:56:47 +08:00
Port CI to Gitea.com (#1)
# Problems
- [x] Some env variables from act itself / act_runner let the tests fail.
- [ ] CI takes too long to clone actions, need to speed up the used act_runner by sparse checkout
- Runners are reused this speeds up once every runner has ran every job
- [ ] Qemu setup is broken and do not add all platforms like GitHub CI expected` linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/loong64,linux/arm/v7,linux/arm/v6` got `linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4,linux/386` without qemu set up
- Test Disabled
- [x] ACTIONS_RUNTIME_TOKEN needs to be unset
- [ ] Snapshot needs our version of the npm package / patching
- Test Disabled
- [ ] ACTIONS_RESULTS_URL:http://127.0.0.1:12345/ seems to be a fallback to localhost this is a problem
- Test Disabled
Reviewed-on: https://gitea.com/actions-oss/act-cli/pulls/1
Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
Co-committed-by: Christopher Homberger <christopher.homberger@web.de>
This commit is contained in:
committed by
ChristopherHX
parent
2c1a559406
commit
83cbf1f2b8
@@ -249,6 +249,9 @@ func TestArtifactFlow(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
if _, ok := os.LookupEnv("NO_EXTERNAL_IP"); ok {
|
||||
t.Skip("skipping test because QEMU is disabled")
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
|
||||
@@ -212,7 +212,8 @@ func matchesRegex(url string, matchers ...findStringSubmatcher) []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func findGitSlug(url string, githubInstance string) (string, string, error) {
|
||||
// TODO deprecate and remove githubInstance parameter
|
||||
func findGitSlug(url string, _ /* githubInstance */ string) (string, string, error) {
|
||||
if matches := matchesRegex(url, codeCommitHTTPRegex, codeCommitSSHRegex); matches != nil {
|
||||
return "CodeCommit", matches[2], nil
|
||||
}
|
||||
@@ -221,14 +222,13 @@ func findGitSlug(url string, githubInstance string) (string, string, error) {
|
||||
return "GitHub", fmt.Sprintf("%s/%s", matches[1], matches[2]), nil
|
||||
}
|
||||
|
||||
if githubInstance != "github.com" {
|
||||
if matches := matchesRegex(url,
|
||||
regexp.MustCompile(fmt.Sprintf(`^https?://%s/(.+)/(.+?)(?:.git)?$`, githubInstance)),
|
||||
regexp.MustCompile(fmt.Sprintf(`%s[:/](.+)/(.+?)(?:.git)?$`, githubInstance)),
|
||||
); matches != nil {
|
||||
return "GitHubEnterprise", fmt.Sprintf("%s/%s", matches[1], matches[2]), nil
|
||||
}
|
||||
if matches := matchesRegex(url,
|
||||
regexp.MustCompile(`^https?://(?:[^/]+)/([^/]+)/([^/]+)(?:.git)?$`),
|
||||
regexp.MustCompile(`([^/]+)[:/]([^/]+)/([^/]+)(?:.git)?$`),
|
||||
); matches != nil {
|
||||
return "GitHubEnterprise", fmt.Sprintf("%s/%s", matches[1], matches[2]), nil
|
||||
}
|
||||
|
||||
return "", url, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ func TestFindGitSlug(t *testing.T) {
|
||||
{"http://github.com/actions-oss/act-cli", "GitHub", "actions-oss/act-cli"},
|
||||
{"git+ssh://git@github.com/owner/repo.git", "GitHub", "owner/repo"},
|
||||
{"http://myotherrepo.com/act.git", "", "http://myotherrepo.com/act.git"},
|
||||
{"https://gitea.com/actions-oss/act-cli.git", "GitHubEnterprise", "actions-oss/act-cli.git"},
|
||||
}
|
||||
|
||||
for _, tt := range slugTests {
|
||||
|
||||
@@ -3,6 +3,7 @@ package container
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types/image"
|
||||
@@ -51,6 +52,22 @@ func TestImageExistsLocally(t *testing.T) {
|
||||
imageDefaultArchExists, err := ImageExistsLocally(ctx, "node:16-buster-slim", "linux/amd64")
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, true, imageDefaultArchExists)
|
||||
}
|
||||
|
||||
func TestImageExistsLocallyQemu(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
if _, ok := os.LookupEnv("NO_QEMU"); ok {
|
||||
t.Skip("skipping test because QEMU is disabled")
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
// pull an image
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.Nil(t, err)
|
||||
cli.NegotiateAPIVersion(context.Background())
|
||||
|
||||
// Validate if another architecture platform can be pulled
|
||||
readerArm64, err := cli.ImagePull(ctx, "node:16-buster-slim", image.PullOptions{
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -329,11 +330,16 @@ func TestRunEvent(t *testing.T) {
|
||||
|
||||
// local remote action overrides
|
||||
{workdir, "local-remote-action-overrides", "push", "", platforms, secrets},
|
||||
}
|
||||
|
||||
// docker action on host executor
|
||||
{workdir, "docker-action-host-env", "push", "", platforms, secrets},
|
||||
// docker service on host executor
|
||||
{workdir, "nginx-service-container-host-mode", "push", "", platforms, secrets},
|
||||
if _, ok := os.LookupEnv("DOOD"); !ok {
|
||||
// Does not work in Docker Out of Docker context, e.g. -v /var/run/docker.sock:/var/run/docker.sock
|
||||
tables = append(tables, []TestJobFileInfo{
|
||||
// docker action on host executor
|
||||
{workdir, "docker-action-host-env", "push", "", platforms, secrets},
|
||||
// docker service on host executor
|
||||
{workdir, "nginx-service-container-host-mode", "push", "", platforms, secrets},
|
||||
}...)
|
||||
}
|
||||
|
||||
for _, table := range tables {
|
||||
@@ -552,7 +558,6 @@ func TestRunEventHostEnvironment(t *testing.T) {
|
||||
tables = append(tables, []TestJobFileInfo{
|
||||
// Shells
|
||||
{workdir, "shells/defaults", "push", "", platforms, secrets},
|
||||
{workdir, "shells/pwsh", "push", "", platforms, secrets},
|
||||
{workdir, "shells/bash", "push", "", platforms, secrets},
|
||||
{workdir, "shells/python", "push", "", platforms, secrets},
|
||||
{workdir, "shells/sh", "push", "", platforms, secrets},
|
||||
@@ -599,6 +604,13 @@ func TestRunEventHostEnvironment(t *testing.T) {
|
||||
{workdir, "evalenv", "push", "", platforms, secrets},
|
||||
{workdir, "ensure-post-steps", "push", "Job 'second-post-step-should-fail' failed", platforms, secrets},
|
||||
}...)
|
||||
|
||||
// No pwsh on current default container image
|
||||
if pwsh, err := exec.LookPath("pwsh"); err == nil && pwsh != "" {
|
||||
tables = append(tables, []TestJobFileInfo{
|
||||
{workdir, "shells/pwsh", "push", "", platforms, secrets},
|
||||
}...)
|
||||
}
|
||||
}
|
||||
if runtime.GOOS == "windows" {
|
||||
platforms := map[string]string{
|
||||
@@ -692,6 +704,9 @@ func TestRunDifferentArchitecture(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
if _, ok := os.LookupEnv("NO_QEMU"); ok {
|
||||
t.Skip("skipping test because QEMU is disabled")
|
||||
}
|
||||
|
||||
tjfi := TestJobFileInfo{
|
||||
workdir: workdir,
|
||||
|
||||
Reference in New Issue
Block a user