Skip to content

Commit 8c31bbd

Browse files
committed
(WIP) add .github/workflows/cache-deps.yml
1 parent 18633c7 commit 8c31bbd

File tree

1 file changed

+147
-0
lines changed

1 file changed

+147
-0
lines changed

.github/workflows/cache-deps.yml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: Caching of dependencies
2+
3+
defaults:
4+
run:
5+
shell: bash
6+
7+
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
8+
concurrency:
9+
group: ${{ github.head_ref }}-${{ github.workflow }}
10+
cancel-in-progress: true
11+
12+
on:
13+
push:
14+
branches:
15+
- master
16+
schedule:
17+
# Try to save snapshot every day at 3:45 UTC (~21:45 in California)
18+
- cron: "45 3 * * *"
19+
20+
jobs:
21+
pre_job:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
25+
should_skip_ghcide: ${{ steps.skip_ghcide_check.outputs.should_skip }}
26+
steps:
27+
- id: skip_check
28+
uses: fkirc/skip-duplicate-actions@v3.4.1
29+
with:
30+
cancel_others: false
31+
paths_ignore: '["**/docs/**", "**.md", "**/LICENSE", "install/**", "**.nix", "flake.lock", "**/README.md", "FUNDING.yml", ".circleci/**"]'
32+
# If we only change ghcide downstream packages we have not test ghcide itself
33+
- id: skip_ghcide_check
34+
uses: fkirc/skip-duplicate-actions@v3.4.1
35+
with:
36+
cancel_others: false
37+
paths_ignore: '["hls-test-utils/**", "plugins/**", "src/**", "exe/**", "test/**", "shake-bench/**"]'
38+
39+
test:
40+
if: needs.pre_job.outputs.should_skip != 'true'
41+
needs: pre_job
42+
runs-on: ${{ matrix.os }}
43+
strategy:
44+
fail-fast: true
45+
matrix:
46+
ghc: ["9.0.1", '8.10.7', '8.10.6', "8.10.5", "8.8.4", "8.8.3", "8.6.5"]
47+
os: [ubuntu-latest, macOS-latest]
48+
include:
49+
# only test supported ghc major versions
50+
- os: ubuntu-latest
51+
ghc: '9.0.1'
52+
test: true
53+
- os: ubuntu-latest
54+
ghc: '8.10.7'
55+
test: true
56+
- os: ubuntu-latest
57+
ghc: '8.8.4'
58+
test: true
59+
- os: ubuntu-latest
60+
ghc: '8.6.5'
61+
test: true
62+
- os: windows-latest
63+
ghc: '9.0.1'
64+
test: true
65+
- os: windows-latest
66+
ghc: '8.10.7'
67+
test: true
68+
- os: windows-latest
69+
ghc: '8.6.5'
70+
test: true
71+
# only build rest of supported ghc versions for windows
72+
- os: windows-latest
73+
ghc: '8.10.6'
74+
- os: windows-latest
75+
ghc: '8.10.5'
76+
- os: windows-latest
77+
ghc: '8.8.4'
78+
79+
steps:
80+
- uses: actions/checkout@v2
81+
with:
82+
submodules: true
83+
- uses: haskell/actions/setup@v1
84+
with:
85+
ghc-version: ${{ matrix.ghc }}
86+
cabal-version: "3.4"
87+
88+
- run: ./fmt.sh
89+
name: "HLint via ./fmt.sh"
90+
91+
- if: matrix.os == 'windows-latest'
92+
name: Set some window specific things
93+
run: |
94+
echo "CABAL_STORE_DIR=$SYSTEMDRIVE\\SR" >> $GITHUB_ENV
95+
echo "CABAL_PKGS_DIR=~\\AppData\\cabal\\packages" >> $GITHUB_ENV
96+
97+
- if: matrix.os != 'windows-latest'
98+
name: Set some linux/macOS specific things
99+
run: |
100+
echo "CABAL_STORE_DIR=~/.cabal/store" >> $GITHUB_ENV
101+
echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV
102+
103+
- if: matrix.os == 'macOS-latest' && matrix.ghc == '8.10.5'
104+
name: Workaround for GHC 8.10.5 on macOS
105+
run: |
106+
echo "# uninstalling CommandLineTools (see https://github.com/haskell/haskell-language-server/issues/1913#issuecomment-861667786)"
107+
sudo rm -rf /Library/Developer/CommandLineTools
108+
109+
# Needs to be before Cache Cabal so the cache can detect changes to the modified cabal.project file
110+
- if: matrix.ghc == '9.0.1'
111+
name: Use modified cabal.project for ghc9
112+
run: cp cabal-ghc901.project cabal.project
113+
114+
- if: matrix.ghc == '8.8.4' && matrix.os == 'windows-latest'
115+
name: Modify cabal.project to workaround segfaults for ghc-8.8.4 and windows
116+
run: |
117+
echo "package floskell" >> cabal.project
118+
echo " ghc-options: -O0" >> cabal.project
119+
120+
- name: Cache Cabal
121+
uses: actions/cache@v2
122+
env:
123+
cache-name: cache-cabal
124+
with:
125+
path: |
126+
${{ env.CABAL_PKGS_DIR }}
127+
${{ env.CABAL_STORE_DIR }}
128+
key: v2-${{ runner.os }}-${{ matrix.ghc }}-build-${{ hashFiles('cabal.project') }}
129+
restore-keys: |
130+
v2-${{ runner.os }}-${{ matrix.ghc }}-bench-${{ hashFiles('cabal.project') }}
131+
v2-${{ runner.os }}-${{ matrix.ghc }}-build-
132+
v2-${{ runner.os }}-${{ matrix.ghc }}
133+
134+
- run: cabal update
135+
136+
# Need this to work around filepath length limits in Windows
137+
- name: Shorten binary names
138+
run: |
139+
sed -i.bak -e 's/haskell-language-server/hls/g' \
140+
-e 's/haskell_language_server/hls/g' \
141+
haskell-language-server.cabal cabal.project
142+
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
143+
src/**/*.hs exe/*.hs
144+
145+
# repeating builds to workaround segfaults in windows and ghc-8.8.4
146+
- name: Build
147+
run: cabal build || cabal build || cabal build

0 commit comments

Comments
 (0)