1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-17 03:45:00 +03:00
juvix/.github/workflows/ci.yml
Jonathan Cubides 085d301e64
Fix: broken links of Example programs (#2003)
This PR fixes the broken links that refer to Juvix Examples in the
documentation. Ideally, this wouldn't occur since we utilize a link
checker, but this tool only works well for relative links, which was not
the case for the links of the examples. Additionally, I slightly
modified the CI workflow by generating the HTML for the examples first,
followed by the entire book.

- Closes  #2001
- Check the output using this: https://jonaprieto.github.io/juvix/
2023-04-14 11:16:05 +02:00

338 lines
8.5 KiB
YAML

name: The 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: latest
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() }}
continue-on-error: true
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
docs-linux:
needs: build-and-test-linux
runs-on: ubuntu-20.04
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
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: Make runtime
run: |
cd main
make runtime
- name: Stack setup
id: stack
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
- name: Build the mdbook
run: |
cd main
make docs
- name: Setup Pages
uses: actions/configure-pages@v3
if: >-
github.ref == 'refs/heads/main' || github.event_name ==
'workflow_dispatch'
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
if: >-
github.ref == 'refs/heads/main' || github.event_name ==
'workflow_dispatch'
with:
path: main/book/html
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v1
id: deployment
if: >-
github.ref == 'refs/heads/main' || github.event_name ==
'workflow_dispatch'
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@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() }}
run: |
cd main
make -s check-format-juvix-files
make -s 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