Merge pull request #495 from input-output-hk/newhoggy/remove-unused-c… #41
Workflow file for this run
This file contains 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: "Haddock documentation" | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
ghc: ["9.2.7"] | |
cabal: ["3.10.1.0"] | |
os: [ubuntu-latest] | |
env: | |
# Modify this value to "invalidate" the cabal cache. | |
CABAL_CACHE_VERSION: "2023-11-09" | |
concurrency: | |
group: > | |
a+${{ github.event_name }} | |
b+${{ github.workflow_ref }} | |
c+${{ github.job }} | |
d+${{ matrix.ghc }} | |
e+${{ matrix.cabal }} | |
f+${{ matrix.os }} | |
g+${{ (startsWith(github.ref, 'refs/heads/gh-readonly-queue/') && github.run_id) || github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Concurrency group | |
run: > | |
echo | |
a+${{ github.event_name }} | |
b+${{ github.workflow_ref }} | |
c+${{ github.job }} | |
d+${{ matrix.ghc }} | |
e+${{ matrix.cabal }} | |
f+${{ matrix.os }} | |
g+${{ (startsWith(github.ref, 'refs/heads/gh-readonly-queue/') && github.run_id) || github.event.pull_request.number || github.ref }} | |
- name: Install Haskell | |
uses: input-output-hk/actions/haskell@latest | |
id: setup-haskell | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
- name: Install system dependencies | |
uses: input-output-hk/actions/base@latest | |
with: | |
use-sodium-vrf: true # default is true | |
- uses: actions/checkout@v3 | |
- name: Cabal update | |
run: cabal update | |
- name: Disable all tests | |
run: | | |
cat > cabal.project.local <<EOF | |
tests: False | |
EOF | |
- name: Build dry run | |
run: cabal build all --dry-run --minimize-conflict-set | |
- name: Dry run | |
run: | | |
cabal build all --dry-run | |
mkdir ./haddocks | |
DRY_RUN=1 ./.github/bin/haddocks.sh ./haddocks true | |
# For users who fork cardano-cli 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: | |
# | |
# CACHE_AWS_ACCESS_KEY_ID | |
# CACHE_AWS_SECRET_ACCESS_KEY | |
# CACHE_URI | |
# CACHE_AWS_REGION | |
- name: Cabal cache over S3 | |
uses: action-works/cabal-cache-s3@v1 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.CACHE_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.CACHE_AWS_SECRET_ACCESS_KEY }} | |
with: | |
region: ${{ vars.CACHE_AWS_REGION }} | |
dist-dir: dist-newstyle | |
store-path: ${{ steps.setup-haskell.outputs.cabal-store }} | |
threads: ${{ vars.CACHE_THREADS }} | |
archive-uri: ${{ vars.CACHE_URI }}/${{ env.CABAL_CACHE_VERSION }}/${{ runner.os }}/${{ matrix.cabal }}/${{ matrix.ghc }} | |
skip: "${{ vars.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 }}/${{ matrix.cabal }}/${{ matrix.ghc }} | |
skip: "${{ vars.CACHE_URI != '' }}" | |
enable-save: false | |
- name: Install dependencies | |
run: cabal build all | |
- name: Build Haddock documentation 🔧 | |
run: ./.github/bin/haddocks.sh ./haddocks true | |
- name: View HTML files | |
run: | | |
find "dist-newstyle/build" -name '*.html' | xargs grep html | |
- name: Upload documentation | |
uses: actions/upload-artifact@v2 | |
if: ${{ always() }} | |
continue-on-error: true | |
with: | |
name: haddocks-${{ matrix.os }}-${{ matrix.ghc }} | |
path: ./haddocks | |
- name: Deploy documentation to gh-pages 🚀 | |
if: github.ref == 'refs/heads/main' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN || github.token }} | |
publish_dir: haddocks | |
force_orphan: true |