1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-16 10:56:14 +03:00
juvix/.github/workflows/ci.yml
Jonathan Cubides 2148d174f5
Add VampIR to the CI (#2096)
This PR:

- Makes `vamp-ir` available in the CI (pre-release 0.1.2)
- [Use a setup-wasmer action to install
`wasmer`](https://github.com/marketplace/actions/setup-wasmer)
- Fixes cache option value for `jaxxstorm/action-install-gh-release`'s
usages

Adds support for:

- #2103 


Related: 

- https://github.com/anoma/vamp-ir/issues/90

---------

Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
2023-05-22 19:49:36 +02:00

257 lines
6.3 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-22.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: Add ~/.local/bin to PATH
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Setup Wasmer
uses: wasmerio/setup-wasmer@v2
- name: Install libs
run: sudo apt install -y libncurses5
- name: Install VampIR for testing
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: anoma/vamp-ir
platform: linux
tag: v0.1.2
chmod: 0755
rename-to: vamp-ir
extension-matching: disable
cache: enable
- name: Test VampIR
shell: bash
run: |
vamp-ir --version
- 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: Install Smoke for testing
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: jonaprieto/smoke
platform: linux
tag: v2.3.2
chmod: 0755
rename-to: smoke
extension-matching: disable
cache: enable
- name: Smoke testing
id: smoke-linux
if: ${{ success() }}
run: |
cd main
make smoke-only
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: Setup Wasmer
uses: wasmerio/setup-wasmer@v2
- 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 VampIR for testing
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: anoma/vamp-ir
platform: darwin
tag: v0.1.2
chmod: 0755
rename-to: vamp-ir
extension-matching: disable
cache: enable
- name: Test VampIR
shell: bash
run: |
vamp-ir --version
- 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
cache: enable
- name: Smoke testing (macOS)
id: smoke-macos
if: ${{ success() }}
run: |
cd main
make CC=$CC LIBTOOL=$LIBTOOL smoke