mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 02:25:39 +03:00
⅄ trunk → topic/merge4
This commit is contained in:
commit
693af9c809
2
.github/workflows/ci.md
vendored
2
.github/workflows/ci.md
vendored
@ -9,7 +9,7 @@ At a high level, the CI process is:
|
||||
Some version numbers that are used during CI:
|
||||
- `ormolu_version: "0.5.0.1"`
|
||||
- `racket_version: "8.7"`
|
||||
- `jit_version: "@unison/internal/releases/0.0.16"`
|
||||
- `jit_version: "@unison/internal/releases/0.0.17"`
|
||||
|
||||
Some cached directories:
|
||||
- `ucm_local_bin` a temp path for caching a built `ucm`
|
||||
|
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
@ -20,7 +20,7 @@ on:
|
||||
env:
|
||||
ormolu_version: 0.5.2.0
|
||||
ucm_local_bin: ucm-local-bin
|
||||
jit_version: "@unison/internal/releases/0.0.16"
|
||||
jit_version: "@unison/internal/releases/0.0.17"
|
||||
jit_src_scheme: unison-jit-src/scheme-libs/racket
|
||||
jit_dist: unison-jit-dist
|
||||
jit_generator_os: ubuntu-20.04
|
||||
|
@ -251,6 +251,7 @@ module U.Codebase.Sqlite.Queries
|
||||
addMostRecentNamespaceTable,
|
||||
addSquashResultTable,
|
||||
addSquashResultTableIfNotExists,
|
||||
cdToProjectRoot,
|
||||
|
||||
-- ** schema version
|
||||
currentSchemaVersion,
|
||||
@ -411,7 +412,7 @@ type TextPathSegments = [Text]
|
||||
-- * main squeeze
|
||||
|
||||
currentSchemaVersion :: SchemaVersion
|
||||
currentSchemaVersion = 15
|
||||
currentSchemaVersion = 16
|
||||
|
||||
createSchema :: Transaction ()
|
||||
createSchema = do
|
||||
@ -475,6 +476,10 @@ addSquashResultTableIfNotExists :: Transaction ()
|
||||
addSquashResultTableIfNotExists =
|
||||
executeStatements $(embedProjectStringFile "sql/010-ensure-squash-cache-table.sql")
|
||||
|
||||
cdToProjectRoot :: Transaction ()
|
||||
cdToProjectRoot =
|
||||
executeStatements $(embedProjectStringFile "sql/011-cd-to-project-root.sql")
|
||||
|
||||
schemaVersion :: Transaction SchemaVersion
|
||||
schemaVersion =
|
||||
queryOneCol
|
||||
|
5
codebase2/codebase-sqlite/sql/011-cd-to-project-root.sql
Normal file
5
codebase2/codebase-sqlite/sql/011-cd-to-project-root.sql
Normal file
@ -0,0 +1,5 @@
|
||||
-- As part of deprecating cd, we want users who have cd'd deeper than their project root to be parked at the root instead.
|
||||
UPDATE "most_recent_namespace"
|
||||
SET "namespace" = json_array("namespace" -> 0, "namespace" -> 1, "namespace" -> 2, "namespace" -> 3)
|
||||
WHERE "namespace" ->> 0 = '__projects'
|
||||
AND json_array_length("namespace") > 4;
|
@ -1,6 +1,6 @@
|
||||
cabal-version: 1.12
|
||||
|
||||
-- This file has been generated from package.yaml by hpack version 0.35.2.
|
||||
-- This file has been generated from package.yaml by hpack version 0.36.0.
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
|
||||
@ -20,6 +20,7 @@ extra-source-files:
|
||||
sql/008-add-most-recent-namespace-table.sql
|
||||
sql/009-add-squash-cache-table.sql
|
||||
sql/010-ensure-squash-cache-table.sql
|
||||
sql/011-cd-to-project-root.sql
|
||||
sql/create.sql
|
||||
|
||||
source-repository head
|
||||
|
@ -95,6 +95,7 @@
|
||||
assert nixpkgs-packages.hpack.version == versions.hpack;
|
||||
{
|
||||
packages = nixpkgs-packages // {
|
||||
default = haskell-nix-flake.defaultPackage;
|
||||
haskell-nix = haskell-nix-flake.packages;
|
||||
docker = import ./nix/docker.nix { inherit pkgs; haskell-nix = haskell-nix-flake.packages; };
|
||||
build-tools = pkgs.symlinkJoin {
|
||||
|
@ -80,7 +80,8 @@ migrations getDeclType termBuffer declBuffer rootCodebasePath =
|
||||
(12, migrateSchema11To12),
|
||||
sqlMigration 13 Q.addMostRecentNamespaceTable,
|
||||
sqlMigration 14 Q.addSquashResultTable,
|
||||
sqlMigration 15 Q.addSquashResultTableIfNotExists
|
||||
sqlMigration 15 Q.addSquashResultTableIfNotExists,
|
||||
sqlMigration 16 Q.cdToProjectRoot
|
||||
]
|
||||
where
|
||||
sqlMigration :: SchemaVersion -> Sqlite.Transaction () -> (SchemaVersion, Sqlite.Transaction ())
|
||||
|
@ -308,7 +308,7 @@
|
||||
(let ([bs (map reify-value (chunked-list->list bs0))]
|
||||
[tl (reference->typelink rf)])
|
||||
(cond
|
||||
[(eqv? tl builtin-boolean:typelink)
|
||||
[(equal? tl builtin-boolean:typelink)
|
||||
(cond
|
||||
[(not (null? bs))
|
||||
(raise
|
||||
|
@ -53,14 +53,17 @@ import Unison.Util.Monoid (foldMapM)
|
||||
import Unison.Util.Relation qualified as R
|
||||
import Unison.Util.Set qualified as Set
|
||||
import Unison.WatchKind qualified as WK
|
||||
import Unison.Codebase.Path (Path)
|
||||
import Unison.Reference (TermReferenceId)
|
||||
import qualified Unison.Codebase.Path as Path
|
||||
|
||||
-- | Handle a @test@ command.
|
||||
-- Run pure tests in the current subnamespace.
|
||||
handleTest :: TestInput -> Cli ()
|
||||
handleTest TestInput {includeLibNamespace, showFailures, showSuccesses} = do
|
||||
handleTest TestInput {includeLibNamespace, path, showFailures, showSuccesses} = do
|
||||
Cli.Env {codebase} <- ask
|
||||
|
||||
testRefs <- findTermsOfTypes codebase includeLibNamespace (NESet.singleton (DD.testResultListType mempty))
|
||||
testRefs <- findTermsOfTypes codebase includeLibNamespace path (NESet.singleton (DD.testResultListType mempty))
|
||||
|
||||
cachedTests <-
|
||||
Map.fromList <$> Cli.runTransaction do
|
||||
@ -138,9 +141,10 @@ handleIOTest main = do
|
||||
runIOTest suffixifiedPPE ref
|
||||
Cli.respond $ TestResults Output.NewlyComputed suffixifiedPPE True True oks fails
|
||||
|
||||
findTermsOfTypes :: Codebase.Codebase m Symbol Ann -> Bool -> NESet (Type.Type Symbol Ann) -> Cli (Set Reference.Id)
|
||||
findTermsOfTypes codebase includeLib filterTypes = do
|
||||
branch <- Cli.getCurrentBranch0
|
||||
findTermsOfTypes :: Codebase.Codebase m Symbol Ann -> Bool -> Path -> NESet (Type.Type Symbol Ann) -> Cli (Set TermReferenceId)
|
||||
findTermsOfTypes codebase includeLib path filterTypes = do
|
||||
branch <- Cli.expectBranch0AtPath path
|
||||
|
||||
let possibleTests =
|
||||
branch
|
||||
& (if includeLib then id else Branch.withoutLib)
|
||||
@ -157,7 +161,7 @@ handleAllIOTests = do
|
||||
names <- Cli.currentNames
|
||||
pped <- Cli.prettyPrintEnvDeclFromNames names
|
||||
let suffixifiedPPE = PPED.suffixifiedPPE pped
|
||||
ioTestRefs <- findTermsOfTypes codebase False (Runtime.ioTestTypes runtime)
|
||||
ioTestRefs <- findTermsOfTypes codebase False Path.empty (Runtime.ioTestTypes runtime)
|
||||
case NESet.nonEmptySet ioTestRefs of
|
||||
Nothing -> Cli.respond $ TestResults Output.NewlyComputed suffixifiedPPE True True [] []
|
||||
Just neTestRefs -> do
|
||||
|
@ -301,6 +301,8 @@ data PushRemoteBranchInput = PushRemoteBranchInput
|
||||
data TestInput = TestInput
|
||||
{ -- | Should we run tests in the `lib` namespace?
|
||||
includeLibNamespace :: Bool,
|
||||
-- | Relative path to run the tests in. Ignore if `includeLibNamespace` is True - that means test everything.
|
||||
path :: Path,
|
||||
showFailures :: Bool,
|
||||
showSuccesses :: Bool
|
||||
}
|
||||
|
@ -2418,20 +2418,31 @@ debugNameDiff =
|
||||
test :: InputPattern
|
||||
test =
|
||||
InputPattern
|
||||
"test"
|
||||
[]
|
||||
I.Visible
|
||||
[]
|
||||
"`test` runs unit tests for the current branch."
|
||||
( const $
|
||||
pure $
|
||||
Input.TestI
|
||||
Input.TestInput
|
||||
{ includeLibNamespace = False,
|
||||
showFailures = True,
|
||||
showSuccesses = True
|
||||
}
|
||||
)
|
||||
{ patternName = "test",
|
||||
aliases = [],
|
||||
visibility = I.Visible,
|
||||
args = [("namespace", Optional, namespaceArg)],
|
||||
help =
|
||||
P.wrapColumn2
|
||||
[ ("`test`", "runs unit tests for the current branch"),
|
||||
("`test foo`", "runs unit tests for the current branch defined in namespace `foo`")
|
||||
],
|
||||
parse = \args ->
|
||||
maybe (Left (I.help test)) Right do
|
||||
path <-
|
||||
case args of
|
||||
[] -> Just Path.empty
|
||||
[pathString] -> eitherToMaybe $ Path.parsePath pathString
|
||||
_ -> Nothing
|
||||
Just $
|
||||
Input.TestI
|
||||
Input.TestInput
|
||||
{ includeLibNamespace = False,
|
||||
path,
|
||||
showFailures = True,
|
||||
showSuccesses = True
|
||||
}
|
||||
}
|
||||
|
||||
testAll :: InputPattern
|
||||
testAll =
|
||||
@ -2446,6 +2457,7 @@ testAll =
|
||||
Input.TestI
|
||||
Input.TestInput
|
||||
{ includeLibNamespace = True,
|
||||
path = Path.empty,
|
||||
showFailures = True,
|
||||
showSuccesses = True
|
||||
}
|
||||
@ -2553,7 +2565,7 @@ ioTestAll =
|
||||
help =
|
||||
P.wrapColumn2
|
||||
[ ( "`io.test.all`",
|
||||
"Runs all tests which use IO within the scope of the current namespace."
|
||||
"runs unit tests for the current branch that use IO"
|
||||
)
|
||||
],
|
||||
parse = \case
|
||||
|
@ -5,7 +5,7 @@ Next, we'll download the jit project and generate a few Racket files from it.
|
||||
|
||||
```ucm
|
||||
.> project.create-empty jit-setup
|
||||
jit-setup/main> pull @unison/internal/releases/0.0.16 lib.jit
|
||||
jit-setup/main> pull @unison/internal/releases/0.0.17 lib.jit
|
||||
```
|
||||
|
||||
```unison
|
||||
|
@ -20,7 +20,7 @@ Next, we'll download the jit project and generate a few Racket files from it.
|
||||
|
||||
🎉 🥳 Happy coding!
|
||||
|
||||
jit-setup/main> pull @unison/internal/releases/0.0.16 lib.jit
|
||||
jit-setup/main> pull @unison/internal/releases/0.0.17 lib.jit
|
||||
|
||||
Downloaded 15091 entities.
|
||||
|
||||
|
@ -9,6 +9,9 @@ The `test` command should run all of the tests in the current directory.
|
||||
```unison
|
||||
test1 : [Result]
|
||||
test1 = [Ok "test1"]
|
||||
|
||||
foo.test2 : [Result]
|
||||
foo.test2 = [Ok "test2"]
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
@ -46,3 +49,9 @@ testInLib = [Ok "testInLib"]
|
||||
```ucm
|
||||
.lib> test
|
||||
```
|
||||
|
||||
`test` can be given a relative path, in which case it will only run tests found somewhere in that namespace.
|
||||
|
||||
```ucm
|
||||
.> test foo
|
||||
```
|
||||
|
@ -5,6 +5,9 @@ The `test` command should run all of the tests in the current directory.
|
||||
```unison
|
||||
test1 : [Result]
|
||||
test1 = [Ok "test1"]
|
||||
|
||||
foo.test2 : [Result]
|
||||
foo.test2 = [Ok "test2"]
|
||||
```
|
||||
|
||||
```ucm
|
||||
@ -17,7 +20,8 @@ test1 = [Ok "test1"]
|
||||
|
||||
⍟ These new definitions are ok to `add`:
|
||||
|
||||
test1 : [Result]
|
||||
foo.test2 : [Result]
|
||||
test1 : [Result]
|
||||
|
||||
```
|
||||
```ucm
|
||||
@ -29,13 +33,18 @@ test1 = [Ok "test1"]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
New test results:
|
||||
|
||||
◉ test1 test1
|
||||
◉ foo.test2 test2
|
||||
◉ test1 test1
|
||||
|
||||
✅ 1 test(s) passing
|
||||
✅ 2 test(s) passing
|
||||
|
||||
Tip: Use view test1 to view the source of a test.
|
||||
Tip: Use view foo.test2 to view the source of a test.
|
||||
|
||||
```
|
||||
Tests should be cached if unchanged.
|
||||
@ -45,11 +54,12 @@ Tests should be cached if unchanged.
|
||||
|
||||
Cached test results (`help testcache` to learn more)
|
||||
|
||||
◉ test1 test1
|
||||
◉ foo.test2 test2
|
||||
◉ test1 test1
|
||||
|
||||
✅ 1 test(s) passing
|
||||
✅ 2 test(s) passing
|
||||
|
||||
Tip: Use view test1 to view the source of a test.
|
||||
Tip: Use view foo.test2 to view the source of a test.
|
||||
|
||||
```
|
||||
`test` won't descend into the `lib` namespace, but `test.all` will.
|
||||
@ -77,20 +87,22 @@ testInLib = [Ok "testInLib"]
|
||||
|
||||
Cached test results (`help testcache` to learn more)
|
||||
|
||||
◉ test1 test1
|
||||
◉ foo.test2 test2
|
||||
◉ test1 test1
|
||||
|
||||
✅ 1 test(s) passing
|
||||
✅ 2 test(s) passing
|
||||
|
||||
Tip: Use view test1 to view the source of a test.
|
||||
Tip: Use view foo.test2 to view the source of a test.
|
||||
|
||||
.> test.all
|
||||
|
||||
|
||||
Cached test results (`help testcache` to learn more)
|
||||
|
||||
◉ test1 test1
|
||||
◉ foo.test2 test2
|
||||
◉ test1 test1
|
||||
|
||||
✅ 1 test(s) passing
|
||||
✅ 2 test(s) passing
|
||||
|
||||
✅
|
||||
|
||||
@ -121,3 +133,17 @@ testInLib = [Ok "testInLib"]
|
||||
Tip: Use view testInLib to view the source of a test.
|
||||
|
||||
```
|
||||
`test` can be given a relative path, in which case it will only run tests found somewhere in that namespace.
|
||||
|
||||
```ucm
|
||||
.> test foo
|
||||
|
||||
Cached test results (`help testcache` to learn more)
|
||||
|
||||
◉ foo.test2 test2
|
||||
|
||||
✅ 1 test(s) passing
|
||||
|
||||
Tip: Use view foo.test2 to view the source of a test.
|
||||
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user