-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/trunk' into cp/edit-namespace
- Loading branch information
Showing
313 changed files
with
5,587 additions
and
8,318 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
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,89 @@ | ||
name: update-transcripts | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update_transcripts: | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash | ||
strategy: | ||
matrix: | ||
os: | ||
- macOS-12 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: stackage-resolver | ||
name: record stackage resolver | ||
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files | ||
# looks for `resolver: nightly-yyyy-mm-dd` or `resolver: lts-xx.yy` in `stack.yaml` and splits it into | ||
# `nightly` or `lts-xx`. the whole resolver string is put into resolver_long as a backup cache key | ||
# ${{ steps.stackage-resolver.outputs.resolver_short }} | ||
# ${{ steps.stackage-resolver.outputs.resolver_long }} | ||
run: | | ||
grep resolver stack.yaml | awk '{ x="resolver_short="; if (split($2,a,"-") > 2) print x a[1]; else {split($2,b,"."); print x b[1]}}' >> "$GITHUB_OUTPUT" | ||
grep resolver stack.yaml | awk '{print "resolver_long="$2}' >> "$GITHUB_OUTPUT" | ||
# Cache ~/.stack, keyed by the contents of 'stack.yaml'. | ||
- uses: actions/cache@v3 | ||
name: cache ~/.stack (unix) | ||
if: runner.os != 'Windows' | ||
with: | ||
path: ~/.stack | ||
key: stack-1_${{matrix.os}}-${{ steps.stackage-resolver.outputs.resolver_long }}-${{hashFiles('**/stack.yaml')}}-${{github.sha}} | ||
# Fall-back to use the most recent cache for the stack.yaml, or failing that the OS | ||
restore-keys: | | ||
stack-1_${{matrix.os}}-${{ steps.stackage-resolver.outputs.resolver_long }}-${{hashFiles('**/stack.yaml')}}- | ||
stack-1_${{matrix.os}}-${{ steps.stackage-resolver.outputs.resolver_long }}- | ||
stack-1_${{matrix.os}}-${{ steps.stackage-resolver.outputs.resolver_short }}- | ||
stack-1_${{matrix.os}}-${{ steps.stackage-resolver.outputs.resolver_short }}. | ||
stack-1_${{matrix.os}}- | ||
# Cache each local package's ~/.stack-work for fast incremental builds in CI. | ||
- uses: actions/cache@v3 | ||
name: cache .stack-work | ||
with: | ||
path: | | ||
**/.stack-work | ||
# Main cache key: commit hash. This should always result in a cache miss... | ||
# So when loading a cache we'll always fall back to the restore-keys, | ||
# which should load the most recent cache via a prefix search on the most | ||
# recent branch cache. | ||
# Then it will save a new cache at this commit sha, which should be used by | ||
# the next build on this branch. | ||
key: stack-work-4_${{matrix.os}}-${{ steps.stackage-resolver.outputs.resolver_short }}-${{hashFiles('**/stack.yaml')}}-${{github.sha}} | ||
restore-keys: | | ||
stack-work-4_${{matrix.os}}-${{ steps.stackage-resolver.outputs.resolver_long }}-${{hashFiles('**/stack.yaml')}}- | ||
stack-work-4_${{matrix.os}}-${{ steps.stackage-resolver.outputs.resolver_long }}- | ||
stack-work-4_${{matrix.os}}-${{ steps.stackage-resolver.outputs.resolver_short }}- | ||
stack-work-4_${{matrix.os}}-${{ steps.stackage-resolver.outputs.resolver_short }}. | ||
stack-work-4_${{matrix.os}}- | ||
# Install stack by downloading the binary from GitHub. | ||
# The installation process differs by OS. | ||
- name: install stack (Linux) | ||
if: runner.os == 'Linux' | ||
working-directory: ${{ runner.temp }} | ||
run: | | ||
mkdir stack && cd stack | ||
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-linux-x86_64.tar.gz | tar -xz | ||
echo "$PWD/stack-"* >> $GITHUB_PATH | ||
# One of the transcripts fails if the user's git name hasn't been set. | ||
- name: set git user info | ||
run: | | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
- name: build | ||
run: stack --no-terminal build --fast --no-run-tests --test | ||
- name: round-trip-tests | ||
run: | | ||
stack --no-terminal exec unison transcript unison-src/transcripts-round-trip/main.md | ||
stack --no-terminal exec unison transcript unison-src/transcripts-manual/rewrites.md | ||
- name: transcripts | ||
run: stack --no-terminal exec transcripts | ||
- name: save transcript changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: rerun transcripts (reminder to rerun CI!) |
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,23 @@ | ||
FROM debian:stable | ||
|
||
RUN adduser --home /unison --disabled-password unison | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y git libncurses5 less locales fzf && \ | ||
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ | ||
dpkg-reconfigure --frontend=noninteractive locales && \ | ||
update-locale LANG=en_US.UTF-8 | ||
|
||
|
||
COPY tmp/ucm/ucm /usr/local/bin/ucm | ||
COPY tmp/ucm/ui /usr/local/share/ucm | ||
|
||
ENV UCM_WEB_UI=/usr/local/share/ucm | ||
ENV UCM_PORT=8080 | ||
ENV UCM_TOKEN=pub | ||
|
||
RUN chmod 555 /usr/local/bin/ucm | ||
|
||
EXPOSE 8080 | ||
ENTRYPOINT ["/usr/local/bin/ucm"] | ||
CMD ["--codebase","/unison"] |
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
54 changes: 54 additions & 0 deletions
54
codebase2/codebase-sqlite-hashing-v2/src/U/Codebase/Decl/Hashing.hs
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,54 @@ | ||
module U.Codebase.Decl.Hashing where | ||
|
||
import Control.Lens | ||
import Data.Foldable qualified as Foldable | ||
import Data.Map qualified as Map | ||
import U.Codebase.Decl qualified as C | ||
import U.Codebase.Decl qualified as C.Decl | ||
import U.Codebase.HashTags | ||
import U.Codebase.Reference qualified as Reference | ||
import U.Codebase.Sqlite.Decl.Format qualified as DeclFormat | ||
import U.Codebase.Sqlite.HashHandle (HashMismatch (..)) | ||
import U.Codebase.Sqlite.HashHandle qualified as HH | ||
import U.Codebase.Sqlite.LocalIds qualified as LocalIds | ||
import U.Codebase.Sqlite.Queries qualified as Q | ||
import U.Codebase.Sqlite.Symbol qualified as S | ||
import U.Codebase.Sqlite.Symbol qualified as Sqlite | ||
import Unison.Hash32 | ||
import Unison.Hash32 qualified as Hash32 | ||
import Unison.Hashing.V2 qualified as H2 | ||
import Unison.Hashing.V2.Convert2 qualified as H2 | ||
import Unison.Prelude | ||
import Unison.Symbol qualified as Unison | ||
import Unison.Syntax.Name qualified as Name | ||
import Unison.Var qualified as Var | ||
|
||
verifyDeclFormatHash :: ComponentHash -> DeclFormat.HashDeclFormat -> Maybe HH.DeclHashingError | ||
verifyDeclFormatHash (ComponentHash hash) (DeclFormat.Decl (DeclFormat.LocallyIndexedComponent elements)) = | ||
Foldable.toList elements | ||
& fmap s2cDecl | ||
& Reference.component hash | ||
& fmap (\(decl, refId) -> (refId, (C.Decl.vmap symbol2to1 decl, ()))) | ||
& Map.fromList | ||
& C.Decl.unhashComponent hash Var.unnamedRef | ||
& Map.toList | ||
& fmap (\(_refId, (v, decl, ())) -> (v, either H2.toDataDecl id $ H2.v2ToH2Decl decl)) | ||
& Map.fromList | ||
& H2.hashDecls Name.unsafeFromVar | ||
& \case | ||
Left _err -> Just HH.DeclHashResolutionFailure | ||
Right m -> | ||
m | ||
& altMap \(_, H2.ReferenceId hash' _, _) -> | ||
if hash == hash' | ||
then Nothing | ||
else Just (HH.DeclHashMismatch $ HashMismatch hash hash') | ||
where | ||
symbol2to1 :: S.Symbol -> Unison.Symbol | ||
symbol2to1 (S.Symbol i t) = Unison.Symbol i (Var.User t) | ||
|
||
s2cDecl :: (LocalIds.LocalIds' Text Hash32, DeclFormat.Decl Sqlite.Symbol) -> C.Decl Sqlite.Symbol | ||
s2cDecl (ids, decl) = | ||
let Identity (substText, substHash) = Q.localIdsToLookups Identity pure (bimap id Hash32.toHash ids) | ||
refmap = (bimap substText (fmap substHash)) | ||
in Q.x2cDecl refmap decl |
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
Oops, something went wrong.