Skip to content

Commit f39e860

Browse files
Cache markdown-doctest and packdiff executables
1 parent b4eb9d4 commit f39e860

2 files changed

Lines changed: 30 additions & 9 deletions

File tree

.github/workflows/markdown-doctest.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,17 @@ jobs:
3737
# Bump the key version to clear the cache
3838
key: cache-cabal-packages
3939

40-
- name: Cache cabal build dependencies (non-Windows)
40+
# NOTE: we need the cabal state as well because the executable may depend
41+
# on shared libraries in the cabal store.
42+
- name: Cache markdown-doctest (non-Windows)
4143
uses: actions/cache@v4
4244
if: runner.os != 'Windows'
4345
with:
4446
path: |
4547
~/.local/state/cabal
48+
~/.local/bin
4649
# Bump the key version to clear the cache
47-
key: markdown-doctest-deps
50+
key: markdown-doctest-ghc-${{ env.GHCVER }}
4851

4952
- uses: actions/checkout@v4
5053
with:
@@ -65,9 +68,16 @@ jobs:
6568
- name: Create env files for ghci
6669
run: cabal build streamly --write-ghc-environment-files=always
6770

71+
- name: Add ~/.local/bin to PATH
72+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
73+
6874
- name: Run markdown-doctest
6975
run: |
7076
echo "Commit: $(git rev-parse HEAD)"
71-
cabal install markdown-doctest --project-file=cabal.project.markdown-doctest --installdir=./ --overwrite-policy=always
72-
find ./docs -type f -name "*.md" -print0 | while IFS= read -r -d '' file; do echo "CMD: ./markdown-doctest $file" && ./markdown-doctest "$file" || exit 1; done
73-
find ./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
77+
if [ ! -f ~/.local/bin/markdown-doctest ]; then
78+
mkdir -p ~/.local/bin
79+
cabal install markdown-doctest --project-file=cabal.project.markdown-doctest --installdir=~/.local/bin --overwrite-policy=always
80+
fi
81+
find ./docs ./core/docs -type f -name "*.md" -print0 | while IFS= read -r -d '' file; do
82+
echo "CMD: markdown-doctest $file" && markdown-doctest "$file" || exit 1
83+
done

.github/workflows/packdiff.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ jobs:
3737
# Bump the key version to clear the cache
3838
key: cache-cabal-packages
3939

40-
- name: Cache cabal build dependencies (non-Windows)
40+
- name: Cache packdiff (non-Windows)
4141
uses: actions/cache@v4
4242
if: runner.os != 'Windows'
4343
with:
4444
path: |
45+
~/.local/bin
4546
~/.local/state/cabal
4647
# Bump the key version to clear the cache
47-
key: packdiff-deps
48+
key: packdiff-ghc-${{ env.GHCVER }}
4849

4950
- name: Checkout the current branch
5051
uses: actions/checkout@v4
@@ -63,8 +64,18 @@ jobs:
6364
# XXX update only if not present
6465
cabal update
6566
67+
- name: Add ~/.local/bin to PATH
68+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
69+
70+
- name: Install packdiff
71+
run: |
72+
if [ ! -f ~/.local/bin/packdiff ]; then
73+
mkdir -p ~/.local/bin
74+
cabal install packdiff --project-file=cabal.project.packdiff --installdir=~/.local/bin --overwrite-policy=always
75+
fi
76+
6677
- name: API diff for streamly-core
67-
run: cabal run packdiff --project-file=cabal.project.packdiff -- diff streamly-core $(git rev-parse origin/master) streamly-core $(git rev-parse HEAD)
78+
run: packdiff diff streamly-core $(git rev-parse origin/master) streamly-core $(git rev-parse HEAD)
6879

6980
- name: API diff for streamly
70-
run: cabal run packdiff --project-file=cabal.project.packdiff -- diff streamly $(git rev-parse origin/master) streamly $(git rev-parse HEAD)
81+
run: packdiff diff streamly $(git rev-parse origin/master) streamly $(git rev-parse HEAD)

0 commit comments

Comments
 (0)