-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (73 loc) · 2.82 KB
/
hackage.yml
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
# This workflow is based on the expectation that GitHub's runners install GHC
# using ghcup with default settings (installs GHCs to `~/.ghcup/ghc/$VERSION`).
name: Hackage artifacts
on:
push:
branches:
- main
env:
# ghcup needs full version string (e.g. 9.0.1, not 9.0)
ghc: "9.2.4"
EXE_NAME: fortran-vars
jobs:
hackage:
runs-on: ubuntu-latest
name: Hackage artifacts
steps:
# TODO: GHC decides to recompile based on timestamp, so cache isn't used
# Preferably GHC would work via hashes instead. Stack had this feature
# merged in Aug 2020.
# Upstream GHC issue: https://gitlab.haskell.org/ghc/ghc/-/issues/16495
# My issue on haskell/actions: https://github.com/haskell/actions/issues/41
# This also requires us to do a deep fetch, else we don't get the Git commit
# history we need to rewrite mod times.
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set all tracked file modification times to the time of their last commit
run: |
rev=HEAD
for f in $(git ls-tree -r -t --full-name --name-only "$rev") ; do
touch -d $(git log --pretty=format:%cI -1 "$rev" -- "$f") "$f";
done
- name: Delete preinstalled docs-stripped GHC ${{ env.ghc }}
run: rm -rf $HOME/.ghcup/ghc/${{ env.ghc }}
- name: Cache GHC ${{ env.ghc }}
uses: actions/cache@v2
with:
path: ~/.ghcup/ghc/${{ env.ghc }}
key: haddock-${{ env.ghc }}-ghc
- name: Install GHC ${{ env.ghc }} if not present from cache
run: |
if [ ! -d $HOME/.ghcup/ghc/${{ env.ghc }} ]; then
ghcup install ghc --force ${{ env.ghc }}
fi
- run: ghcup set ghc ${{ env.ghc }}
- run: cabal update
- run: cabal freeze
- name: Cache Cabal build artifacts
uses: actions/cache@v2
with:
path: |
~/.cabal/store
dist-newstyle
key: haddock-${{ env.ghc }}-cabal-${{ hashFiles('cabal.project.freeze') }}
restore-keys: haddock-${{ env.ghc }}-cabal
- run: cabal haddock --haddock-for-hackage --enable-documentation
- run: cabal sdist
- name: Upload Hackage sdist
uses: actions/upload-artifact@v2
with:
path: dist-newstyle/sdist/${{ env.EXE_NAME }}-*.tar.gz
name: ${{ env.EXE_NAME }}-sdist-${{ github.sha }}.tar.gz
if-no-files-found: error
- name: Upload Hackage Haddock docs
uses: actions/upload-artifact@v2
with:
path: dist-newstyle/${{ env.EXE_NAME }}-*-docs.tar.gz
name: ${{ env.EXE_NAME }}-hackage-haddocks-${{ github.sha }}.tar.gz
if-no-files-found: error
- name: Delete prepared tarballs (else can't extract just newest next time)
run: |
rm dist-newstyle/${{ env.EXE_NAME }}-*-docs.tar.gz
rm dist-newstyle/sdist/${{ env.EXE_NAME }}-*.tar.gz