Skip to content
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

Rework racket based runtime/compilation #4675

Merged
merged 188 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
0540351
Further work on compilation to standalone executables
dolio Jan 16, 2024
f78c119
Revise how native compilation works
dolio Feb 5, 2024
958b8b9
Rename runner, add docs, delete dead code
dolio Feb 5, 2024
2e98e1a
Add a transcript to create generated racket libs
dolio Feb 6, 2024
c3c62c4
Give a nicer looking error for ucr/raco problems
dolio Feb 6, 2024
72743c5
Eliminate commented dead code
dolio Feb 6, 2024
788e082
Add an improved error message for unison native runtime failure
dolio Feb 7, 2024
7ce4ad2
Add information on further building to gen-racket-libs.md
dolio Feb 7, 2024
a678f55
Actually make run.native use the standalone runner
dolio Feb 7, 2024
5f946e2
Merge remote-tracking branch 'origin/trunk' into topic/native-compiler
dolio Feb 7, 2024
6703193
Rename ucr to unison-runtime
dolio Feb 8, 2024
9a253e8
Add info file for unison racket package
dolio Feb 8, 2024
038550c
Native runtime location argument, and an improved error msg
dolio Feb 9, 2024
b3cad2c
refactor ci.yaml with jit setup steps (attempt 1)
Feb 12, 2024
61d63a6
yaml
Feb 12, 2024
221ebb8
unyaml
Feb 12, 2024
eb845f1
yaml home
Feb 12, 2024
296333d
yaml unhome
Feb 12, 2024
f96d8ce
yaml move env
Feb 12, 2024
cf91e87
yaml matrix
Feb 12, 2024
5dde584
yaml can't define vars in terms of vars
Feb 12, 2024
9ff8d76
yaml quotes sometimes
Feb 12, 2024
7e0bdaf
yaml renamed var
Feb 12, 2024
27acbd4
yaml need env namespace
Feb 12, 2024
d46159c
yaml broken variables hack
Feb 12, 2024
5d4ab9f
yaml hack documentation
Feb 12, 2024
7711915
yaml job steps
Feb 12, 2024
3aa7fd9
yaml tweak identifier?
Feb 12, 2024
18bfab6
yaml that didn't work
Feb 12, 2024
62cd734
yaml bump plugins to node 20
Feb 12, 2024
7b53c51
Modify transcript runner to allow runtime path
dolio Feb 12, 2024
c61fe2e
Merge remote-tracking branch 'origin/topic/native-compiler' into topi…
dolio Feb 12, 2024
9905eb8
Fix ucm tests w/r/t/ previous additions
dolio Feb 12, 2024
0cf6222
yaml can't evaluate shell expression as value
Feb 12, 2024
6c91903
Merge branch 'topic/native-compiler' of github.com:unisonweb/unison i…
Feb 12, 2024
79356fd
yaml step id
Feb 12, 2024
03c2d63
yaml update deprecated output convention
Feb 12, 2024
23f5b1e
yaml debug windows artifact failure
Feb 12, 2024
c3cbd23
yaml temporarily disable tests
Feb 12, 2024
6561343
yaml failing to uploading files is still success
Feb 12, 2024
b8a3435
yaml swearing
Feb 12, 2024
709f4a3
yaml whoops
Feb 12, 2024
e1e5798
yaml swearing+1
Feb 12, 2024
2d906cd
yaml maybe move bins somewhere nicer
Feb 12, 2024
6e37a5e
yaml getting desperate
Feb 12, 2024
004f797
yaml loving magical filenames
Feb 12, 2024
bacf978
yaml unmagic filenames. are duplicate ids ok?
Feb 12, 2024
8100d1f
yaml no good, does globbing work for upload-artifact?
Feb 13, 2024
e08a593
yaml test linux only, for a change
Feb 13, 2024
caf4471
yaml globs don't work
Feb 13, 2024
661c286
yaml copilot whoops
Feb 13, 2024
b9536da
skip tmate for now
Feb 13, 2024
65b13f4
yaml blowing up because we skipped ormolu?
Feb 13, 2024
1649abe
yaml slightly better?
Feb 13, 2024
25d703a
Merge branch 'trunk' into topic/native-compiler
Feb 13, 2024
c8773fb
yaml can i get an `if` that makes any sense
Feb 13, 2024
befb88b
comma
Feb 13, 2024
6405ad0
yaml switch plugin
Feb 13, 2024
16c9a7e
yaml x2
Feb 13, 2024
248dca0
yaml get scheme-libs/
Feb 13, 2024
c2c6de1
yaml missed one variable name swap
Feb 13, 2024
d8e2c61
yaml where are my files?
Feb 13, 2024
4a8a42d
yaml make temp scheme dir before
Feb 13, 2024
57360bf
yaml downloaded unison artifact filename is just called unison
Feb 13, 2024
9ea88f3
yaml maybe transcript was being overwritten by checkout
Feb 14, 2024
385625c
yaml create transcript with separate path and file
Feb 14, 2024
614f573
yaml try tmate again
Feb 14, 2024
b47102c
yaml i hope quotes don't matter
Feb 14, 2024
a99b763
yaml try finnp/create-file-action@v2 instead?
Feb 14, 2024
0020135
try DamianReeves/[email protected] instead
Feb 14, 2024
f8cae18
yaml don't need to run transcript here
Feb 14, 2024
36b59b6
yaml untmate
Feb 14, 2024
aaa62d1
commit racket deps list
Feb 14, 2024
7c43317
yaml no apt on windows
Feb 14, 2024
1d25ac7
yaml tmate
Feb 14, 2024
9c66492
yaml forget broken files-exist action
Feb 14, 2024
db73426
yaml skip clone if src not needed
Feb 14, 2024
0162dff
yaml always save jit source for next step (for now)
Feb 14, 2024
cc21138
yaml more yaml
Feb 14, 2024
22dd1ff
yaml all platforms without tmate
Feb 14, 2024
0ceea67
yaml set up base codebase
Feb 14, 2024
f56fb23
don't fetch internal
Feb 14, 2024
d5c4466
yaml typo
Feb 14, 2024
8cc6b87
yaml stop before jit tests
Feb 14, 2024
2e8ca88
yaml mac doesn't have apt either
Feb 14, 2024
851cc9c
yaml switch windows path separator
Feb 14, 2024
9b93372
yaml file existence plugins don't work
Feb 14, 2024
85ded90
yaml the lack of proper flow control is astounding
Feb 14, 2024
3e6aec4
yaml always checkout repo prior to running transcript from it
Feb 14, 2024
bb66d4c
yaml whoops
Feb 15, 2024
69f41b7
yaml no clue whats going on again
Feb 15, 2024
719bd7b
yaml remove caching condition
Feb 15, 2024
ae100d0
yaml works better when uncommented
Feb 15, 2024
f747904
yaml does overriding the default with the default make it work better?
Feb 15, 2024
a662a72
yaml lame that that worked
Feb 15, 2024
964cbe8
yaml try not to blow up on the second run
Feb 15, 2024
ddc303d
yaml argh
Feb 15, 2024
d64feb2
yaml disable pause again
Feb 15, 2024
e4f1563
yaml why did windows fail to build jit binary?
Feb 15, 2024
3421b61
yaml because of course you have to specify always
Feb 15, 2024
a42ccc6
yaml jump through some hoops re `.exe` on windows
Feb 15, 2024
3b7c24b
yaml small refactor, hope I don't regret it
Feb 15, 2024
02e5c3e
yaml it never ends
Feb 15, 2024
b668fe3
jit tests reply on some types not in base
Feb 15, 2024
3cc86fa
all the mergeio types we rely on should be in base I suppose?
Feb 15, 2024
719933b
Make --runtime-path expect full executable path
dolio Feb 15, 2024
596a58c
yaml change semantics of --runtime-path
Feb 16, 2024
29d7542
Merge branch 'topic/native-compiler' of github.com:unisonweb/unison i…
Feb 16, 2024
41c06a9
yaml definitely almost done
Feb 16, 2024
759de66
yaml fix jit source cache key
Feb 16, 2024
653da00
raco distribute builds a different directory structure in windows tha…
Feb 16, 2024
06643c9
yaml accidentally a )
Feb 16, 2024
da99454
yaml accidentally the other )
Feb 16, 2024
1bd7aef
yaml actually wanted jit version, not jit source hash which we don't …
Feb 16, 2024
61b3d68
yaml same here
Feb 16, 2024
ce5f1b8
simplify but hopefully not break caching
Feb 16, 2024
b607e7a
add ioexception message to ucr and raco failures.
Feb 16, 2024
6857bf9
yaml add windows-2022 os
Feb 16, 2024
ef3ff19
cache tips
Feb 16, 2024
08f36fb
yaml maybe less broken caching
Feb 16, 2024
2d0deab
beef up the error messages around calling the native runtime
Feb 16, 2024
ce6eed9
some reference info
Feb 16, 2024
ab7495d
do re-save ~/.stack if package dependencies have changed
Feb 16, 2024
3535473
do re-save `.stack-work` after build if Haskell files have changed
Feb 16, 2024
9042865
more debug info for calling raco
Feb 17, 2024
84188db
yaml nothing useful from windows-2022 after all
Feb 17, 2024
8e7ae67
yaml set 15 minute tmate timeout
Feb 17, 2024
053e7da
try to restore jit binaries before checking for them
Feb 17, 2024
f698543
yaml reenable all the ucm tests
Feb 17, 2024
1809b62
yaml whoops
Feb 17, 2024
fa24c65
another yaml reference
Feb 17, 2024
9c07533
yaml whoops
Feb 17, 2024
2d05cb0
yaml simplify and hopefully not break our diffs
Feb 17, 2024
544bd85
yaml move ucm local bin path out of repo?
Feb 17, 2024
7e29e4a
yaml hopefully skip hopefully unnecessary work
Feb 17, 2024
738e4fb
yaml rerun if transcripts have changed
Feb 17, 2024
7ed1b7d
yaml fixup windows slashes again
Feb 17, 2024
1a2a11e
yaml case sensitive env var names
Feb 17, 2024
887b9de
yaml blerk
Feb 17, 2024
f353c30
yaml skip failing interpreter tests in windows for now
Feb 17, 2024
e30c29b
caching tips
Feb 17, 2024
de3d792
skip jit integration test on windows
Feb 18, 2024
905a042
yaml: `timeout-minutes:` is a step setting, not an actions setting.
Feb 18, 2024
c42a019
yaml: skip base pull on cache hit
Feb 18, 2024
3b3ac4f
yaml move restore jit binaries step relative to environment tweak
Feb 18, 2024
6af7019
yaml switch environment tweak relative to restore jit binaries step
Feb 18, 2024
7995022
update github-actions-help
Feb 21, 2024
0859ca3
yaml: error if nothing to upload
Feb 23, 2024
5e6c6ca
yaml: work around https://github.com/actions/cache/issues/1334
Feb 23, 2024
d7eee10
yaml: will `--embed-dlls` allow jit integration test to succeed on wi…
Feb 24, 2024
50d0e11
yaml timeout was too short for debugging
Feb 24, 2024
f608a7a
update github-actions-help
Feb 27, 2024
9412098
commend
Feb 27, 2024
91e4311
Racket chunked seq fixes for base tests
dolio Feb 29, 2024
6c69ae6
Add additional universal compare cases in racket
dolio Feb 29, 2024
b4d5da1
Define some helper functions for modular arithmetic
dolio Feb 29, 2024
a261aa0
Implement modular arithmetic for Int/Nat
dolio Feb 29, 2024
805c9f1
Scope.bytearrayOf and missing imports from prior commit
dolio Feb 29, 2024
dfd482b
Racket pattern fixes
dolio Feb 29, 2024
d72f692
Add a version flag to unison-runtime and rework slightly
dolio Feb 29, 2024
5cf73d1
Fix char class stuff (more) properly
dolio Mar 1, 2024
46ad01e
Fix racket float to text formatting a bit to match Haskell
dolio Mar 1, 2024
24379d3
Tweak fromUtf8 error message; add IOFailure type in scheme
dolio Mar 1, 2024
3048be6
Merge remote-tracking branch 'origin/trunk' into topic/native-compiler
dolio Mar 1, 2024
aa53784
Bump gen-racket-libs version for @unison/internal
dolio Mar 4, 2024
197ce9a
Update ci.yaml with jit version 0.0.11
aryairani Mar 6, 2024
3433362
disable windows jit integration tests until #4705
Mar 7, 2024
28dd96b
yaml: temporarily print what's in the cached system stack dir
Mar 7, 2024
8926e19
yaml: add test caching and change a bunch of caching stuff
Mar 7, 2024
eb33604
yaml: forgot a plugin name
Mar 7, 2024
4e22249
yaml: temporarily print what's in the stack cache, better
Mar 7, 2024
62eab49
yaml: fix test results caching?
Mar 7, 2024
47c1826
yaml: bikeshed variable names and hope nothing broke
Mar 7, 2024
4a08bed
yaml: these were supposed to be part of a previous commit
Mar 7, 2024
20a0e73
yaml: call generateSchemeBoot directly from `@unison/internal`
Mar 7, 2024
e026d13
yaml: cache key vars for invalidation
Mar 7, 2024
4dc1023
CI docs
Mar 8, 2024
98eb284
Update ci.md
aryairani Mar 8, 2024
b0e8c76
Update ci.md
aryairani Mar 8, 2024
236d895
Update ci.md
aryairani Mar 8, 2024
db3e48f
yaml: clarify that you shouldn't have to invalidate build caches
Mar 8, 2024
8df8744
Merge branch 'topic/native-compiler' of github.com:unisonweb/unison i…
Mar 8, 2024
b7530a5
remove `compile.native.{fetch,genlibs}` commands
Mar 8, 2024
021677d
yaml: update stack caching
Mar 8, 2024
e8e610d
do we need `base.output.md`?
Mar 8, 2024
5034bf4
change default ucr location to `$0/runtime/unison-runtime[.exe]`
Mar 8, 2024
bf3a99f
yaml: maybe fix stack caching condition again?
Mar 8, 2024
9f2645d
yaml: predicate requires British spelling
Mar 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/workflows/ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
The new CI workflow builds `ucm`, generates racket source, and generates `unison-runtime` (aka `ucr`), saving them all as build artifacts.

At a high level, the CI process is:
1. On all platforms, build `unisonweb/unison` Haskell program and run tests; save the resulting binaries as build artifacts
2. On Ubuntu, generate and save the Racket sources as a build artifact
3. On all platforms, build the `unison-runtime` Racket program save the resulting binaries as build artifacts.

### `env` vars at the top of `CI.yaml`:
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.11"`

Some cached directories:
- `ucm_local_bin` a temp path for caching a built `ucm`
- `jit_src_scheme` a temp path for caching generated jit sources
- `unison-jit-dist`
- `base-codebase` a codebase path for caching a codebase generated by `unison-src/builtin-tests/base.md`
- `unison_src_test_results` a temp path for caching the result of passing tests that depend on `unison-src/`, which includes:
- `round-trip-tests`
- `transcripts`
- `unison-src/builtin-tests/interpreter-tests.md`

`jit_generator_os: ubuntu-20.04`
- afaik, the jit sources are generated in a platform-independent way, so we just choose one platform to generate them on.

`*-cache-key-version` — increment one of these to invalidate its corresponding cache, though you shouldn't have to:
- `ucm-binaries`
- `unison-src-test-results`
- `stack`
- `stack-work`
- `base-codebase`
- `jit-src`
- `jit-dist`

### Cached directories:

One reason for this change is to reduce the CI time for commits that only change docs, or yaml or other uninteresting things.

#### `.stack`
Caches build dependencies needed by unison packages.

- The **cache key** includes the os, the stackage resolver, `stack.yaml`, and any `package.yaml`.

This currently will re-save on success or failure, but only on a cache miss (source changed).If we find we want to re-save even on a cache key miss (e.g. due to `stack` weirdness), we can change the condition.

#### `.stack-work`
Caches build outputs for unison packages themselves.

- The **cache key** includes the os, the stackage resolver, `stack.yaml`, and any `package.yaml`.

This currently will re-save on success or failure, but only on a cache miss (source changed).If we find we want to re-save even on a cache key miss (e.g. due to `stack` weirdness), we can change the condition.

#### `ucm_local_bin`
A built `ucm` is cached in `ucm_local_bin` after a successful build and Haskell tests pass.
- The **cache key** includes the os, `stack.yaml`, any `package.yaml`, and any `.hs` file.
- On an exact cache hit, these steps are skipped, otherwise they are run:
- restore `.stack`
- restore `.stack-work`
- install `stack`
- build `ucm` dependencies
- build `ucm`
- `unison-cli` tests
- `unison-core` tests
- `unison-parser-typechecker` tests
- `unison-sqlite` tests
- `unison-syntax` tests
- `unison-util-bytes` tests
- `unison-util-cache` tests
- `unison-util-relation` tests
- `cli-integration-tests`
- verification of `stack ghci` startup
- `interpreter-tests.md`

#### `unison_src_test_results`
A bit is cached in `unison_src_test_results` after non-Haskell tests in the `unison` repo pass.
- The **cache key** includes os, `stack.yaml`, any `package.yaml`, any `.hs` file, and any file in `unison-src/`
- On an exact cache hit, these steps are skipped, otherwise they are run:
- `round-trip-tests`
- `transcripts`
- `unison-src/builtin-tests/interpreter-tests.md`
- If all steps suceed, the `unison_src_test_results` bit is saved.

#### `base-codebase`
This stores the result of `base.md`, which can be reused later to save the cost of a `pull`.
No steps are skipped on a cache hit; however, a second `pull` will mostly be a no-op.

#### `jit_src_scheme`
JIT sources are cached in `jit_src_scheme` if the `generate-jit-source` job completes.
- The **cache key** includes the version of Racket, and the release version of `@unison/internal`.
- If the cache contains `{data-info, boot-generated, simple-wrappers, builtin-generated, compound-wrappers}.ss`, then these steps are skipped, otherwise they are run:
- "create transcript" to produce pull `@unison/internal` and run `generateSchemeBoot`.
- download `ucm artifact` saved in the previous step
- set `ucm` permissions
- checkout `unison` repo, which includes some static scheme and racket files.
- run the previously generated transcript
- If all steps succeed, the `jit_src_scheme` cache is saved.

#### `jit_dist`
JIT binaries are cached in `jit_dist` if the `build-jit-binary` job completes.
- The **cache key** includes the version of Racket, and the release version of `@unison/internal`.
- On an exact cache hit, these steps are skipped, otherwise they are run:
- Restore Racket dependencies
- setup Racket
- restore apt cache (Linux only)
- download jit source from previous job
- use `raco` to build jit binary
- download `ucm` artifact from previous job
- set `ucm` permissions
- restore `base` codebase saved in previous job
- jit integration test
- If all of these steps succeed, the `jit_dist` cache is saved.
Loading
Loading