forked from haskell/haskell-language-server
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (118 loc) · 4.85 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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Hackage
on:
push:
branches:
- '*-hackage'
jobs:
check-and-upload-tarballs:
runs-on: ubuntu-latest
strategy:
matrix:
package: ["hie-compat", "hls-graph", "shake-bench",
"hls-plugin-api", "ghcide", "hls-test-utils",
"hls-brittany-plugin", "hls-floskell-plugin", "hls-fourmolu-plugin",
"hls-ormolu-plugin", "hls-stylish-haskell-plugin",
"hls-class-plugin", "hls-eval-plugin", "hls-explicit-imports-plugin",
"hls-haddock-comments-plugin", "hls-hlint-plugin",
"hls-module-name-plugin", "hls-pragmas-plugin",
"hls-refine-imports-plugin", "hls-retrie-plugin",
"hls-splice-plugin", "hls-tactics-plugin",
"hls-call-hierarchy-plugin",
"haskell-language-server"]
ghc: ["8.10.7", "8.8.4", "8.6.5"]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.4'
- name: Cache Cabal
uses: actions/cache@v2
env:
cache-name: cache-cabal
with:
path: |
~/.cabal/packages
~/.cabal/store
key: v2-${{ runner.os }}-${{ matrix.ghc }}-build-${{ hashFiles('cabal.project') }}
restore-keys: |
v2-${{ runner.os }}-${{ matrix.ghc }}-bench-${{ hashFiles('cabal.project') }}
v2-${{ runner.os }}-${{ matrix.ghc }}-build-
v2-${{ runner.os }}-${{ matrix.ghc }}
- name: "Run cabal check"
run: |
if [[ ${{ matrix.package }} == *plugin ]]; then
cd plugins
fi
if [[ ${{ matrix.package }} != haskell-language-server ]]; then
cd ${{ matrix.package }}
fi
cabal check
- name: "Generate package dist tarball"
id: generate-dist-tarball
run: |
if [[ ${{ matrix.package }} == haskell-language-server ]]; then
cabal sdist --builddir=./
else
cabal sdist ${{ matrix.package }} --builddir=./
fi
echo ::set-output name=path::$(ls ./sdist/${{ matrix.package }}-*)
- name: "Unpack package source in an isolated location"
run: cabal unpack ${{ steps.generate-dist-tarball.outputs.path }} --destdir=./incoming
- name: "Ensure we will use hackage head"
run: cabal update
- name: "Try to get the current hackage version"
id: get-hackage-version
run: |
cd ./incoming
if cabal get $(ls -d ${{ matrix.package }}-*) --destdir=../current; then
echo ::set-output name=exists::true
else
echo ::set-output name=exists::false
fi
- name: "Compare the incoming and the current hackage version of the package"
id: compare-current-version
if: steps.get-hackage-version.outputs.exists == 'true'
run: |
# This will throw an error if there is any difference cause we have to bump up the package version
diff -r -x "*.md" -x "data" $(ls -d ./incoming/${{ matrix.package }}-*) $(ls -d ./current/${{ matrix.package }}-*)
- name: "Create appropiate cabal.project"
if: steps.get-hackage-version.outputs.exists != 'true'
run: |
cd $(ls -d ./incoming/${{ matrix.package }}-*)
echo "packages: . ../../* ../../plugins/*" > cabal.project
# TODO: remove when not needed
echo "allow-newer: Chart-diagrams:diagrams-core, SVGFonts:diagrams-core" >> cabal.project
- name: "Build all package components in isolation"
if: steps.get-hackage-version.outputs.exists != 'true'
run: |
cd $(ls -d ./incoming/${{ matrix.package }}-*)
cabal build --enable-tests --enable-benchmarks
- name: "Generate haddock for hackage"
if: steps.get-hackage-version.outputs.exists != 'true'
run: |
cd $(ls -d ./incoming/${{ matrix.package }}-*)
cabal haddock --haddock-for-hackage
- name: "Upload package dist tarball"
if: steps.get-hackage-version.outputs.exists != 'true'
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.package }}
path: ${{ steps.generate-dist-tarball.outputs.path }}
upload-candidate:
needs: check-and-upload-tarballs
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
path: packages
- name: "Join all tarballs"
run: find ./packages -type f -name '*.tar.gz' -exec cp {} ./packages \;
- name: "Upload all tarballs to hackage"
uses: haskell-actions/hackage-publish@v1
with:
hackageToken: ${{ secrets.HACKAGE_AUTH_TOKEN }}
packagesPath: packages
publish: false