mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-10-10 19:32:04 +00:00
feat: validate --directory alternative to --repository to not clone (#1008)
Resolves forgejo/forgejo-actions-feature-requests#51 --- Note to reviewers: while working on fixing the exit status of the validate command, a border case was discovered when using `--clonedir . --repository .` by which it will not find an `action.yml` file at the root of the directory. It will be easier to fix and test using a `--directory` option designed to use a pre-existing directory instead because it is not a border case but the most common case really. <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - features - [PR](https://code.forgejo.org/forgejo/runner/pulls/1008): <!--number 1008 --><!--line 0 --><!--description ZmVhdDogdmFsaWRhdGUgLS1kaXJlY3RvcnkgYWx0ZXJuYXRpdmUgdG8gLS1yZXBvc2l0b3J5IHRvIG5vdCBjbG9uZQ==-->feat: validate --directory alternative to --repository to not clone<!--description--> <!--end release-notes-assistant--> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1008 Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
parent
aaf9dea44a
commit
89f37985bd
12 changed files with 293 additions and 6 deletions
|
@ -27,10 +27,20 @@ func Test_validateCmd(t *testing.T) {
|
|||
message: "one of --workflow or --action must be set",
|
||||
},
|
||||
{
|
||||
name: "MutuallyExclusive",
|
||||
name: "MutuallyExclusiveActionWorkflow",
|
||||
args: []string{"--action", "--workflow", "--path", "/tmp"},
|
||||
message: "[action workflow] were all set",
|
||||
},
|
||||
{
|
||||
name: "MutuallyExclusiveRepositoryDirectory",
|
||||
args: []string{"--repository", "example.com", "--directory", "."},
|
||||
message: "[directory repository] were all set",
|
||||
},
|
||||
{
|
||||
name: "MutuallyExclusiveClonedirDirectory",
|
||||
args: []string{"--clonedir", ".", "--directory", "."},
|
||||
message: "[clonedir directory] were all set",
|
||||
},
|
||||
{
|
||||
name: "PathActionOK",
|
||||
args: []string{"--action", "--path", "testdata/validate/good-action.yml"},
|
||||
|
@ -51,6 +61,21 @@ func Test_validateCmd(t *testing.T) {
|
|||
args: []string{"--workflow", "--path", "testdata/validate/bad-workflow.yml"},
|
||||
stdOut: "Unknown Property ruins-on",
|
||||
},
|
||||
{
|
||||
name: "DirectoryOK",
|
||||
args: []string{"--directory", "testdata/validate/good-directory"},
|
||||
stdOut: "action.yml action schema validation OK\nsubaction/action.yaml action schema validation OK\n.forgejo/workflows/action.yml workflow schema validation OK\n.forgejo/workflows/workflow1.yml workflow schema validation OK\n.forgejo/workflows/workflow2.yaml workflow schema validation OK",
|
||||
},
|
||||
{
|
||||
name: "DirectoryActionNOK",
|
||||
args: []string{"--directory", "testdata/validate/bad-directory"},
|
||||
stdOut: "action.yml action schema validation failed",
|
||||
},
|
||||
{
|
||||
name: "DirectoryWorkflowNOK",
|
||||
args: []string{"--directory", "testdata/validate/bad-directory"},
|
||||
stdOut: ".forgejo/workflows/workflow1.yml workflow schema validation failed",
|
||||
},
|
||||
{
|
||||
name: "RepositoryOK",
|
||||
args: []string{"--repository", "testdata/validate/good-repository"},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue