-
Notifications
You must be signed in to change notification settings - Fork 1
Implement detection, build, and upload features for multiple stacks #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
bc203c8
feat(detect): stack detection engine and anvil detect command
davidcreated 14f78e6
Merge pull request #1 from openforge-oss/feat/detect-engine
davidcreated 9705452
feat(build): guided build lifecycle and anvil build (#3)
davidcreated 366e550
feat(sign): guided release signing (#11)
davidcreated 241e249
Merge branch 'main' into develop
davidcreated c17f5c1
feat(upload): store upload and GoReleaser self-distribution (#13)
davidcreated cefe43b
feat(detect,driver): Go and web/Node stacks (#14)
davidcreated 4fd964e
Merge branch 'main' into develop
davidcreated cf7e675
chore(release): prepare v0.1.0 (#16)
davidcreated b857f6e
Merge branch 'main' into develop
davidcreated 7269446
docs: real install instructions, and bump actions off Node 20 (#18)
davidcreated 836c6ae
Merge branch 'main' into develop
davidcreated eac6e7a
feat(build): add lifecycle phase selection (#20)
huytdps13400 9e1b4c6
Merge branch 'main' into develop
davidcreated File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,57 @@ | ||
| package cmd | ||
|
|
||
| import ( | ||
| "reflect" | ||
| "strings" | ||
| "testing" | ||
|
|
||
| "github.com/openforge-oss/anvil/internal/driver" | ||
| ) | ||
|
|
||
| func TestSelectBuildPhases(t *testing.T) { | ||
| available := []driver.Phase{driver.Deps, driver.Analyze, driver.Test, driver.Build} | ||
|
|
||
| tests := []struct { | ||
| name string | ||
| until string | ||
| only string | ||
| want []driver.Phase | ||
| wantErr string | ||
| }{ | ||
| {name: "all phases by default", want: available}, | ||
| {name: "inclusive prefix", until: "analyze", want: []driver.Phase{driver.Deps, driver.Analyze}}, | ||
| {name: "one phase", only: "test", want: []driver.Phase{driver.Test}}, | ||
| {name: "conflicting selectors", until: "test", only: "analyze", wantErr: "cannot be used together"}, | ||
| {name: "unknown phase", only: "sign", wantErr: "available phases: deps, analyze, test, build"}, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| got, err := selectBuildPhases(available, tt.until, tt.only) | ||
| if tt.wantErr != "" { | ||
| if err == nil || !strings.Contains(err.Error(), tt.wantErr) { | ||
| t.Fatalf("error = %v, want substring %q", err, tt.wantErr) | ||
| } | ||
| return | ||
| } | ||
| if err != nil { | ||
| t.Fatalf("selectBuildPhases() error = %v", err) | ||
| } | ||
| if !reflect.DeepEqual(got, tt.want) { | ||
| t.Fatalf("phases = %v, want %v", got, tt.want) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSelectBuildPhasesIncludesOptionalSign(t *testing.T) { | ||
| available := append(append([]driver.Phase{}, driver.Phases...), driver.Sign) | ||
|
|
||
| got, err := selectBuildPhases(available, "", "sign") | ||
| if err != nil { | ||
| t.Fatalf("selectBuildPhases() error = %v", err) | ||
| } | ||
| if !reflect.DeepEqual(got, []driver.Phase{driver.Sign}) { | ||
| t.Fatalf("phases = %v, want [sign]", got) | ||
| } | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Validate phase selection before signing setup.
Lines 79-82 select phases only after lines 70-77 call
setupSigning. Withanvil build --sign --only unknown, the command can change signing files before it returns the unknown-phase error. With--only depsor--until build, it can configure signing althoughsignis not selected. Validate and select from the candidate phase list beforesetupSigning. Invoke signing setup only when the selected phases include signing. Add command-level regression coverage for these cases.🤖 Prompt for AI Agents