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

315 lines
7.7 KiB
YAML
Raw Normal View History

name: The Juvix compiler CI
'on':
workflow_dispatch:
2023-01-19 17:42:56 +03:00
inputs:
ref:
description: the repository ref to build
required: true
default: main
2022-08-04 20:12:49 +03:00
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
jobs:
pre-commit:
2022-04-05 20:57:21 +03:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
2022-04-05 20:57:21 +03:00
with:
python-version: '3.11'
- uses: pre-commit/action@v3.0.0
2022-11-03 11:38:09 +03:00
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: jidicula/clang-format-action@v4.10.1
2022-11-03 11:38:09 +03:00
with:
clang-format-version: '15'
check-path: runtime/src
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
2022-12-08 19:51:07 +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'
2022-12-08 19:51:07 +03:00
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: '13.0'
cached: '${{ steps.cache-llvm.outputs.cache-hit }}'
2022-12-08 19:51:07 +03:00
- 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
2022-12-08 19:51:07 +03:00
tar xfv wasi-sysroot-15.0.tar.gz
- name: Set WASI_SYSROOT_PATH
run: |
echo "WASI_SYSROOT_PATH=$GITHUB_WORKSPACE/wasi-sysroot" >> $GITHUB_ENV
2022-12-08 19:51:07 +03:00
- name: Install the latest Wasmer version
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: wasmerio/wasmer
tag: latest
binaries-location: bin
cache: true
2022-12-08 19:51:07 +03:00
- name: Install libicu for testing
run: sudo apt install -y libicu66
2022-12-08 19:51:07 +03:00
- name: Make runtime
2022-12-08 19:51:07 +03:00
run: |
cd main
make runtime
- name: Stack setup
uses: freckle/stack-action@v4
with:
working-directory: main
test: false
2022-12-08 19:51:07 +03:00
- name: Test suite
2022-04-05 20:57:21 +03:00
id: test
if: ${{ success() }}
run: |
cd main
make test
2022-12-08 19:51:07 +03:00
2022-12-12 12:26:13 +03:00
- 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
run: |
cd smoke
stack install --stack-root ${{ github.workspace }}/.stack
shell: bash
- name: Install Juvix binary
run: |
cd main
make install
- name: Smoke testing
id: smoke-linux
if: ${{ success() }}
run: |
cd main
make smoke
docs-linux:
needs: build-and-test-linux
if: >-
github.ref == 'refs/heads/main' || github.event_name ==
'workflow_dispatch'
runs-on: ubuntu-20.04
steps:
- name: Checkout our repository
uses: actions/checkout@v3
with:
path: main
submodules: recursive
- name: Install mdbook-pagetoc
uses: baptiste0928/cargo-install@v1
with:
crate: mdbook-pagetoc
- name: Install mdbook-katex
uses: baptiste0928/cargo-install@v1
with:
crate: mdbook-katex
- name: Install mdbook-linkcheck
uses: baptiste0928/cargo-install@v1
with:
crate: mdbook-linkcheck
- name: MDBook setup
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "latest"
- 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 the mdbook
run: |
cd main
make docs
- name: Make runtime
run: |
cd main
make runtime
- name: Stack setup
uses: freckle/stack-action@v4
with:
working-directory: main
test: false
- name: Generate HTML files from examples
run: |
cd main
echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH
make install
make html-examples
make demo-example
# TODO: use new action 'pages deploy'
- name: Deploy HTML to github pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
publish_dir: main/book/html
enable_jekyll: false
cname: docs.juvix.org
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: latest
binaries-location: bin
cache: true
- name: Set homebrew LLVM CC and LIBTOOL vars (macOS)
run: |
echo "CC=$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV
echo "LIBTOOL=$(brew --prefix llvm)/bin/llvm-ar" >> $GITHUB_ENV
- name: Make runtime
run: |
cd main
make CC=$CC LIBTOOL=$LIBTOOL runtime
- name: Stack setup
uses: freckle/stack-action@v4
with:
working-directory: main
test: false
- name: Add homebrew clang to the PATH (macOS)
run: |
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
- name: Test suite (macOS)
if: ${{ success() }}
run: |
cd main
make CC=$CC LIBTOOL=$LIBTOOL test
make CC=$CC LIBTOOL=$LIBTOOL install
- name: Add ~/.local/bin to PATH
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- 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