mirror of
https://github.com/anoma/juvix.git
synced 2024-12-17 03:45:00 +03:00
e2f2d0a2f4
This PR resolves a few bugs in the Makefile targets for formatting and type checking Juvix files, which were preventing the capture of type checking errors for our examples and bad formatting for all the Juvix files in the repository. With this PR, our code should now be clean, and we can expect every file to be properly formatted and type checked. Changes made: - [x] Updated `make format-juvix-files` - [x] Updated `make check-format-juvix-files` - [x] Formatted all Juvix files - [x] Comment a fragment in `examples/milestone/Bank/Bank.juvix` In the future, we will drastically simplify the Makefile once we improve the `format` and the `type check` command for example posted here: - #2066 - #2087 Related: - #2063 - #2040 (due to some typechecking errors we're not capturing before) - #2105 - https://github.com/anoma/juvix/issues/2059
238 lines
5.9 KiB
YAML
238 lines
5.9 KiB
YAML
name: Juvix Compiler CI
|
|
"on":
|
|
workflow_dispatch:
|
|
inputs:
|
|
ref:
|
|
description: the repository ref to build
|
|
required: true
|
|
default: main
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
- ready_for_review
|
|
|
|
concurrency:
|
|
group: "${{ github.workflow }}-${{ github.head_ref || github.run_id }}"
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
SKIP: ormolu,format-juvix-files,typecheck-juvix-examples
|
|
|
|
jobs:
|
|
pre-commit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.11"
|
|
- uses: pre-commit/action@v3.0.0
|
|
|
|
ormolu:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: mrkkrp/ormolu-action@v11
|
|
with:
|
|
version: 0.5.2.0
|
|
extra-args: >-
|
|
--ghc-opt -XDerivingStrategies --ghc-opt -XImportQualifiedPost
|
|
--ghc-opt -XMultiParamTypeClasses --ghc-opt -XStandaloneDeriving
|
|
--ghc-opt -XTemplateHaskell --ghc-opt -XUnicodeSyntax
|
|
|
|
build-and-test-linux:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- name: Checkout our repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
path: main
|
|
submodules: true
|
|
|
|
- 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: Set WASI_SYSROOT_PATH
|
|
run: |
|
|
echo "WASI_SYSROOT_PATH=$GITHUB_WORKSPACE/wasi-sysroot" >> $GITHUB_ENV
|
|
|
|
- name: Install the latest Wasmer version
|
|
uses: jaxxstorm/action-install-gh-release@v1.10.0
|
|
with:
|
|
repo: wasmerio/wasmer
|
|
tag: v3.2.1
|
|
binaries-location: bin
|
|
cache: true
|
|
|
|
- name: Install libicu for testing
|
|
run: sudo apt install -y libicu66
|
|
|
|
- name: Make runtime
|
|
run: |
|
|
cd main
|
|
make runtime
|
|
|
|
- name: Stack setup
|
|
id: stack
|
|
uses: freckle/stack-action@v4
|
|
with:
|
|
working-directory: main
|
|
test: false
|
|
|
|
- name: Install and test Juvix
|
|
id: test
|
|
if: ${{ success() }}
|
|
run: |
|
|
cd main
|
|
make install
|
|
make test
|
|
|
|
- name: Typecheck and format Juvix examples
|
|
if: ${{ success() }}
|
|
shell: bash
|
|
run: |
|
|
cd main
|
|
make check-format-juvix-files && make typecheck-juvix-examples
|
|
|
|
- name: Add ~/.local/bin to PATH
|
|
run: |
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
repository: jonaprieto/smoke
|
|
path: smoke
|
|
|
|
- uses: freckle/stack-cache-action@v2
|
|
with:
|
|
working-directory: smoke
|
|
|
|
- name: Install Smoke
|
|
shell: bash
|
|
run: |
|
|
cd smoke
|
|
stack install --stack-root ${{ steps.stack.outputs.stack-root }}
|
|
|
|
- name: Smoke testing
|
|
id: smoke-linux
|
|
if: ${{ success() }}
|
|
run: |
|
|
cd main
|
|
make smoke
|
|
|
|
build-and-test-macos:
|
|
runs-on: macos-12
|
|
steps:
|
|
- name: Checkout our repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
path: main
|
|
submodules: true
|
|
|
|
- name: Install ICU4C
|
|
run: |
|
|
brew install icu4c
|
|
brew link icu4c --force
|
|
|
|
- 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: Set WASI_SYSROOT_PATH
|
|
run: |
|
|
echo "WASI_SYSROOT_PATH=$GITHUB_WORKSPACE/wasi-sysroot" >> $GITHUB_ENV
|
|
|
|
- name: Install the latest Wasmer version
|
|
uses: jaxxstorm/action-install-gh-release@v1.10.0
|
|
with:
|
|
repo: wasmerio/wasmer
|
|
tag: v3.2.1
|
|
binaries-location: bin
|
|
cache: true
|
|
|
|
- name: Set homebrew LLVM CC and LIBTOOL vars (macOS)
|
|
run: |
|
|
echo "CC=$(brew --prefix llvm@15)/bin/clang" >> $GITHUB_ENV
|
|
echo "LIBTOOL=$(brew --prefix llvm@15)/bin/llvm-ar" >> $GITHUB_ENV
|
|
|
|
- name: Make runtime
|
|
run: |
|
|
cd main
|
|
make CC=$CC LIBTOOL=$LIBTOOL runtime
|
|
|
|
- name: Stack setup
|
|
id: stack
|
|
uses: freckle/stack-action@v4
|
|
with:
|
|
working-directory: main
|
|
test: false
|
|
|
|
- name: Add homebrew clang to the PATH (macOS)
|
|
run: |
|
|
echo "$(brew --prefix llvm@15)/bin" >> $GITHUB_PATH
|
|
|
|
- name: Install and test Juvix
|
|
if: ${{ success() }}
|
|
run: |
|
|
cd main
|
|
make CC=$CC LIBTOOL=$LIBTOOL install
|
|
make CC=$CC LIBTOOL=$LIBTOOL test
|
|
|
|
- name: Add ~/.local/bin to PATH
|
|
run: |
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
- name: Typecheck and format Juvix examples
|
|
if: ${{ success() }}
|
|
shell: bash
|
|
run: |
|
|
cd main
|
|
make check-format-juvix-files && make typecheck-juvix-examples
|
|
|
|
- name: Install Smoke
|
|
uses: jaxxstorm/action-install-gh-release@v1.10.0
|
|
with:
|
|
repo: jonaprieto/smoke
|
|
tag: latest
|
|
extension-matching: disable
|
|
rename-to: smoke
|
|
chmod: 0755
|
|
|
|
- name: Smoke testing (macOS)
|
|
id: smoke-macos
|
|
if: ${{ success() }}
|
|
run: |
|
|
cd main
|
|
make CC=$CC LIBTOOL=$LIBTOOL smoke
|