Fix dirio tests #247
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: DOCS | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| jobs: | |
| markdown-doctest: | |
| name: "Verify haskell snippets in markdown docs" | |
| env: | |
| GHCVER: 9.8.4 | |
| GHCUP_VERSION: 0.1.50.2 | |
| runs-on: ubuntu-latest | |
| steps: | |
| # This should happen before cache restore. | |
| - name: Remove ~/.ghcup symlink | |
| run: | | |
| rm -f ~/.ghcup | |
| - name: Cache ghcup and ghc (non-Windows) | |
| uses: actions/cache@v4 | |
| if: runner.os != 'Windows' | |
| with: | |
| path: | | |
| ~/.ghcup | |
| key: ${{ runner.os }}-ghcup-${{ env.GHCUP_VERSION }}-${{ env.GHCVER }} | |
| - name: Cache hackage package index (non-Windows) | |
| uses: actions/cache@v4 | |
| if: runner.os != 'Windows' | |
| with: | |
| path: | | |
| ~/.cache/cabal/packages | |
| # Bump the key version to clear the cache | |
| key: cache-cabal-packages | |
| # NOTE: we need the cabal state as well because the executable may depend | |
| # on shared libraries in the cabal store. | |
| - name: Cache markdown-doctest (non-Windows) | |
| uses: actions/cache@v4 | |
| if: runner.os != 'Windows' | |
| with: | |
| path: | | |
| ~/.local/state/cabal | |
| ~/.local/bin | |
| # Bump the key version to clear the cache | |
| key: markdown-doctest-ghc-${{ env.GHCVER }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| # Use a sane PATH, especially to pick the right GHC | |
| - name: Set PATH to add .local and .ghcup | |
| run: echo "$HOME/.local/bin:$HOME/.ghcup/bin:/bin:/usr/bin" > $GITHUB_PATH | |
| - name: Download ghc | |
| run: | | |
| if ! ghc --version 2>/dev/null | grep -q "$GHCVER" | |
| then | |
| curl -sL -o ./ghcup https://downloads.haskell.org/~ghcup/$GHCUP_VERSION/x86_64-linux-ghcup-$GHCUP_VERSION | |
| chmod +x ./ghcup | |
| export GHCUP_INSTALL_BASE_PREFIX=$HOME | |
| ./ghcup install ghc $GHCVER | |
| ./ghcup set ghc $GHCVER | |
| ./ghcup install cabal | |
| fi | |
| # XXX update only if not present | |
| cabal update | |
| - name: Run markdown-doctest | |
| run: | | |
| if [ ! -f $HOME/.local/bin/markdown-doctest ]; then | |
| mkdir -p $HOME/.local/bin | |
| echo "----------------------------------------------------------------" | |
| echo "Build markdown-doctest" | |
| echo "----------------------------------------------------------------" | |
| echo | |
| # IMPORTANT: do not replace $HOME with ~, tilde is not expanded by | |
| # shell in the middle of a command string. | |
| cabal install markdown-doctest --project-file=cabal.project.markdown-doctest --installdir=$HOME/.local/bin --overwrite-policy=always | |
| fi | |
| echo "----------------------------------------------------------------" | |
| echo "Build streamly commit: $(git rev-parse HEAD)" | |
| echo "----------------------------------------------------------------" | |
| echo | |
| cabal build streamly --write-ghc-environment-files=always | |
| echo "----------------------------------------------------------------" | |
| echo "Run markdown-doctest" | |
| echo "----------------------------------------------------------------" | |
| echo | |
| find ./docs ./core/docs -type f -name "*.md" -print0 | while IFS= read -r -d '' file; do | |
| echo "CMD: markdown-doctest $file" && markdown-doctest "$file" || exit 1 | |
| done |