Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,3 @@ jobs:
name: playground-logs-${{ matrix.flags }}
path: /tmp/playground-logs
retention-days: 5

artifacts:
name: Artifacts
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.24

- name: Download and test artifacts
run: go run main.go artifacts-all
81 changes: 5 additions & 76 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,73 +57,6 @@ var cookCmd = &cobra.Command{
},
}

var artifactsCmd = &cobra.Command{
Use: "artifacts",
Short: "List available artifacts",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return fmt.Errorf("please specify a service name")
}
serviceName := args[0]
component := playground.FindComponent(serviceName)
if component == nil {
return fmt.Errorf("service %s not found", serviceName)
}
releaseService, ok := component.(playground.ReleaseService)
if !ok {
return fmt.Errorf("service %s is not a release service", serviceName)
}
output := outputFlag
if output == "" {
homeDir, err := playground.GetHomeDir()
if err != nil {
return fmt.Errorf("failed to get home directory: %w", err)
}
output = homeDir
}
location, err := playground.DownloadRelease(output, releaseService.ReleaseArtifact())
if err != nil {
return fmt.Errorf("failed to download release: %w", err)
}
fmt.Println(location)
return nil
},
}

var artifactsAllCmd = &cobra.Command{
Use: "artifacts-all",
Short: "Download all the artifacts available in the catalog (Used for testing purposes)",
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("Downloading all artifacts...")

output := outputFlag
if output == "" {
homeDir, err := playground.GetHomeDir()
if err != nil {
return fmt.Errorf("failed to get home directory: %w", err)
}
output = homeDir
}
for _, component := range playground.Components {
releaseService, ok := component.(playground.ReleaseService)
if !ok {
continue
}
location, err := playground.DownloadRelease(output, releaseService.ReleaseArtifact())
if err != nil {
return fmt.Errorf("failed to download release: %w", err)
}

// make sure the artifact is valid to be executed on this platform
log.Printf("Downloaded %s to %s\n", releaseService.ReleaseArtifact().Name, location)
if err := isExecutableValid(location); err != nil {
return fmt.Errorf("failed to check if artifact is valid: %w", err)
}
}
return nil
},
}

var inspectCmd = &cobra.Command{
Use: "inspect",
Short: "Inspect a connection between two services",
Expand Down Expand Up @@ -192,15 +125,9 @@ func main() {
cookCmd.AddCommand(recipeCmd)
}

// reuse the same output flag for the artifacts command
artifactsCmd.Flags().StringVar(&outputFlag, "output", "", "Output folder for the artifacts")
artifactsAllCmd.Flags().StringVar(&outputFlag, "output", "", "Output folder for the artifacts")

cmd.InitWaitReadyCmd()

rootCmd.AddCommand(cookCmd)
rootCmd.AddCommand(artifactsCmd)
rootCmd.AddCommand(artifactsAllCmd)
rootCmd.AddCommand(inspectCmd)
rootCmd.AddCommand(cmd.WaitReadyCmd)

Expand Down Expand Up @@ -236,15 +163,17 @@ func runIt(recipe playground.Recipe) error {
return err
}

// if contender.tps is set, assume contender is enabled
svcManager := recipe.Apply(&playground.ExContext{
exCtx := &playground.ExContext{
LogLevel: logLevel,
// if contender.tps is set, assume contender is enabled
Contender: &playground.ContenderContext{
Enabled: contenderEnabled,
ExtraArgs: contenderArgs,
TargetChain: contenderTarget,
},
}, artifacts)
}
svcManager := playground.NewManifest(exCtx, artifacts.Out)
recipe.Apply(svcManager)
if err := svcManager.Validate(); err != nil {
return fmt.Errorf("failed to validate manifest: %w", err)
}
Expand Down
9 changes: 0 additions & 9 deletions playground/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,3 @@ func init() {
register(&BProxy{})
register(&WebsocketProxy{})
}

func FindComponent(name string) ServiceGen {
for _, component := range Components {
if component.Name() == name {
return component
}
}
return nil
}
21 changes: 21 additions & 0 deletions playground/catalog_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package playground

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestCatalogReleases(t *testing.T) {
out := newTestOutput(t)

tests := []*release{
opRethRelease,
rethELRelease,
}

for _, tc := range tests {
_, err := DownloadRelease(out.dst, tc)
require.NoError(t, err)
}
}
Loading