mirror of
https://github.com/haskell/haskell-language-server.git
synced 2024-09-19 20:57:21 +03:00
d331019b37
Bumps [haskell-actions/setup](https://github.com/haskell-actions/setup) from 2.7.3 to 2.7.5. - [Release notes](https://github.com/haskell-actions/setup/releases) - [Commits](https://github.com/haskell-actions/setup/compare/v2.7.3...v2.7.5) --- updated-dependencies: - dependency-name: haskell-actions/setup dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: soulomoon <fwy996602672@gmail.com> Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
119 lines
4.1 KiB
YAML
119 lines
4.1 KiB
YAML
name: "Cached build"
|
|
description: "Setup the build using cache"
|
|
inputs:
|
|
ghc:
|
|
description: "Ghc version"
|
|
required: true
|
|
cabal:
|
|
description: "Cabal version"
|
|
required: false
|
|
default: "3.10.2.0"
|
|
os:
|
|
description: "Operating system: Linux, Windows or macOS"
|
|
required: true
|
|
cache-prefix:
|
|
description: "To allow make unique the cache key"
|
|
required: false
|
|
default: ""
|
|
shorten-hls:
|
|
description: "Whether we have to shorten haskell language server to hls"
|
|
required: false
|
|
default: "true"
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Workaround runner image issue
|
|
if: runner.os == 'Linux'
|
|
# https://github.com/actions/runner-images/issues/7061
|
|
run: |
|
|
sudo mkdir -p /usr/local/.ghcup
|
|
sudo chown -R $USER /usr/local/.ghcup
|
|
shell: bash
|
|
|
|
- uses: haskell-actions/setup@v2.7.5
|
|
id: HaskEnvSetup
|
|
with:
|
|
ghc-version : ${{ inputs.ghc }}
|
|
cabal-version: ${{ inputs.cabal }}
|
|
enable-stack: false
|
|
|
|
- if: inputs.os == 'Windows'
|
|
name: (Windows) Platform config
|
|
run: |
|
|
echo "CABAL_PKGS_DIR=C:\\cabal\\packages" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- if: ( inputs.os == 'Linux' ) || ( inputs.os == 'macOS' )
|
|
name: (Linux,macOS) Platform config
|
|
run: |
|
|
echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
# Shorten binary names as a workaround for filepath length limits in Windows,
|
|
# but since tests are hardcoded on this workaround all platforms need it.
|
|
# All workflows which distinguishes cache on `cabal.project` needs this.
|
|
# Except hackage one, which needs the original name
|
|
- if: inputs.shorten-hls == 'true'
|
|
name: Workaround shorten binary names
|
|
run: |
|
|
sed -i.bak -e 's/haskell-language-server/hls/g' \
|
|
-e 's/haskell_language_server/hls/g' \
|
|
haskell-language-server.cabal cabal.project
|
|
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
|
|
src/**/*.hs exe/*.hs
|
|
shell: bash
|
|
|
|
- name: Retrieving `cabal.project` Hackage timestamp
|
|
run: |
|
|
# Form: index-state: 2021-11-29T08:11:08Z
|
|
INDEX_STATE_ENTRY=$(grep index-state cabal.project)
|
|
# Form: 2021-11-29T08-11-08Z
|
|
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
|
|
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
# We have to restore package sources before `cabal update`
|
|
# because it overwrites the hackage index with the cached one
|
|
- name: Hackage sources cache
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: hackage-sources
|
|
with:
|
|
path: ${{ env.CABAL_PKGS_DIR }}
|
|
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
|
|
restore-keys: ${{ env.cache-name }}-
|
|
|
|
# To ensure we get the latest hackage index without relying on the haskell action logic
|
|
# It has to be done before `cabal freeze` to make it aware of the new index
|
|
- run: cabal update
|
|
shell: bash
|
|
|
|
- name: Form the package list ('cabal.project.freeze')
|
|
run: |
|
|
rm cabal.project.freeze || \
|
|
cabal v2-freeze && \
|
|
echo "" && \
|
|
echo 'Output:' && \
|
|
echo "" && \
|
|
cat 'cabal.project.freeze'
|
|
shell: bash
|
|
|
|
- name: Compiled deps cache
|
|
id: compiled-deps
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: compiled-deps
|
|
with:
|
|
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
|
|
key: ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
|
|
restore-keys: |
|
|
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-
|
|
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-
|
|
${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-
|
|
|
|
# We remove the freeze file because it could interfere with the build
|
|
- name: "Remove freeze file"
|
|
run: rm -f cabal.project.freeze
|
|
shell: bash
|