@@ -86,104 +86,14 @@ jobs:
86
86
, "macOS-latest"
87
87
, "windows-latest"
88
88
]
89
- cabal : ['3.6']
90
89
91
90
steps :
92
91
- uses : actions/checkout@v2
93
92
94
- - uses : haskell/actions/setup@v1
95
- id : HaskEnvSetup
93
+ - uses : ./.github/actions/setup-build
96
94
with :
97
- ghc-version : ${{ matrix.ghc }}
98
- cabal-version : ${{ matrix.cabal }}
99
- enable-stack : false
100
-
101
- - if : runner.os == 'Windows'
102
- name : (Windows) Platform config
103
- run : |
104
- echo "CABAL_PKGS_DIR=C:\\cabal\\packages" >> $GITHUB_ENV
105
- - if : ( runner.os == 'Linux' ) || ( runner.os == 'macOS' )
106
- name : (Linux,macOS) Platform config
107
- run : |
108
- echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV
109
-
110
- # Needs to be before Cache Cabal so the cache can detect changes to the modified cabal.project file
111
- - if : matrix.ghc == '9.0.1'
112
- name : (GHC 9.0.1) Use modified `cabal.project`
113
- run : |
114
- # File has some protections preventing regular `rm`.
115
- # (most probably sticky bit is set on $HOME)
116
- # `&&` insures `rm -f` return is positive.
117
- # Many platforms also have `alias cp='cp -i'`.
118
- rm -f -v cabal.project && cp -v cabal-ghc901.project cabal.project
119
- - if : runner.os == 'Windows' && matrix.ghc == '8.8.4'
120
- name : (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults
121
- run : |
122
- echo "package floskell" >> cabal.project
123
- echo " ghc-options: -O0" >> cabal.project
124
-
125
- # Shorten binary names as a workaround for filepath length limits in Windows,
126
- # but since tests are hardcoded on this workaround -
127
- # all platforms (in 2021-12-07) need it.
128
- # All workflows which distinquishes cache on `cabal.project` needs this.
129
- - name : Workaround shorten binary names
130
- run : |
131
- sed -i.bak -e 's/haskell-language-server/hls/g' \
132
- -e 's/haskell_language_server/hls/g' \
133
- haskell-language-server.cabal cabal.project
134
- sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
135
- src/**/*.hs exe/*.hs
136
-
137
- - name : Retrieving `cabal.project` Hackage timestamp
138
- run : |
139
- # Form: index-state: 2021-11-29T08:11:08Z
140
- INDEX_STATE_ENTRY=$(grep index-state cabal.project)
141
- # Form: 2021-11-29T08-11-08Z
142
- INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
143
- echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV
144
-
145
- # 2021-12-02: NOTE: Cabal Hackage source tree storage does not depend on OS or GHC really,
146
- # but can depend on `base`.
147
- # But this caching is happens only inside `master` for `master` purposes of compiling the deps
148
- # so having a shared pool here that depends only on Hackage pin & does not depend on `base` is "good enough"
149
- # & used such because it preserves 10% of a global cache storage pool.
150
- # We have to restore package sources before `cabal update`
151
- # cause it overwrites the hackage index with the cached one
152
- - name : Hackage sources cache
153
- uses : actions/cache@v2
154
- env :
155
- cache-name : hackage-sources
156
- with :
157
- path : ${{ env.CABAL_PKGS_DIR }}
158
- key : ${{ env.cache-name }}-${{ env.INDEX_STATE }}
159
- restore-keys : ${{ env.cache-name }}-
160
-
161
- # To ensure we get the lastest hackage index and not relying on haskell action logic
162
- # It has to be done before `cabal freeze` to make it aware of the new index
163
- - run : cabal update
164
-
165
- - name : Form the package list ('cabal.project.freeze')
166
- run : |
167
- cabal v2-freeze && \
168
- echo "" && \
169
- echo 'Output:' && \
170
- echo "" && \
171
- cat 'cabal.project.freeze' && \
172
- echo '' || \
173
- echo 'WARNING: Could not produce the `freeze`.'
174
-
175
- - name : Compiled deps cache
176
- id : compiled-deps
177
- uses : actions/cache@v2
178
- env :
179
- cache-name : compiled-deps
180
- with :
181
- path : ${{ steps.HaskEnvSetup.outputs.cabal-store }}
182
- key : ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
183
- restore-keys : |
184
- ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
185
- ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
186
- ${{ env.cache-name }}-${{ runner.os }}-
95
+ ghc : ${{ matrix.ghc }}
96
+ os : ${{ runner.os }}
187
97
188
98
- if : steps.compiled-deps.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.ghc == '8.10.7'
189
99
name : Download sources for bench
0 commit comments