Skip to content

Commit

Permalink
Merge pull request #498 from IntersectMBO/lehins/fix-recent-changes-t…
Browse files Browse the repository at this point in the history
…o-haddock-generation

Fix recent changes to haddock generation
  • Loading branch information
lehins authored Sep 12, 2024
2 parents 4fc58ed + 5790799 commit e86a25c
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 47 deletions.
113 changes: 69 additions & 44 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Github Pages
name: Haddocks to GitHub Pages

on:
push:
Expand All @@ -12,47 +12,72 @@ jobs:
contents: write

steps:
- uses: actions/checkout@v3
- name: Install nix
uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
experimental-features = nix-command flakes
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=
substituters = https://cache.iog.io https://cache.nixos.org/ https://cache.zw3rk.com
- name: Build projects and haddocks
run: nix develop --command bash -c "cabal update && cabal build --enable-documentation all && ./scripts/haddocks.sh"
- name: Add files
run: |
git config --local user.name ${{ github.actor }}
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
# Start a new version of the gh-pages branch
git for-each-ref refs/heads/gh-pages --format='%(refname:short)' |
while read -r REFNAME; do
git branch -D "$REFNAME"
done
git checkout -b gh-pages
git rm -rfq .
git commit -qm "Remove all existing files"
echo "cardano-base.cardano.intersectmbo.org" >CNAME
touch .nojekyll
git add CNAME .nojekyll
git commit -qm "Add CNAME and .nojekyll"
# Add Haddocks
git add -A --force ./haddocks
git mv ./haddocks/* .
git commit -qm "Updated from ${GITHUB_SHA} via ${GITHUB_EVENT_NAME}"
- name: Push to gh-pages
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
force: true
directory: .
- uses: actions/checkout@v4

- name: Install Haskell
uses: input-output-hk/setup-haskell@v1
id: setup-haskell
with:
ghc-version: "9.2.8"
cabal-version: latest

- name: Install system dependencies
uses: input-output-hk/actions/base@latest
with:
use-sodium-vrf: false # default is true

- name: Configure to use libsodium
run: |
cat >> cabal.project <<EOF
package cardano-crypto-praos
flags: -external-libsodium-vrf
EOF
- name: Cabal update
run: cabal update

- name: Build haddocks
run: scripts/haddocks.sh haddocks all

- name: Add files
run: |
git config --local user.name ${{ github.actor }}
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
# Start a new version of the gh-pages branch
git for-each-ref refs/heads/gh-pages --format='%(refname:short)' |
while read -r REFNAME; do
git branch -D "$REFNAME"
done
git checkout -b gh-pages
git rm -rfq .
git commit -qm "Remove all existing files"
echo "cardano-base.cardano.intersectmbo.org" >CNAME
touch .nojekyll
git add CNAME .nojekyll
git commit -qm "Add CNAME and .nojekyll"
# Preserve benchmark results, if any
git ls-remote origin --heads gh-pages |
while read -r _SHA REFNAME; do
git fetch origin "$REFNAME"
if git diff --name-only FETCH_HEAD -- dev | grep -q .; then
git checkout FETCH_HEAD dev
git commit -qC "$(git log -1 --format=%H FETCH_HEAD dev)"
fi
done
# Add Haddocks
git add -A --force ./haddocks
git mv ./haddocks/* .
git commit -qm "Updated from ${GITHUB_SHA} via ${GITHUB_EVENT_NAME}"
- name: Push to gh-pages
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
force: true
directory: .
3 changes: 0 additions & 3 deletions scripts/haddocks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ CABAL_OPTS=(

# Generate `doc-index.json` and `doc-index.html` per package, to assemble them later at the top level.
HADDOCK_OPTS=(
--haddock-executables
--haddock-tests
--haddock-benchmarks
--haddock-html
--haddock-hyperlink-source
--haddock-option "--use-unicode"
Expand Down

0 comments on commit e86a25c

Please sign in to comment.