Update ci config #217
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 }} | |
| - 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 | |
| fi | |
| # XXX update only if not present | |
| cabal update | |
| - name: Create env files for ghci | |
| run: cabal build streamly --write-ghc-environment-files=always | |
| - name: Add ~/.local/bin to PATH | |
| run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Run markdown-doctest | |
| run: | | |
| echo "Commit: $(git rev-parse HEAD)" | |
| if [ ! -f $HOME/.local/bin/markdown-doctest ]; then | |
| mkdir -p $HOME/.local/bin | |
| cabal install markdown-doctest --project-file=cabal.project.markdown-doctest --installdir=$HOME/.local/bin --overwrite-policy=always | |
| fi | |
| 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 |