-
Notifications
You must be signed in to change notification settings - Fork 273
98 lines (87 loc) · 3.54 KB
/
haddocks.yaml
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
name: Haddocks
defaults:
run:
working-directory: unison
shell: bash
on:
push:
branches:
- trunk
jobs:
build:
name: Haddocks
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
path: unison
# The number towards the beginning of the cache keys allow you to manually avoid using a previous cache.
# GitHub will automatically delete caches that haven't been accessed in 7 days, but there is no way to
# purge one manually.
# Cache ~/.stack, keyed by the contents of 'stack.yaml'.
- uses: actions/cache@v2
name: cache ~/.stack
with:
path: ~/.stack
# Main cache key: commit hash. This should always result in a cache miss...
# So when loading a cache we'll always fall back to the restore-keys,
# which should load the most recent cache via a prefix search on the most
# recent branch cache.
# Then it will save a new cache at this commit sha, which should be used by
# the next build on this branch.
key: stack-0-haddocks-${{github.sha}}
# Fall-back to the most recent haddocks build, or to a standard Linux build failing that.
restore-keys: |
stack-0-haddocks
stack-0-Linux
# Cache each local package's ~/.stack-work for fast incremental builds in CI.
- uses: actions/cache@v2
name: cache .stack-work
with:
path: |
**/.stack-work
# Main cache key: commit hash. This should always result in a cache miss...
# So when loading a cache we'll always fall back to the restore-keys,
# which should load the most recent cache via a prefix search on the most
# recent branch cache.
# Then it will save a new cache at this commit sha, which should be used by
# the next build on this branch.
key: stack-work-2-haddocks-${{github.sha}}
# Fall-back to the most recent haddocks build, or to a standard Linux build failing that.
restore-keys: |
stack-work-2_Linux-haddocks
stack-work-2_Linux
- name: install stack (Linux)
working-directory: ${{ github.workspace }}
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-linux-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
# One of the transcripts fails if the user's git name hasn't been set.
- name: set git user info
working-directory: unison
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: build with haddocks
working-directory: unison
run: stack --no-terminal build --fast --haddock
# Haddocks
- name: Checkout haddocks branch
uses: actions/checkout@v2
with:
ref: 'haddocks'
path: 'haddocks'
- name: Copy haddocks
working-directory: 'unison'
run: |
docs_root="$(stack path --local-doc-root)"
# Erase any stale files
cd "$GITHUB_WORKSPACE"/haddocks
rm -rf ./*
git checkout --orphan fresh-haddocks-branch
cp -r "${docs_root}"/* "$GITHUB_WORKSPACE"/haddocks
git add .
git commit -m "Regenerated haddocks based on ${GITHUB_SHA}"
# Push the branch with only a single commit over the remote
git push --force origin fresh-haddocks-branch:haddocks