Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recent changes to haddock generation #498

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading