-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* It... works??? * Making things nice * Add runner test action and job to verify suite
- Loading branch information
1 parent
4649cef
commit 98e1351
Showing
7 changed files
with
99 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Execute runner tests | ||
description: Execute the runner test suite against a given runner binary. | ||
|
||
inputs: | ||
path: | ||
description: The path to the runner binary. | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Build runner test | ||
uses: ./.github/actions/build-cs | ||
with: | ||
path: src/RunnerTest | ||
configuration: Release | ||
|
||
- name: Execute runner tests on ${{ inputs.path }} | ||
shell: bash | ||
run: | | ||
dotnet run \ | ||
--project src/RunnerTest \ | ||
--configuration Release \ | ||
${{ inputs.path }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,54 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/unstoppablemango/tdl/pkg/uml" | ||
"google.golang.org/protobuf/proto" | ||
) | ||
|
||
func NewFromCmd(create uml.NewConverter) *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "from", | ||
Args: cobra.ExactArgs(1), | ||
Use: "from", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
opts := uml.ConverterOptions{} | ||
uml.Apply(&opts, uml.WithMimeType(args[0])) | ||
conv := create(opts) | ||
spec, err := conv.From(cmd.Context(), os.Stdin) | ||
fmt.Printf("output:\n%s\n", spec) | ||
return err | ||
spec, err := create(opts).From(cmd.Context(), os.Stdin) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
data, err := proto.Marshal(spec) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if _, err = os.Stdout.Write(data); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
}, | ||
} | ||
} | ||
|
||
func NewGenCmd(create uml.NewGenerator) *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "gen", | ||
Args: cobra.ExactArgs(1), | ||
Use: "gen", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
opts := uml.GeneratorOptions{} | ||
uml.Apply(&opts, uml.WithTarget(args[0])) | ||
gen := create(opts) | ||
return gen.Gen(cmd.Context(), ¨.Spec{}, os.Stdout) | ||
data, err := io.ReadAll(os.Stdin) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
spec := uml.Spec{} | ||
if err = proto.Unmarshal(data, &spec); err != nil { | ||
return err | ||
} | ||
|
||
return create(opts).Gen(cmd.Context(), &spec, os.Stdout) | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters