1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-12 14:28:08 +03:00
Commit Graph

58 Commits

Author SHA1 Message Date
Jonathan Cubides
384653f630 No run jobs after pr is closed/merged, docs only on pushes to main (#1779) 2023-01-27 19:01:25 +01:00
Jonathan Cubides
cd2af04601
Install wasmer binary from Github releases (#1765)
The current Github action responsible for installing Wasmer fails from
time to time, and it also is outdated, not following the new NodeJS 16
requirement by Github.

We could use https://github.com/jaxxstorm/action-install-gh-release
instead, but unfortunately, it does not have the proper support to
expose the binaries contained in an inner folder, as in the case with
the Wasmer release. In the meantime, let's use my
[fork](https://github.com/jonaprieto/action-install-gh-release) while I
open PR to the main repository.
2023-01-25 13:45:04 +00:00
Jonathan Cubides
2094e5daea
Remove hlint from the CI and pre-commit config (#1759) 2023-01-24 13:55:12 +01:00
Jonathan Cubides
807b3b1770
Update CI to install Smoke, Github actions, and Makefile fixes (#1735)
This PR adds some maintenance at different levels to the CI config, the
Make file, and formatting.

- Most of the actions used by the CI related to haskell, ormolu, hlint
and pre-commit have been updated because Github requires NodeJS 16. This
change removes all the old warnings related to nodeJs.
In the case of ormolu, the new version makes us format some files that
were not formatted before, similarly with hlint.
- The CI has been updated to use the latest version of the Smoke testing
framework, which introduced installation of the dependencies for Linux
(libicu66) and macOS (icu4c) in the CI. In the case of macOS, the CI
uses a binary for smoke. For Linux, we use stack to build smoke from the
source. The source here is in a fork of [the official Smoke
repo](https://github.com/SamirTalwar/smoke). Such includes some
features/changes that are not yet in the official repo.

- The Makefile runs the ormolu and hlint targets using as a path for the
binaries the environment variables ORMOLU and HLINT. Thus, export those
variables in your environment before running `make check,` `make format`
or `make hlint`. Otherwise, the Makefile will use the binaries provided
by `stack`.

Co-authored-by: Paul Cadman <git@paulcadman.dev>
2023-01-24 11:50:23 +01:00
Paul Cadman
c66720d6d9
Fix demo example build (#1757)
The docs build was failing because it was trying to build the Demo
example from the wrong directory.
2023-01-23 19:33:55 +00:00
Paul Cadman
b00d4b2270
Fix macOS CI build (#1747)
We need to use the homebrew Clang/LLVM installation to build the Juvix
runtime because macOS ships with a version of Clang/LLVM that does not
support the wasi target.

The GitHub action runner agent has the homebrew packaged Clang/LLVM
installed but it is not on the shell PATH.

We were using `brew --prefix llvm@14` to point to the homebrew
Clang/LLVM installation. However this breaks when the runner image is
updated to a new version of llvm.

So we switch to using `brew --prefix llvm` which will resolve to the
latest (and in this case only) version of homebrew Clang/LLVM. This will
be stable when Clang/LLVM is updated to a new version.
2023-01-23 11:43:20 +01:00
Jonathan Cubides
48558dccd0 Bump up version to v0.2.9 2023-01-19 15:44:25 +01:00
Jonathan Cubides
8805a02eff
Use Smoke instead of shelltestrunner (#1710)
This PR adds smoke tests using [Smoke
tool](https://github.com/SamirTalwar/smoke) for all the shell tests we
have. One reason for adopting Smoke instead of the previous tool,
`shelltestrunner`, is that tests are declared cleanly and simply using
Smoke Yaml syntax compared to shelltestrunner's syntax.

To add a new smoke test, create a file with the suffix ".smoke.yaml" in
the `tests/smoke` folder. In such a folder, you can also find examples
of how to test the CLI.
2023-01-10 12:49:56 +01:00
Paul Cadman
2d4be3b109
Pin mdbook to version 0.4.22 in docs build (#1670)
* Pin mdbook to 0.4.22

mdbook homebrew version (used by the github action to install mdbook)
was bumped to 0.4.23
eb69fcddba
which seems to be incompatible with Ubuntu 20.04 glibc

* Temporarily enable docs build on PRs

* Revert "Temporarily enable docs build on PRs"

This reverts commit e2cf41016c.
2022-12-15 16:56:27 +01:00
Paul Cadman
503f5279ba
Run shelltests on macOS build (#1658) 2022-12-12 10:26:13 +01:00
Paul Cadman
f4f56b4875
Restore macOS CI build/test (#1657) 2022-12-08 17:51:07 +01:00
Łukasz Czajka
f5de5faaef
Translation from JuvixAsm to C (#1619) 2022-12-06 11:33:20 +01:00
janmasrovira
2db738a76f
Upgrade stack snapshot to use ghc-9.2.5 (#1621)
* upgrade stack snapshot to use ghc-9.2.5

* use lts-20.2

* Update alpine GHC Dockerfile to 9.2.5

We also build the Juvix runtime before the stack build in the
linux-static-binary workflow file.

* Add some documentation on how to build and deploy the alpine GHC image

* Docker documentation clarification.

Co-authored-by: Paul Cadman <git@paulcadman.dev>
2022-12-02 10:04:56 +01:00
Paul Cadman
3fbf9a3020
Use the same stack version in all CI jobs and remove stack setup step (#1651)
* Remove `stack setup` step as this was only required for macOS

* Use haskell setup action so same version of stack is used in tests and build
2022-11-30 14:58:01 +00:00
Łukasz Czajka
74bfe592f5
Juvix C runtime (#1580) 2022-11-03 09:38:09 +01:00
Paul Cadman
5666545e5a
Add --allow-different-user to workflow stack command (#1492) 2022-08-30 15:35:45 +01:00
Paul Cadman
0e3f76410d
Stack with github actions permissions workaround (#1490)
This error occurs when building with stack:

```
Run stack install --system-ghc --ghc-options='-split-sections -optl-static'
4
Preventing creation of stack root '/github/home/.stack/'. Parent directory '/github/home/' is owned by someone else.
5
Error: Process completed with exit code 1.
```

https://github.com/commercialhaskell/stack/issues/2187
2022-08-30 14:16:59 +01:00
Paul Cadman
a2a911a98a
Add a github action to build a static linux binary (#1488)
This uses a custom docker image build using Dockerfile-ghc-alpine-9.2.4
2022-08-30 12:18:34 +01:00
janmasrovira
963d48857a
Upgrade to ghc-9.2.4 (#1451) 2022-08-15 16:58:26 +02:00
Paul Cadman
afecd94f90
CI: Run build on push to main (#1437) 2022-08-04 18:12:49 +01:00
Paul Cadman
36ec912779
CI checkout repo before cache and use recommended cache strategy (#1435)
See
https://github.com/actions/cache/blob/main/examples.md#linux-or-macos
for recommendation
2022-08-04 16:14:29 +02:00
Paul Cadman
512211da8e
Setup Clang before building docs in CI (#1433)
* Setup Clang before building docs in CI

* Debug CI

* Debug CI

* Debug CI

* Debug CI

* Fix JS name

* Fix copying of webapp resources to output folder
2022-08-04 09:19:03 +01:00
Paul Cadman
98776997db
Add a Web version of TicTacToe (#1427)
* Add a Web version of TicTacToe

The web version demonstrates injecting host functions into the WASM
import table and call exported Juvix functions from JS.

The web version and the CLI version of the TicTacToe game use the same
game logic backend Juvix module.

* Build and publish web apps in documentation

* Add a link to the TicTacToe web app in example documentation

* Update Makefile to match the new format
2022-08-03 16:14:38 +02:00
Jonathan Cubides
6a4b0e36df
Major revisions to Makefile (#1431)
* Major revisions to Makefile

* Remove from the CI the use of make install-shelltest

* Remove comment
2022-08-03 14:44:48 +02:00
Jonathan Cubides
30ae6c76c4 Update some docs (#1391)
* Documment a few language features

* Add an example for foreign example

* Fix pre-commit warnings

* remove what-is-org

* Ignore README.org in docs folder

* Add fixes for revisions
2022-07-19 21:13:35 +02:00
Jonathan Cubides
34c6dd478d
Fix documentation generation (#1387)
* testing

* Add --print-metadata flag

* Minor fix
2022-07-15 17:20:31 +02:00
Jonathan Cubides
f30ddf7820
html-examples (#1381)
* html-examples

* Fix Makefile

* Fix yaml file

* [ci] add main to the path

* install juvix

* Add Collatz and fix cname in the CI

* Add Collatz file name

* Add deleted file and and uncomment cond in the CI
2022-07-15 13:52:16 +02:00
Paul Cadman
753c5d5b0b
Set cname for gh-pages action (#1376)
Our docs are now hosted on a custom domain: docs.juvix.org

https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-add-cname-file-cname
2022-07-14 17:37:28 +01:00
Jonathan Cubides
329bec50a9
Label renaming (#275)
* Update bug_report.md

* Update feature_request.md
2022-07-12 12:34:48 +02:00
Jonathan Cubides
40154fcf94
Add issues and PR templates (#261)
* New issues templates

* Create pull_request_template.md

* Make pre-commit happy
2022-07-08 15:19:07 +02:00
Jonathan Cubides
3b3ea45da9
Rename MiniJuvix to Juvix (#259)
* Renaming MiniJuvix to Juvix

* Make Ormolu happy

* Make Hlint happy

* Remove redundant imports

* Fix shell tests and add target ci to our Makefile

* Make pre-commit happy
2022-07-08 13:59:45 +02:00
Paul Cadman
ed78f2636b
Embed standard library in the minijuvix binary (#210)
* Embed stdlib in minijuvix library

We add a new step at the beginning of the pipeline called Setup that
registers the modules in the standard library with the Files effect. The
standard library is then used when the Scoper queries the Files effect
for modules as it resolves import statements.

Use of the standard library can be disabled using the global
`--no-stdlib` command-line option.

* CI: Checkout submodules recursively for stdlib

* Add a new `--no-stdlib` option to shell check

* Poke CI

* CI: Checkout submodules in the test job
2022-06-30 11:31:08 +02:00
janmasrovira
6eb16c74c1
Add support for built in types (#192)
* match inductive definitions

* progress towards builtins

* more progress towards builtin types

* add more builtins

* add some errors

* add reverse table to builtins

* Squashed commit of the following:

commit 93333de502d8dd546eb8edf697ca7eef972ea105
Author: Paul Cadman <git@paulcadman.dev>
Date:   Mon Jun 27 18:21:30 2022 +0100

    Use builtin names for match and project functions

    Add an implementation of nat for the standalone backend

commit 868d2098ee57b7acbca84512b6e096650eeeb22d
Author: Jan Mas Rovira <janmasrovira@gmail.com>
Date:   Mon Jun 27 18:15:29 2022 +0200

    add builtin information to ClosureInfo

commit 32c78aceb19ee4010d66090a3c4e6025621b5c1f
Author: Paul Cadman <git@paulcadman.dev>
Date:   Mon Jun 27 12:52:10 2022 +0100

    Refactor BuiltinEnum to sum type of each Builtin

commit 55bb72ab12a8fb7d10070c2dee5875482453b7c6
Author: Paul Cadman <git@paulcadman.dev>
Date:   Fri Jun 24 14:44:28 2022 +0100

    Add Builtin information to Mono InfoTable

commit a72368f2e3af20baaf44c5e21fa7e6a469cf1ac5
Author: Paul Cadman <git@paulcadman.dev>
Date:   Fri Jun 24 14:41:51 2022 +0100

    Add Bitraversable to Prelude

commit afa3153d82a9509b0882e7ca99830040fad9ef65
Author: Paul Cadman <git@paulcadman.dev>
Date:   Fri Jun 24 14:41:39 2022 +0100

    Remove unused import

commit ea0b7848fb80970e03a0561be3fb4448486a89a9
Author: Paul Cadman <git@paulcadman.dev>
Date:   Thu Jun 23 13:54:58 2022 +0100

    Use projection functions instead of direct member access

* Avoid shadowing C runtime names in foreign block

* Fix formatting

* Update C names for builtin functions

* Add prim_ prefix to builtin C names

Implement builtins for standalone and libc backends

* Update ormolu action

* ci: run all tests for draft PRs

Co-authored-by: Paul Cadman <git@paulcadman.dev>
2022-06-28 13:31:31 +02:00
janmasrovira
b43c16dadc
Upgrade to ghc-9.2.3 (#178)
* upgrade to ghc-9.2.3

* [ci] build with ghc 9.2.3

* Remove the gcc alises added by LLVM install

The GHC installer (initiated by stack in the test step) requires access
to GCC because it uses the GCC specific `--gc-sections` linker flag.

We remove the gcc -> clang symlink, our tests use the clang binary
directly and so do not require the symlink.

* Run GCC PATH fixup step on macOS only

* Fixes YAML quote marks

* Install GHC via stack setup before installing LLVM

Having both macOS LLVM and stock LLVM on the PATH causes the GHC
installation to fail.

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
Co-authored-by: Paul Cadman <git@paulcadman.dev>
2022-06-20 12:53:31 +02:00
janmasrovira
2cf3f85439
Support implicit arguments (#144)
* work in progress towards implicit arguments

* Wip towards implicit types

* improve arity checker

* Add version of SimpleFungibleToken with implicit arguments

* guess arity of body before checking the lhs of a clause

* add ArityUnknown and fix some tests

* wip: proper errors in arity checker

* fix bugs, improve errors and add tests

* format

* set hlint version to 3.4 in the ci

* update pre-commit version to 3.0.0

* minor changes

* added more revisions

* minor

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
2022-06-13 14:25:22 +02:00
Jonathan Cubides
3b0cde27bb
Add CLI improvements and shell testing (#131)
* Remove input file fields from command opts

* [cli] Make version and help commands

* Fix on reviews

* Fixes for dealing with global options inside subcmds

* Fix minijuvix emacs mode and add some instance to GlobalOpts

* Remove unrelated code

* Propagate globals opts in each cmd parser

* Add initial shell tests

* Add test-shell to makefile and CI

* Fix CI: adding .local/bin to PATH

* Fixing CI

* Installing shelltest just before running it

* Install app for shell testing

* Hide global flags after cmd. Fix shell tests accordingly.

* Fixing CI

* Shell test only run on ubuntu for now
2022-06-09 16:36:07 +02:00
Jonathan Cubides
a4eb2124b2
Generic Errors and refactoring (#123)
* w.i.p adoption of generic error type

* harmonize

* Remove the use of Error effect for internal bugs

* add location information to expression atom list

* Add GenericError instance for PatternAtoms

* Remove Maybe GenericError occurrences

* [ci] fix draft job's condition

* minor changes

* [stack] macos support ghc-opts

* Fix reviewer's comments

* remove accidentally commited file

* refactor to avoid duplication

* fix

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2022-05-26 17:52:08 +02:00
Jonathan Cubides
c7761100af
Add initial documentation (#119) (#120) (#121)
* Add initial docs generation website (#119)

* Add docs generation

* [makefile] add serve-docs target

* Fixed rebase conflicts

* Update pre-commit rev

* Added changelog
2022-05-23 16:56:59 +02:00
Jonathan Cubides
7e309eccdb
Add initial documentation (#119) (#120)
* Add initial docs generation website (#119)

* Add docs generation

* [makefile] add serve-docs target

* Fixed rebase conflicts

* Update pre-commit rev

* Added changelog
2022-05-23 16:20:02 +02:00
Jonathan Cubides
7e20e5083b
Add initial docs generation website (#119)
* Add docs generation

* [makefile] add serve-docs target
2022-05-20 16:16:16 +02:00
Jonathan Cubides
24d741922e
Add pre-commit, new policy for PRs and removal of dev in the CI#118)
* Remove dev. Add valid req.types for PRs. Add Concurrency

* [ci] Add pre-commit check

* [ci] w.i.p fixing when ci should trigger

* [ci] minor fix

* [ci] Fix pre-commit check
2022-05-20 10:45:03 +02:00
Paul Cadman
5ed3ef34c0
[cbackend] run minic tests with clang+wasi-sdk (#105)
* [cbackend] run minic tests with clang+wasi-sdk

* [docs] Add docs for setting up clang+wasi-sdk

* [doc] Updates README usage with clang

* [docs] Fix LLVM URL in README

* [docs] Fix README

* [doc] Update clang setup docs with wasm-ld
2022-05-16 16:17:28 +01:00
Jonathan Cubides
3004d1a404
Stricter stack builds and pedantic mode for CI (#78)
* Make CI even more pedantic

* remove aeson dependency

Co-authored-by: Paul Cadman <pcadman@gmail.com>
Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2022-05-05 15:21:04 +01:00
Paul Cadman
60236e7b58
Add C code generation backend (#68)
* [cbackend] Adds an AST for C

This should cover enough C to implement the microjuvix backend.

* [cbackend] Add C serializer using language-c library

We may decide to write our own serializer for the C AST but this
demonstrates that the C AST is sufficient at least.

* [cbackend] Declarations will always be typed

* [cbackend] Add CPP support to AST

* [cbackend] Rename some names for clarity

* [cbackend] Add translation of InductiveDef to C

* [cbackend] Add CLI for C backend

* [cbackend] Add stdbool.h to file header

* [cbackend] Allow Cpp and Verbatim code inline

* [cbackend] Add a newline after printing C

* [cbackend] Support foreign blocks

* [cbackend] Add support for axioms

* [cbackend] Remove code examples

* [cbackend] wip FunctionDef including Expressions

* [parser] Support esacping '}' inside a foreign block

* [cbackend] Add support for patterns in functions

* [cbackend] Add foreign C support to HelloWorld.mjuvix

* hlint fixes

* More hlint fixes not picked up by pre-commit

* [cbackend] Remove CompileStatement from MonoJuvix

* [cbackend] Add support for compile blocks

* [cbackend] Move compileInfo extraction to MonoJuvixResult

* [minihaskell] Fix compile block support

* [chore] Remove ununsed isBackendSupported function

* [chore] Remove unused imports

* [cbackend] Use a Reader for pattern bindings

* [cbackend] Fix compiler warnings

* [cbackend] Add support for nested patterns

* [cbackend] Use functions to instantiate argument names

* [cbackend] Add non-exhaustive pattern error message

* [cbackend] Adds test for c to WASM compile and execution

* [cbackend] Add links to test dependencies in quickstart

* [cbackend] Add test with inductive types and patterns

* [cbackend] Fix indentation

* [cbackend] Remove ExpressionTyped case

https://github.com/heliaxdev/minijuvix/issues/79

* [lexer] Fix lexing of \ inside a foreign block

* [cbackend] PR review fixes

* [chore] Remove unused import

* [cbackend] Rename CJuvix to MiniC

* [cbackend] Rename MonoJuvixToC to MonoJuvixToMiniC

* [cbackend] Add test for polymorphic function

* [cbackend] Add module for string literals
2022-05-05 14:12:17 +01:00
janmasrovira
13ce663fe1
bump stackage version and remove allow-newer (#76)
* bump stackage version and remove allow-newer

* update ci

* [chore] Invalidate CI cache

Co-authored-by: Paul Cadman <git@paulcadman.dev>
2022-05-04 12:57:42 +02:00
Jonathan Prieto-Cubides
4d918cd1fd [ CI ] New jobs: ormolu and hlint 2022-04-05 19:57:21 +02:00
Jonathan Prieto-Cubides
a038999170 [ CI ] Add hlint check 2022-04-04 18:18:42 +02:00
Jonathan Prieto-Cubides
eaad611bbf [ CI ] Add Haskell Github Action with Stack test and ormolu check 2022-04-04 15:55:15 +02:00
Jan Mas Rovira
7dff4da317 fix compilation errors 2021-12-23 11:19:46 +01:00
Jonathan Prieto-Cubides
c2e94be3fc [ ci ] commenting haskell build for now 2021-12-04 14:42:19 +01:00