Skip to content

Re-apply PR # 46

Re-apply PR # 46 #230

Workflow file for this run

name: "Haddock documentation"
on:
push:
jobs:
haddocks:
name: "Haddocks"
environment: cabal-cache
runs-on: ${{ matrix.os }}
env:
# Modify this value to "invalidate" the cabal cache.
CABAL_CACHE_VERSION: "2022-12-30"
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
ghc: ["9.2.5"]
cabal: ["3.8.1.0"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Install Haskell
uses: input-output-hk/setup-haskell@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Update Hackage index
run: cabal update
- name: Checkout ouroboros-network repository
uses: actions/checkout@v2
- name: Build dependencies
run: |
cabal configure --enable-tests
cabal build all --dry-run
- name: Dry run
run: |
mkdir -p ./haddocks
DRY_RUN=1 ./scripts/haddocs.sh ./haddocks true
# For users who fork cardano-node and want to define a writable cache, then can set up their own
# S3 bucket then define in their forked repository settings the following secrets:
#
# AWS_ACCESS_KEY_ID
# AWS_SECRET_ACCESS_KEY
# BINARY_CACHE_URI
# BINARY_CACHE_REGION
- name: Cabal cache over S3
uses: action-works/cabal-cache-s3@v1
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
with:
region: ${{ secrets.BINARY_CACHE_REGION }}
dist-dir: dist-newstyle
store-path: ${{ steps.setup-haskell.outputs.cabal-store }}
threads: 16
archive-uri: ${{ secrets.BINARY_CACHE_URI }}/${{ env.CABAL_CACHE_VERSION }}/${{ runner.os }}
skip: "${{ secrets.BINARY_CACHE_URI == '' }}"
# It's important to ensure that people who fork this repository can not only successfully build in
# CI by default, but also have meaning cabal store caching.
#
# Because syncing with S3 requires credentials, we cannot rely on S3 for this. For this reason a
# https fallback is used. The https server mirrors the content of the S3 bucket. The https cabal
# store archive is read-only for security reasons.
#
# Users who fork this repository who want to have a writable cabal store archive are encouraged
# to set up their own S3 bucket.
- name: Cabal cache over HTTPS
uses: action-works/cabal-cache-s3@v1
with:
dist-dir: dist-newstyle
store-path: ${{ steps.setup-haskell.outputs.cabal-store }}
threads: 16
archive-uri: https://iohk.cache.haskellworks.io/${{ env.CABAL_CACHE_VERSION }}/${{ runner.os }}
skip: "${{ secrets.BINARY_CACHE_URI != '' }}"
enable-save: false
- name: build Haddock documentation 🔧
run: |
mkdir -p ./haddocks
./scripts/haddocs.sh ./haddocks
- name: deploy to gh-pages 🚀
run: |
git config --local user.email "[email protected]"
git config --local user.name ${{ github.actor }}
git fetch origin gh-pages:gh-pages
git checkout gh-pages
cp -r ./haddocks/* ./
rm -rf haddocks
git add -A
git commit -m "Deployed haddocks" || true
git push https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git HEAD:gh-pages