Skip to content

Commit

Permalink
CI Haskell maintenance (#1797)
Browse files Browse the repository at this point in the history
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:
jaxxstorm/action-install-gh-release#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`.
  - haskell-actions/run-ormolu#26),
  • Loading branch information
jonaprieto authored Mar 21, 2023
1 parent 2a8585e commit 72f1586
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 145 deletions.
221 changes: 78 additions & 143 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
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
- uses: mrkkrp/ormolu-action@v11
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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -161,32 +129,28 @@ 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() }}
run: |
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: >-
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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

Expand All @@ -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: >
Expand All @@ -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
Expand All @@ -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: Test suite (macOS)
if: ${{ success() }}
- name: Make runtime
run: |
cd main
make CC=$CC LIBTOOL=$LIBTOOL test
make CC=$CC LIBTOOL=$LIBTOOL runtime
- name: Save stack cache
uses: actions/cache/save@v3
if: always()
- name: Stack setup
uses: freckle/stack-action@v4
with:
path: ${{ github.workspace }}/.stack
key: '${{ steps.stack-cache.outputs.cache-primary-key }}'
working-directory: main
test: false

- 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: 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: jonaprieto/action-install-gh-release@2
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: jonaprieto/smoke
tag: latest
Expand Down
Loading

0 comments on commit 72f1586

Please sign in to comment.