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

300 lines
8.5 KiB
YAML

name: The Juvix compiler CI
on:
workflow_dispatch:
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:
ormolu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: mrkkrp/ormolu-action@v6
with:
extra-args: >-
--ghc-opt -XDerivingStrategies
--ghc-opt -XImportQualifiedPost
--ghc-opt -XMultiParamTypeClasses
--ghc-opt -XStandaloneDeriving
--ghc-opt -XTemplateHaskell
--ghc-opt -XUnicodeSyntax
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'
hlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Set up HLint'
uses: rwe/actions-hlint-setup@v1
with:
version: '3.4'
- 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:
os: [ubuntu-latest]
ghc: ["9.2.4"]
steps:
- name: Checkout our repository
uses: actions/checkout@v2
with:
path: main
submodules: true
- 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'
- 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
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
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
- name: Setup Wasmer
uses: wasmerio/setup-wasmer@v1
- name: Test suite
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]
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