forked from IntersectMBO/cardano-node
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (93 loc) · 3.56 KB
/
github-page.yml
File metadata and controls
115 lines (93 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: "Haddock documentation"
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
ghc: ["8.10.3"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v1
- name: Select build directory
run: |
CABAL_BUILDDIR=dist
echo "CABAL_BUILDDIR=$CABAL_BUILDDIR"
echo "CABAL_BUILDDIR=$CABAL_BUILDDIR" >> $GITHUB_ENV
- name: Set cache version
run: echo "CACHE_VERSION=UN37rUo" >> $GITHUB_ENV
- name: Add build script path
run: echo "$(pwd)/.github/bin" >> $GITHUB_PATH
- uses: haskell/actions/setup@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: 3.4.0.0
- name: Haskell versions
run: |
ghc --version
cabal --version
- name: Install build environment
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get -y install libsodium23 libsodium-dev
sudo apt-get -y install libsystemd0 libsystemd-dev
sudo apt-get -y remove --purge software-properties-common
sudo apt-get -y autoremove
- name: Cabal update
run: cabal update
- name: Disable reorder goals on MacOS and Linux
# Avoid reorder goals for platforms that don't need it because re-order goals can take up to 10 minutes
if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest'
run: |
cat cabal.project | sed 's|reorder-goals: True|reorder-goals: False|g' > cabal.project.tmp
mv cabal.project.tmp cabal.project
- name: Cabal Configure
run: cabal configure --builddir="$CABAL_BUILDDIR" --write-ghc-environment-files=always
- name: Use cabal.project.local.github-pages
run: |
cat ./cabal.project.local.github-pages >> ./cabal.project.local
cat ./cabal.project.local
- name: Record dependencies
run: |
cat ${{ env.PLAN_JSON }} | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
- uses: actions/cache@v2
name: Cache cabal store
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
restore-keys: |
cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
cache-${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-
- name: Install dependencies
run: cabal build all --builddir="$CABAL_BUILDDIR" --only-dependencies
- name: Build Haddock documentation 🔧
run: |
mkdir ./haddocks
./scripts/haddocs.sh ./haddocks true "$CABAL_BUILDDIR"
- 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/master'
run: |
git fetch origin gh-pages:gh-pages
git config --local user.email "$(git show --format="%aN" | head -n 1)"
git config --local user.name "$(git show --format="%aE" | head -n 1)"
git add .
git stash
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