-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add some ignored things * use go 1.20 * go mod tidy * fix deprecated stdlib APIs from minor version releases cause thats totally cool and normal * fix deprecated flake output * here wigo * full nodejs which-language testing * more tests * another test, cleanup * move some things around, fix some fails * fix testremove logic * test guessing * better test layout * better search testing * better info testing * better add testing * better remove testing * better lock testing * better install testing * better list testing * better guess testing * add package managers to devshell for testing * exclude test suite from upm src * skip test suites that dont have tests * cleanup * add test-suite to ci * add nix to test-suite task * share nix store, run make generated * fix dependencies list i think * bleh * dont go run statik just run statik * i really hope directly invoking statik in the makefile works * remove statik * fix vendorhash * embed.FS has different expectations to statik.FS * lint * fix statik->embed paths * get rid of statik * tweak semaphore test task * try with self-hosted agent * remove some stuff from ci * oops * use nix container image * oops * change image pull secret * try this instead * use just self-hosted * install_nix script * forgot to source nix * forgot i dont need the brackets * set semaphore cache backend * set cache gcs bucket * nocache * make script more debuggable * source the install_nix script * publish test results * go get gotestsum first * try inline nix develop/shell * use makefile for the tests * fix golangci-lint invocation * fix lint * remove backend tests * cleanup * allowlist for upm derivation instead of blocklist * go back to blocklist * add test-suite command for local dev * fix expected string
- Loading branch information
Showing
20 changed files
with
1,017 additions
and
98 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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
/cmd/upm/upm | ||
/dist/ | ||
/internal/statik/ | ||
/packaging/aur/*.tar.gz | ||
/packaging/aur/*.tar.xz | ||
/packaging/aur/pkg/ | ||
|
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,20 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
set -o xtrace | ||
|
||
install_script_cache_key="install-nix-2.16.1" | ||
install_script="/tmp/$install_script_cache_key" | ||
|
||
# Install Nix. Install the base version if the currently installed version is | ||
# not what we expect. | ||
if [ \ | ||
! -f ~/.nix-profile/etc/profile.d/nix.sh -o \ | ||
"$(~/.nix-profile/bin/nix --version)" != "nix (Nix) 2.16.1" \ | ||
]; then | ||
curl -L https://releases.nixos.org/nix/nix-2.16.1/install | sh | ||
fi | ||
|
||
source ~/.nix-profile/etc/profile.d/nix.sh | ||
|
||
set +e |
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,10 +1,17 @@ | ||
{ | ||
bun, | ||
go, | ||
mkShell, | ||
nodejs, | ||
nodePackages, | ||
}: | ||
mkShell { | ||
name = "upm"; | ||
packages = [ | ||
bun | ||
go | ||
nodejs | ||
nodePackages.pnpm | ||
nodePackages.yarn | ||
]; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package testSuite | ||
|
||
import ( | ||
"testing" | ||
|
||
testUtils "github.com/replit/upm/test-suite/utils" | ||
) | ||
|
||
func TestAdd(t *testing.T) { | ||
for _, bt := range languageBackends { | ||
bt.Start(t) | ||
|
||
var pkgs []string | ||
switch bt.Backend.Name { | ||
default: | ||
t.Run(bt.Backend.Name, func(t *testing.T) { | ||
t.Skip("no test") | ||
}) | ||
continue | ||
} | ||
|
||
bt.Subtest(bt.Backend.Name, func(bt testUtils.BackendT) { | ||
doAdd(bt, pkgs...) | ||
}) | ||
} | ||
} | ||
|
||
func doAdd(bt testUtils.BackendT, pkgs ...string) { | ||
for _, tmpl := range standardTemplates { | ||
template := bt.Backend.Name + "/" + tmpl + "/" | ||
bt.Subtest(tmpl, func(bt testUtils.BackendT) { | ||
if tmpl != "no-deps" { | ||
bt.Subtest("locked", func(bt testUtils.BackendT) { | ||
bt.Subtest("each", func(bt testUtils.BackendT) { | ||
bt.AddTestFile(template+bt.Backend.Specfile, bt.Backend.Specfile) | ||
bt.AddTestFile(template+bt.Backend.Lockfile, bt.Backend.Lockfile) | ||
for _, pkg := range pkgs { | ||
bt.UpmAdd(pkg) | ||
} | ||
}) | ||
|
||
bt.Subtest("all", func(bt testUtils.BackendT) { | ||
bt.AddTestFile(template+bt.Backend.Specfile, bt.Backend.Specfile) | ||
bt.AddTestFile(template+bt.Backend.Lockfile, bt.Backend.Lockfile) | ||
bt.UpmAdd(pkgs...) | ||
}) | ||
}) | ||
} | ||
|
||
bt.Subtest("unlocked", func(bt testUtils.BackendT) { | ||
bt.Subtest("each", func(bt testUtils.BackendT) { | ||
bt.AddTestFile(template+bt.Backend.Specfile, bt.Backend.Specfile) | ||
for _, pkg := range pkgs { | ||
bt.UpmAdd(pkg) | ||
} | ||
}) | ||
|
||
bt.Subtest("all", func(bt testUtils.BackendT) { | ||
bt.AddTestFile(template+bt.Backend.Specfile, bt.Backend.Specfile) | ||
bt.UpmAdd(pkgs...) | ||
}) | ||
}) | ||
}) | ||
} | ||
} |
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,67 @@ | ||
package testSuite | ||
|
||
import ( | ||
"io" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/replit/upm/test-suite/templates" | ||
testUtils "github.com/replit/upm/test-suite/utils" | ||
) | ||
|
||
func TestGuess(t *testing.T) { | ||
for _, bt := range languageBackends { | ||
bt.Start(t) | ||
|
||
tests := make(map[string]map[string][]string) | ||
switch bt.Backend.Name { | ||
default: | ||
t.Run(bt.Backend.Name, func(t *testing.T) { | ||
t.Skip("no test") | ||
}) | ||
continue | ||
} | ||
|
||
for ext, guessSuites := range tests { | ||
bt.Subtest(ext, func(bt testUtils.BackendT) { | ||
for template, tests := range guessSuites { | ||
bt.Subtest(template, func(bt testUtils.BackendT) { | ||
for _, test := range tests { | ||
testSrcFile := "guess/" + template + "/" + test | ||
|
||
bt.Subtest(test, func(bt testUtils.BackendT) { | ||
bt.AddTestFile(testSrcFile, test+"."+ext) | ||
bt.AddTestFile(bt.Backend.Name+"/no-deps/"+bt.Backend.Specfile, bt.Backend.Specfile) | ||
|
||
expectFile, err := templates.FS.Open(testSrcFile + ".expect") | ||
if err != nil { | ||
bt.Fail("No expect file found for %s: %v", testSrcFile, err) | ||
} | ||
|
||
var expectsText strings.Builder | ||
_, err = io.Copy(&expectsText, expectFile) | ||
if err != nil { | ||
bt.Fail("Failed to read expect file for %s: %v", testSrcFile, err) | ||
} | ||
|
||
expects := strings.Split(strings.TrimSpace(expectsText.String()), "\n") | ||
|
||
bt.UpmGuess(expects...) | ||
}) | ||
} | ||
}) | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
|
||
var js = []string{ | ||
"basic", | ||
"dedup", | ||
"nested", | ||
} | ||
|
||
var ts = []string{ | ||
"typeImports", | ||
} |
Oops, something went wrong.