1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-17 03:45:00 +03:00
juvix/.github/workflows/ci.yml

300 lines
8.5 KiB
YAML
Raw Normal View History

name: The Juvix compiler CI
on:
workflow_dispatch:
2022-08-04 20:12:49 +03:00
push:
branches:
- main
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- ready_for_review
- review_requested
- closed
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
STACKFLAGS: --pedantic
jobs:
2022-04-05 20:57:21 +03:00
ormolu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
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 14:31:31 +03:00
- uses: mrkkrp/ormolu-action@v6
2022-04-05 20:57:21 +03:00
with:
extra-args: >-
--ghc-opt -XDerivingStrategies
--ghc-opt -XImportQualifiedPost
--ghc-opt -XMultiParamTypeClasses
--ghc-opt -XStandaloneDeriving
--ghc-opt -XTemplateHaskell
--ghc-opt -XUnicodeSyntax
2022-11-03 11:38:09 +03:00
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: jidicula/clang-format-action@v4.9.0
with:
clang-format-version: '15'
check-path: 'runtime/src'
2022-04-05 20:57:21 +03:00
hlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Set up HLint'
uses: rwe/actions-hlint-setup@v1
with:
version: '3.4'
2022-04-05 20:57:21 +03:00
- name: 'Run HLint'
uses: rwe/actions-hlint-run@v2.0.1
with:
path: '["src/", "app/", "test/"]'
fail-on: warning
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v3.0.0
with:
extra_args:
trailing-whitespace --all-files
- uses: pre-commit/action@v3.0.0
with:
extra_args:
end-of-file-fixer --all-files
- uses: pre-commit/action@v3.0.0
with:
extra_args:
check-yaml --all-files
- uses: pre-commit/action@v3.0.0
with:
extra_args:
check-added-large-files --all-files
- uses: pre-commit/action@v3.0.0
with:
extra_args:
check-case-conflict --all-files
- uses: pre-commit/action@v3.0.0
with:
extra_args:
mixed-line-ending --all-files
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
2022-11-03 11:38:09 +03:00
os: [ubuntu-latest]
2022-08-15 17:58:26 +03:00
ghc: ["9.2.4"]
steps:
- name: Checkout our repository
uses: actions/checkout@v2
with:
path: main
submodules: true
2022-04-05 20:57:21 +03:00
- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.ghc }}-stack-global-${{ hashFiles('main/stack.yaml') }}-${{ hashFiles('main/package.yaml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-stack-global-
- uses: actions/cache@v3
name: Cache .stack-work
with:
path: main/.stack-work
key: ${{ runner.os }}-${{ matrix.ghc }}-stack-work-${{ hashFiles('main/stack.yaml') }}-${{ hashFiles('main/package.yaml') }}-${{ hashFiles('main/**/*.hs') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-stack-work-
- uses: haskell/actions/setup@v1
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: 'latest'
2022-11-03 11:38:09 +03:00
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
with:
path: |
C:/Program Files/LLVM
./llvm
key: ${{ runner.os }}-llvm-13
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "13.0"
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Build Project
run: |
cd main
make build
2022-04-05 20:57:21 +03:00
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
2022-11-03 11:38:09 +03:00
os: [ubuntu-latest]
2022-08-15 17:58:26 +03:00
ghc: ["9.2.4"]
steps:
- name: Checkout the main repository
uses: actions/checkout@v2
with:
path: main
submodules: recursive
- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.ghc }}-stack-global-${{ hashFiles('main/stack.yaml') }}-${{ hashFiles('main/package.yaml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-stack-global-
- uses: actions/cache@v3
name: Cache .stack-work
with:
path: main/.stack-work
key: ${{ runner.os }}-${{ matrix.ghc }}-stack-work-${{ hashFiles('main/stack.yaml') }}-${{ hashFiles('main/package.yaml') }}-${{ hashFiles('main/**/*.hs') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-stack-work-
- name: Setup Stack GHC
run : |
cd main
stack setup
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
with:
path: |
C:/Program Files/LLVM
./llvm
key: ${{ runner.os }}-llvm-13
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "13.0"
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Download and extract wasi-sysroot
run: |
curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/wasi-sysroot-15.0.tar.gz -OL
tar xfv wasi-sysroot-15.0.tar.gz
- name: Download and extract libclang_rt.builtins-wasm32-wasi
run: |
curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-15/libclang_rt.builtins-wasm32-wasi-15.0.tar.gz -OL
tar xfv libclang_rt.builtins-wasm32-wasi-15.0.tar.gz
working-directory: ${{ env.LLVM_PATH }}
- name: Set WASI_SYSROOT_PATH
run: |
echo "WASI_SYSROOT_PATH=$GITHUB_WORKSPACE/wasi-sysroot" >> $GITHUB_ENV
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 16:12:17 +03:00
- name: Setup Wasmer
uses: wasmerio/setup-wasmer@v1
- name: Test suite
2022-04-05 20:57:21 +03:00
id: test
run: |
cd main
make test
- name : Shell tests
id: shell-tests
if: matrix.os == 'ubuntu-latest'
run : |
cd main
echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH
make test-shell
docs:
needs: build
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
strategy:
matrix:
os: [ubuntu-latest]
2022-08-15 17:58:26 +03:00
ghc: ["9.2.4"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout our repository
uses: actions/checkout@v2
with:
path: main
submodules: recursive
- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.ghc }}-stack-global-${{ hashFiles('main/stack.yaml') }}-${{ hashFiles('main/package.yaml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-stack-global-
- uses: actions/cache@v3
name: Cache .stack-work
with:
path: main/.stack-work
key: ${{ runner.os }}-${{ matrix.ghc }}-stack-work-${{ hashFiles('main/stack.yaml') }}-${{ hashFiles('main/package.yaml') }}-${{ hashFiles('main/**/*.hs') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-stack-work-
- uses: r-lib/actions/setup-pandoc@v1
with:
pandoc-version: '2.13'
- name: MDBook setup
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'
- name: Setup Stack GHC
run : |
cd main
stack setup
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
with:
path: |
C:/Program Files/LLVM
./llvm
key: ${{ runner.os }}-llvm-13
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "13.0"
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Generate Markdown files for each Org file
run: |
cd main
make markdown-docs
- name : Generate HTML and Web App files from milestone examples
run : |
cd main
echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH
make install
make html-examples
make webapp-examples
- name: Deploy HTML to github pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: main/_docs
enable_jekyll: false
cname: docs.juvix.org