1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-30 14:13:27 +03:00

CI Haskell maintenance (#1797)

This PR does CI maintenance consisting of the following:

- Use https://github.com/freckle/stack-action to build and test the
Haskell codebase
- Update Gh-release action:
https://github.com/jaxxstorm/action-install-gh-release/pull/39 is merged
into the main branch, so we return to the original GitHub action.
- Simplifies pre-commit action. Use the `SKIP` environmental variable to
avoid running ormolu in the CI.
- The ormolu Github action now supports version input since v11. Fixed
to use `Ormolu v0.5.2`.
  - https://github.com/mrkkrp/ormolu-action/issues/26),
This commit is contained in:
Jonathan Cubides 2023-03-21 16:45:21 +01:00 committed by GitHub
parent 2a8585ede0
commit 72f1586d12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 84 additions and 145 deletions

View File

@ -21,20 +21,19 @@ concurrency:
group: '${{ github.workflow }}-${{ github.head_ref || github.run_id }}'
cancel-in-progress: true
env:
STACKFLAGS: '--pedantic --stack-root ${{ github.workspace }}/.stack'
SKIP: ormolu
jobs:
ormolu:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mrkkrp/ormolu-action@v9
- uses: actions/setup-python@v4
with:
extra-args: >-
--ghc-opt -XDerivingStrategies --ghc-opt -XImportQualifiedPost
--ghc-opt -XMultiParamTypeClasses --ghc-opt -XStandaloneDeriving
--ghc-opt -XTemplateHaskell --ghc-opt -XUnicodeSyntax
python-version: '3.11'
- uses: pre-commit/action@v3.0.0
clang-format:
runs-on: ubuntu-latest
steps:
@ -43,31 +42,18 @@ jobs:
with:
clang-format-version: '15'
check-path: runtime/src
pre-commit:
ormolu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: mrkkrp/ormolu-action@v11
with:
python-version: '3.9'
- 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
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
@ -77,30 +63,6 @@ jobs:
with:
path: main
submodules: true
- uses: actions/cache/restore@v3
id: stack-cache
name: Restore .stack cache
with:
path: ${{ github.workspace }}/.stack
key: ${{ runner.os }}-stack-
- uses: actions/cache/restore@v3
id: stack-work-cache
name: Restore main/.stack-work cache
with:
path: main/.stack-work
key: ${{ runner.os }}-stack-work-
- name: Workaround runner image issue
# https://github.com/actions/runner-images/issues/7061
run: sudo chown -R $USER /usr/local/.ghcup
- uses: haskell/actions/setup@v2
name: Setup Haskell
with:
ghc-version: 9.2.6
enable-stack: true
stack-version: latest
- name: Cache LLVM and Clang
id: cache-llvm
@ -124,12 +86,13 @@ jobs:
-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: jonaprieto/action-install-gh-release@2
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: wasmerio/wasmer
tag: latest
@ -139,11 +102,16 @@ jobs:
- name: Install libicu for testing
run: sudo apt install -y libicu66
- name: Build Project
- name: Make runtime
run: |
cd main
stack path --stack-root
make build
make runtime
- name: Stack setup
uses: freckle/stack-action@v4
with:
working-directory: main
test: false
- name: Test suite
id: test
@ -161,12 +129,21 @@ jobs:
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() }}
@ -174,19 +151,6 @@ jobs:
cd main
make smoke
- name: Save cache .stack
uses: actions/cache/save@v3
if: always()
with:
path: ${{ github.workspace }}/.stack
key: '${{ steps.stack-cache.outputs.cache-primary-key }}'
- name: Save cache main/.stack-work if the job was successful
uses: actions/cache/save@v3
with:
path: main/.stack-work
key: '${{ steps.stack-work-cache.outputs.cache-primary-key }}'
docs-linux:
needs: build-and-test-linux
if: >-
@ -200,41 +164,25 @@ jobs:
path: main
submodules: recursive
- uses: actions/cache/restore@v3
name: Restore .stack cache
id: stack-cache
- name: Install mdbook-pagetoc
uses: baptiste0928/cargo-install@v1
with:
fail-on-cache-miss: true
path: ${{ github.workspace }}/.stack
key: ${{ runner.os }}-stack-
crate: mdbook-pagetoc
- uses: actions/cache/restore@v3
name: Restore main/.stack-work cache
id: stack-work-cache
- name: Install mdbook-katex
uses: baptiste0928/cargo-install@v1
with:
fail-on-cache-miss: true
path: main/.stack-work
key: ${{ runner.os }}-stack-work-
crate: mdbook-katex
- uses: r-lib/actions/setup-pandoc@v2
- name: Install mdbook-linkcheck
uses: baptiste0928/cargo-install@v1
with:
pandoc-version: 2.19.2
crate: mdbook-linkcheck
- name: MDBook setup
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 0.4.22
- name: Workaround runner image issue
# https://github.com/actions/runner-images/issues/7061
run: sudo chown -R $USER /usr/local/.ghcup
- uses: haskell/actions/setup@v2
name: Setup Haskell
with:
ghc-version: 9.2.6
enable-stack: true
stack-version: latest
mdbook-version: "latest"
- name: Cache LLVM and Clang
id: cache-llvm
@ -251,10 +199,21 @@ jobs:
version: '13.0'
cached: '${{ steps.cache-llvm.outputs.cache-hit }}'
- name: Generate Markdown files for each Org file
- name: Build the mdbook
run: |
cd main
make markdown-docs
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: |
@ -264,11 +223,12 @@ jobs:
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/_docs
publish_dir: main/book/html
enable_jekyll: false
cname: docs.juvix.org
@ -281,39 +241,16 @@ jobs:
path: main
submodules: true
- uses: actions/cache/restore@v3
id: stack-cache
name: Restore .stack cache
with:
path: ${{ github.workspace }}/.stack
key: ${{ runner.os }}-stack-
- uses: actions/cache/restore@v3
name: Restore main/.stack-work cache
id: stack-work-cache
with:
path: main/.stack-work
key: ${{ runner.os }}-stack-work-
- uses: haskell/actions/setup@v2
name: Setup Haskell
with:
ghc-version: 9.2.6
enable-stack: true
stack-version: latest
- 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: Install ICU4C
run: |
brew install icu4c
brew link icu4c --force
- name: Build Project (macOS)
run: |
cd main
stack path --stack-root
make CC=$CC LIBTOOL=$LIBTOOL build
- name: Download and extract wasi-sysroot
run: >
@ -322,11 +259,13 @@ jobs:
-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: jonaprieto/action-install-gh-release@2
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: wasmerio/wasmer
tag: latest
@ -337,39 +276,35 @@ jobs:
run: |
echo "CC=$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV
echo "LIBTOOL=$(brew --prefix llvm)/bin/llvm-ar" >> $GITHUB_ENV
- name: stack setup (macOS)
run: |
cd main
stack setup
- name: Add homebrew clang to the PATH (macOS)
run: |
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
- 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: Test suite (macOS)
if: ${{ success() }}
run: |
cd main
make CC=$CC LIBTOOL=$LIBTOOL test
- name: Save stack cache
uses: actions/cache/save@v3
if: always()
with:
path: ${{ github.workspace }}/.stack
key: '${{ steps.stack-cache.outputs.cache-primary-key }}'
- name: Save stack-work cache
uses: actions/cache/save@v3
if: always()
with:
path: main/.stack-work
key: '${{ steps.stack-work-cache.outputs.cache-primary-key }}'
make CC=$CC LIBTOOL=$LIBTOOL install
- name: Add ~/.local/bin to PATH
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install Smoke
uses: jonaprieto/action-install-gh-release@2
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: jonaprieto/smoke
tag: latest

View File

@ -41,9 +41,13 @@ all: install
clean: clean-runtime
@stack clean --full
@rm -rf .hie
@rm -rf _docs
@rm -rf book
@rm -rf docs/md
.PHONY: clean-hard
clean-hard: clean
@git clean -fdx
.PHONY: clean-runtime
clean-runtime: clean-juvix-build
@cd runtime && ${MAKE} clean
@ -233,7 +237,7 @@ fast-install: runtime submodules
# -- Testing
.PHONY : test
test: build
test: build runtime submodules
@stack test ${STACKFLAGS} ${STACKTESTFLAGS}
.PHONY : fast-test