-
Notifications
You must be signed in to change notification settings - Fork 249
[runx] Proof of concept for runx integration #1524
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
10 commits
Select commit
Hold shift + click to select a range
0e065cb
[runx] Proof of concept for runx integration
mikeland73 09b65c2
Merge branch 'main' into landau/runx
mikeland73 e6d75f2
Fix CICD
mikeland73 8be8ed9
Merge branch 'main' into landau/runx
mikeland73 8f7e3c3
Fix issues after merge
mikeland73 4247871
Merge branch 'main' into landau/runx
mikeland73 584fda7
fmt
mikeland73 c3be0e3
Use non-user error
mikeland73 4371fde
Fix remove. Add tests
mikeland73 4c1f191
fmt
mikeland73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,10 +68,11 @@ jobs: | |
go-version-file: ./go.mod | ||
cache: false | ||
|
||
- name: Install devbox | ||
uses: jetpack-io/[email protected] | ||
with: | ||
enable-cache: true | ||
# This can be reanabled once released version supports runx | ||
# - name: Install devbox | ||
# uses: jetpack-io/[email protected] | ||
# with: | ||
# enable-cache: true | ||
|
||
- name: Mount golang cache | ||
uses: actions/cache@v3 | ||
|
@@ -82,7 +83,8 @@ jobs: | |
~/go/pkg | ||
key: go-${{ runner.os }}-${{ hashFiles('go.sum') }} | ||
|
||
- run: devbox run fmt | ||
# Use main devbox for now to ensure it supports runx | ||
- run: go run ./cmd/devbox run fmt | ||
|
||
- name: golangci-lint | ||
uses: golangci/[email protected] | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"packages": [ | ||
"[email protected]", | ||
"go@latest" | ||
"go@latest", | ||
"runx:golangci/golangci-lint@latest" | ||
], | ||
"env": { | ||
"GOENV": "off", | ||
|
@@ -20,8 +20,8 @@ | |
"GOOS=linux GOARCH=arm64 go build -o dist/devbox-linux-arm64 ./cmd/devbox" | ||
], | ||
"code": "code .", | ||
"lint": "golangci-lint run", | ||
"fmt": "scripts/gofumpt.sh", | ||
"lint": "golangci-lint run", | ||
"test": "go test -race -cover ./...", | ||
"update-examples": "devbox run build && go run testscripts/testrunner/updater/main.go" | ||
} | ||
|
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 |
---|---|---|
|
@@ -21,24 +21,8 @@ | |
} | ||
} | ||
}, | ||
"[email protected]": { | ||
"last_modified": "2023-05-01T16:53:22Z", | ||
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#golangci-lint", | ||
"version": "1.52.2", | ||
"systems": { | ||
"aarch64-darwin": { | ||
"store_path": "/nix/store/x2l9ljvl5fzffc7vggjk5yksrka9yra4-golangci-lint-1.52.2" | ||
}, | ||
"aarch64-linux": { | ||
"store_path": "/nix/store/k905aab7fj7dvf2hhsbb3mmizk052ad7-golangci-lint-1.52.2" | ||
}, | ||
"x86_64-darwin": { | ||
"store_path": "/nix/store/imxj7162whh9d56zpk1lzs1b3iw6wzp3-golangci-lint-1.52.2" | ||
}, | ||
"x86_64-linux": { | ||
"store_path": "/nix/store/nfhrynpdjd5yamz5snv2c377v1j9jdmx-golangci-lint-1.52.2" | ||
} | ||
} | ||
"runx:golangci/golangci-lint@latest": { | ||
"resolved": "runx:golangci/golangci-lint@latest" | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -226,3 +226,29 @@ func TestStorePathParts(t *testing.T) { | |
}) | ||
} | ||
} | ||
|
||
func TestCanonicalName(t *testing.T) { | ||
tests := []struct { | ||
pkgName string | ||
expectedName string | ||
}{ | ||
{"go", "go"}, | ||
{"go@latest", "go"}, | ||
{"[email protected]", "go"}, | ||
{"runx:golangci/golangci-lint@latest", "runx:golangci/golangci-lint"}, | ||
{"runx:golangci/[email protected]", "runx:golangci/golangci-lint"}, | ||
{"runx:golangci/golangci-lint", "runx:golangci/golangci-lint"}, | ||
{"github:NixOS/nixpkgs/12345", ""}, | ||
{"path:/to/my/file", ""}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.pkgName, func(t *testing.T) { | ||
pkg := PackageFromString(tt.pkgName, nil) | ||
got := pkg.CanonicalName() | ||
if got != tt.expectedName { | ||
t.Errorf("Expected canonical name %q, but got %q", tt.expectedName, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package pkgtype | ||
|
||
import "strings" | ||
|
||
const ( | ||
RunXScheme = "runx" | ||
RunXPrefix = RunXScheme + ":" | ||
) | ||
|
||
func IsRunX(s string) bool { | ||
return strings.HasPrefix(s, RunXPrefix) | ||
} |
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
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
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.
Would be preferable to include a source reference. In the future, runx may support github, gitlab, sourcehut, custom domain etc.