mirror of
https://github.com/anoma/juvix.git
synced 2024-12-01 00:04:58 +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:
parent
2a8585ede0
commit
72f1586d12
221
.github/workflows/ci.yml
vendored
221
.github/workflows/ci.yml
vendored
@ -21,20 +21,19 @@ concurrency:
|
|||||||
group: '${{ github.workflow }}-${{ github.head_ref || github.run_id }}'
|
group: '${{ github.workflow }}-${{ github.head_ref || github.run_id }}'
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
env:
|
env:
|
||||||
STACKFLAGS: '--pedantic --stack-root ${{ github.workspace }}/.stack'
|
SKIP: ormolu
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
ormolu:
|
pre-commit:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: mrkkrp/ormolu-action@v9
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
extra-args: >-
|
python-version: '3.11'
|
||||||
--ghc-opt -XDerivingStrategies --ghc-opt -XImportQualifiedPost
|
- uses: pre-commit/action@v3.0.0
|
||||||
--ghc-opt -XMultiParamTypeClasses --ghc-opt -XStandaloneDeriving
|
|
||||||
--ghc-opt -XTemplateHaskell --ghc-opt -XUnicodeSyntax
|
|
||||||
clang-format:
|
clang-format:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -43,31 +42,18 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
clang-format-version: '15'
|
clang-format-version: '15'
|
||||||
check-path: runtime/src
|
check-path: runtime/src
|
||||||
pre-commit:
|
|
||||||
|
ormolu:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v4
|
- uses: mrkkrp/ormolu-action@v11
|
||||||
with:
|
with:
|
||||||
python-version: '3.9'
|
version: 0.5.2.0
|
||||||
- uses: pre-commit/action@v3.0.0
|
extra-args: >-
|
||||||
with:
|
--ghc-opt -XDerivingStrategies --ghc-opt -XImportQualifiedPost
|
||||||
extra_args: trailing-whitespace --all-files
|
--ghc-opt -XMultiParamTypeClasses --ghc-opt -XStandaloneDeriving
|
||||||
- uses: pre-commit/action@v3.0.0
|
--ghc-opt -XTemplateHaskell --ghc-opt -XUnicodeSyntax
|
||||||
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-and-test-linux:
|
build-and-test-linux:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
@ -77,30 +63,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: main
|
path: main
|
||||||
submodules: true
|
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
|
- name: Cache LLVM and Clang
|
||||||
id: cache-llvm
|
id: cache-llvm
|
||||||
@ -124,12 +86,13 @@ jobs:
|
|||||||
-OL
|
-OL
|
||||||
|
|
||||||
tar xfv wasi-sysroot-15.0.tar.gz
|
tar xfv wasi-sysroot-15.0.tar.gz
|
||||||
|
|
||||||
- name: Set WASI_SYSROOT_PATH
|
- name: Set WASI_SYSROOT_PATH
|
||||||
run: |
|
run: |
|
||||||
echo "WASI_SYSROOT_PATH=$GITHUB_WORKSPACE/wasi-sysroot" >> $GITHUB_ENV
|
echo "WASI_SYSROOT_PATH=$GITHUB_WORKSPACE/wasi-sysroot" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Install the latest Wasmer version
|
- name: Install the latest Wasmer version
|
||||||
uses: jonaprieto/action-install-gh-release@2
|
uses: jaxxstorm/action-install-gh-release@v1.10.0
|
||||||
with:
|
with:
|
||||||
repo: wasmerio/wasmer
|
repo: wasmerio/wasmer
|
||||||
tag: latest
|
tag: latest
|
||||||
@ -139,11 +102,16 @@ jobs:
|
|||||||
- name: Install libicu for testing
|
- name: Install libicu for testing
|
||||||
run: sudo apt install -y libicu66
|
run: sudo apt install -y libicu66
|
||||||
|
|
||||||
- name: Build Project
|
- name: Make runtime
|
||||||
run: |
|
run: |
|
||||||
cd main
|
cd main
|
||||||
stack path --stack-root
|
make runtime
|
||||||
make build
|
|
||||||
|
- name: Stack setup
|
||||||
|
uses: freckle/stack-action@v4
|
||||||
|
with:
|
||||||
|
working-directory: main
|
||||||
|
test: false
|
||||||
|
|
||||||
- name: Test suite
|
- name: Test suite
|
||||||
id: test
|
id: test
|
||||||
@ -161,12 +129,21 @@ jobs:
|
|||||||
repository: jonaprieto/smoke
|
repository: jonaprieto/smoke
|
||||||
path: smoke
|
path: smoke
|
||||||
|
|
||||||
|
- uses: freckle/stack-cache-action@v2
|
||||||
|
with:
|
||||||
|
working-directory: smoke
|
||||||
|
|
||||||
- name: Install Smoke
|
- name: Install Smoke
|
||||||
run: |
|
run: |
|
||||||
cd smoke
|
cd smoke
|
||||||
stack install --stack-root ${{ github.workspace }}/.stack
|
stack install --stack-root ${{ github.workspace }}/.stack
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
- name: Install Juvix binary
|
||||||
|
run: |
|
||||||
|
cd main
|
||||||
|
make install
|
||||||
|
|
||||||
- name: Smoke testing
|
- name: Smoke testing
|
||||||
id: smoke-linux
|
id: smoke-linux
|
||||||
if: ${{ success() }}
|
if: ${{ success() }}
|
||||||
@ -174,19 +151,6 @@ jobs:
|
|||||||
cd main
|
cd main
|
||||||
make smoke
|
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:
|
docs-linux:
|
||||||
needs: build-and-test-linux
|
needs: build-and-test-linux
|
||||||
if: >-
|
if: >-
|
||||||
@ -200,41 +164,25 @@ jobs:
|
|||||||
path: main
|
path: main
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- uses: actions/cache/restore@v3
|
- name: Install mdbook-pagetoc
|
||||||
name: Restore .stack cache
|
uses: baptiste0928/cargo-install@v1
|
||||||
id: stack-cache
|
|
||||||
with:
|
with:
|
||||||
fail-on-cache-miss: true
|
crate: mdbook-pagetoc
|
||||||
path: ${{ github.workspace }}/.stack
|
|
||||||
key: ${{ runner.os }}-stack-
|
|
||||||
|
|
||||||
- uses: actions/cache/restore@v3
|
- name: Install mdbook-katex
|
||||||
name: Restore main/.stack-work cache
|
uses: baptiste0928/cargo-install@v1
|
||||||
id: stack-work-cache
|
|
||||||
with:
|
with:
|
||||||
fail-on-cache-miss: true
|
crate: mdbook-katex
|
||||||
path: main/.stack-work
|
|
||||||
key: ${{ runner.os }}-stack-work-
|
|
||||||
|
|
||||||
- uses: r-lib/actions/setup-pandoc@v2
|
- name: Install mdbook-linkcheck
|
||||||
|
uses: baptiste0928/cargo-install@v1
|
||||||
with:
|
with:
|
||||||
pandoc-version: 2.19.2
|
crate: mdbook-linkcheck
|
||||||
|
|
||||||
- name: MDBook setup
|
- name: MDBook setup
|
||||||
uses: peaceiris/actions-mdbook@v1
|
uses: peaceiris/actions-mdbook@v1
|
||||||
with:
|
with:
|
||||||
mdbook-version: 0.4.22
|
mdbook-version: "latest"
|
||||||
|
|
||||||
- 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
|
- name: Cache LLVM and Clang
|
||||||
id: cache-llvm
|
id: cache-llvm
|
||||||
@ -251,10 +199,21 @@ jobs:
|
|||||||
version: '13.0'
|
version: '13.0'
|
||||||
cached: '${{ steps.cache-llvm.outputs.cache-hit }}'
|
cached: '${{ steps.cache-llvm.outputs.cache-hit }}'
|
||||||
|
|
||||||
- name: Generate Markdown files for each Org file
|
- name: Build the mdbook
|
||||||
run: |
|
run: |
|
||||||
cd main
|
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
|
- name: Generate HTML files from examples
|
||||||
run: |
|
run: |
|
||||||
@ -264,11 +223,12 @@ jobs:
|
|||||||
make html-examples
|
make html-examples
|
||||||
make demo-example
|
make demo-example
|
||||||
|
|
||||||
|
# TODO: use new action 'pages deploy'
|
||||||
- name: Deploy HTML to github pages
|
- name: Deploy HTML to github pages
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
with:
|
||||||
github_token: '${{ secrets.GITHUB_TOKEN }}'
|
github_token: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
publish_dir: main/_docs
|
publish_dir: main/book/html
|
||||||
enable_jekyll: false
|
enable_jekyll: false
|
||||||
cname: docs.juvix.org
|
cname: docs.juvix.org
|
||||||
|
|
||||||
@ -281,39 +241,16 @@ jobs:
|
|||||||
path: main
|
path: main
|
||||||
submodules: true
|
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)
|
- name: Set homebrew LLVM CC and LIBTOOL vars (macOS)
|
||||||
run: |
|
run: |
|
||||||
echo "CC=$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV
|
echo "CC=$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV
|
||||||
echo "LIBTOOL=$(brew --prefix llvm)/bin/llvm-ar" >> $GITHUB_ENV
|
echo "LIBTOOL=$(brew --prefix llvm)/bin/llvm-ar" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Install ICU4C
|
- name: Install ICU4C
|
||||||
run: |
|
run: |
|
||||||
brew install icu4c
|
brew install icu4c
|
||||||
brew link icu4c --force
|
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
|
- name: Download and extract wasi-sysroot
|
||||||
run: >
|
run: >
|
||||||
@ -322,11 +259,13 @@ jobs:
|
|||||||
-OL
|
-OL
|
||||||
|
|
||||||
tar xfv wasi-sysroot-15.0.tar.gz
|
tar xfv wasi-sysroot-15.0.tar.gz
|
||||||
|
|
||||||
- name: Set WASI_SYSROOT_PATH
|
- name: Set WASI_SYSROOT_PATH
|
||||||
run: |
|
run: |
|
||||||
echo "WASI_SYSROOT_PATH=$GITHUB_WORKSPACE/wasi-sysroot" >> $GITHUB_ENV
|
echo "WASI_SYSROOT_PATH=$GITHUB_WORKSPACE/wasi-sysroot" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Install the latest Wasmer version
|
- name: Install the latest Wasmer version
|
||||||
uses: jonaprieto/action-install-gh-release@2
|
uses: jaxxstorm/action-install-gh-release@v1.10.0
|
||||||
with:
|
with:
|
||||||
repo: wasmerio/wasmer
|
repo: wasmerio/wasmer
|
||||||
tag: latest
|
tag: latest
|
||||||
@ -337,39 +276,35 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "CC=$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV
|
echo "CC=$(brew --prefix llvm)/bin/clang" >> $GITHUB_ENV
|
||||||
echo "LIBTOOL=$(brew --prefix llvm)/bin/llvm-ar" >> $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)
|
- name: Add homebrew clang to the PATH (macOS)
|
||||||
run: |
|
run: |
|
||||||
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
|
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)
|
- name: Test suite (macOS)
|
||||||
if: ${{ success() }}
|
if: ${{ success() }}
|
||||||
run: |
|
run: |
|
||||||
cd main
|
cd main
|
||||||
make CC=$CC LIBTOOL=$LIBTOOL test
|
make CC=$CC LIBTOOL=$LIBTOOL test
|
||||||
|
make CC=$CC LIBTOOL=$LIBTOOL install
|
||||||
- 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 }}'
|
|
||||||
|
|
||||||
- name: Add ~/.local/bin to PATH
|
- name: Add ~/.local/bin to PATH
|
||||||
run: |
|
run: |
|
||||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Install Smoke
|
- name: Install Smoke
|
||||||
uses: jonaprieto/action-install-gh-release@2
|
uses: jaxxstorm/action-install-gh-release@v1.10.0
|
||||||
with:
|
with:
|
||||||
repo: jonaprieto/smoke
|
repo: jonaprieto/smoke
|
||||||
tag: latest
|
tag: latest
|
||||||
|
8
Makefile
8
Makefile
@ -41,9 +41,13 @@ all: install
|
|||||||
clean: clean-runtime
|
clean: clean-runtime
|
||||||
@stack clean --full
|
@stack clean --full
|
||||||
@rm -rf .hie
|
@rm -rf .hie
|
||||||
@rm -rf _docs
|
@rm -rf book
|
||||||
@rm -rf docs/md
|
@rm -rf docs/md
|
||||||
|
|
||||||
|
.PHONY: clean-hard
|
||||||
|
clean-hard: clean
|
||||||
|
@git clean -fdx
|
||||||
|
|
||||||
.PHONY: clean-runtime
|
.PHONY: clean-runtime
|
||||||
clean-runtime: clean-juvix-build
|
clean-runtime: clean-juvix-build
|
||||||
@cd runtime && ${MAKE} clean
|
@cd runtime && ${MAKE} clean
|
||||||
@ -233,7 +237,7 @@ fast-install: runtime submodules
|
|||||||
# -- Testing
|
# -- Testing
|
||||||
|
|
||||||
.PHONY : test
|
.PHONY : test
|
||||||
test: build
|
test: build runtime submodules
|
||||||
@stack test ${STACKFLAGS} ${STACKTESTFLAGS}
|
@stack test ${STACKFLAGS} ${STACKTESTFLAGS}
|
||||||
|
|
||||||
.PHONY : fast-test
|
.PHONY : fast-test
|
||||||
|
Loading…
Reference in New Issue
Block a user