Skip to content

Commit cf84ef5

Browse files
CI: organizing bootstraping (#2446)
* CI: caching: upd doc * CI: caching: rm schedule It seems would not be needed. `cabal.project` has pinned Hackage revision & when HLS code updates in `master` is during merges. * CI: caching: build & save cache * CI: (caching,test,bench): org bootstrap This were organized but others were ommited, because `build` & `hackage` have a different purpose I postphoned addind bootstrap to them. * CI: rm submodule checkouts Seems like HLS does not plan to use submodules. * CI: bench: fitting the workflow to strategy chosen Still kept the 9.0.1 bootstrap, because the very next workflow standard GHC update would hit the need of that code. * CI: bench: default to bash * CI: bench: rm env step * CI: Circle-CI: m fx Merely to refresh the Circle-CI report status in the PR * CI: caching: fx: rm executable name patching
1 parent 7794398 commit cf84ef5

File tree

7 files changed

+65
-71
lines changed

7 files changed

+65
-71
lines changed

.circleci/config.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@ defaults: &defaults
66
steps:
77
- checkout
88
- run:
9-
name: Write provided stack.yaml with predictable name
10-
command: cp ${STACK_FILE} stack-build.txt
11-
12-
- run:
13-
name: Figure out resolver for better caching
14-
command: grep '^resolver:' stack-build.txt > resolver.txt
9+
name: Save resolver field into file
10+
command: grep '^resolver:' ${STACK_FILE} > resolver.txt
1511

1612
- restore_cache:
1713
keys:

.github/workflows/bench.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Benchmark
22

3+
defaults:
4+
run:
5+
shell: bash
6+
37
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
48
concurrency:
59
group: ${{ github.head_ref }}-${{ github.workflow }}
@@ -34,6 +38,9 @@ jobs:
3438
os: [ubuntu-latest]
3539
cabal: ['3.6']
3640

41+
# This code is fitted to the strategy: assumes Linux is used ... etc,
42+
# change of the strategy may require changing the bootstrapping/run code
43+
3744
steps:
3845
- uses: actions/checkout@v2
3946

@@ -64,17 +71,14 @@ jobs:
6471
- run: cabal configure --enable-benchmarks --max-backjumps 12000
6572

6673
- name: Build
67-
shell: bash
6874
run: cabal build ghcide:benchHist
6975

7076
- name: Bench init
71-
shell: bash
7277
run: cabal bench ghcide:benchHist -j --benchmark-options="all-binaries"
7378

7479
# tar is required to preserve file permissions
7580
# compression speeds up upload/download nicely
7681
- name: tar workspace
77-
shell: bash
7882
run: tar -czf workspace.tar.gz * .git
7983

8084
- name: tar cabal
@@ -105,6 +109,7 @@ jobs:
105109
matrix:
106110
ghc: ['8.10.7']
107111
os: [ubuntu-latest]
112+
cabal: ['3.6']
108113
example: ['cabal', 'lsp-types']
109114

110115
steps:
@@ -133,11 +138,9 @@ jobs:
133138
tar xzf cabal.tar.gz --directory ~/.cabal
134139
135140
- name: Bench
136-
shell: bash
137141
run: cabal bench ghcide:benchHist -j --benchmark-options="${{ matrix.example }}"
138142

139143
- name: Display results
140-
shell: bash
141144
run: |
142145
column -s, -t < ghcide/bench-results/unprofiled/${{ matrix.example }}/results.csv | tee ghcide/bench-results/unprofiled/${{ matrix.example }}/results.txt
143146

.github/workflows/build.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ jobs:
2424

2525
steps:
2626
- uses: actions/checkout@v2
27-
with:
28-
submodules: true
27+
2928
- uses: haskell/actions/setup@v1
3029
with:
3130
ghc-version : ${{ matrix.ghc }}
@@ -161,8 +160,6 @@ jobs:
161160

162161
steps:
163162
- uses: actions/checkout@v2
164-
with:
165-
submodules: true
166163

167164
- name: Create source tarball
168165
run: |

.github/workflows/caching.yml

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
name: Caching
22

33
# Docs on the workflow:
4-
# 1. GitHub cache scoping goes: main branch -> PR main branch -> PR. (essentially in a tree fashion). That is why it is useful to build caches on `master` - to generate & keep the main project state & they would be shared to the whole tree.
5-
# 2. GitHub has a 10G default limit of cache pool per repo. HLS is a big project & monorepo of many projects, so to keep cache useful - the main branch state caches should be preserved & their storage preferred to the PRs, since PRs from internal branches - would count into 10G pool, but would be available only inside of the PR scope, which can bork cache fore the whole community. That is short story why `dist-newstyle` (especially full) - is not includded into `master` cache.
4+
# 1. GitHub cache scoping goes:
5+
# [main branch -> PR main branch -> PR. (essentially in a tree fashion)](https://web.archive.org/web/20211125171853/https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache).
6+
# Building & keeping caches on `master` allows
7+
# to share the main project state cache be shared to the whole tree.
8+
# 2. GitHub has a [default 10G cache pool limit](https://web.archive.org/web/20211125171853/https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy) per repo.
9+
# HLS is a big monorepo codebase, which means easy cache pool
10+
# invalidation & exhaustion because of the pool limit.
11+
# To keep caches useful - the main state of the main branch should remain
12+
# & so keep caching in the repo well below the limit.
13+
# that means preferring main branch to the PR caches
14+
# (especially internal branch ones), since PRs from internal branches -
15+
# count into the repo 10G pool, while that cache gets used only inside of the PR,
16+
# while exhausting the pool would bork cache for the rest of the community.
17+
# That is a short story why `dist-newstyle` (especially full) currently is not
18+
# includded into `master` or PR caches.
619

720
defaults:
821
run:
@@ -17,11 +30,9 @@ on:
1730
push:
1831
branches:
1932
- master
20-
schedule:
21-
# Try to save snapshot every day at 08:25 UTC (~00:25 in California)
22-
- cron: "25 8 * * *"
2333

2434
jobs:
35+
2536
pre_job:
2637
runs-on: ubuntu-latest
2738
outputs:
@@ -40,44 +51,43 @@ jobs:
4051
cancel_others: false
4152
paths_ignore: '["hls-test-utils/**", "plugins/**", "src/**", "exe/**", "test/**", "shake-bench/**"]'
4253

43-
deps:
54+
caching:
4455
if: needs.pre_job.outputs.should_skip != 'true'
4556
needs: pre_job
4657
runs-on: ${{ matrix.os }}
4758
strategy:
59+
fail-fast: false
4860
matrix:
4961
ghc: ["9.0.1", '8.10.7', '8.10.6', "8.8.4", "8.6.5"]
5062
os: [ubuntu-latest, macOS-latest, windows-latest]
5163
cabal: ['3.6']
5264

5365
steps:
5466
- uses: actions/checkout@v2
55-
with:
56-
submodules: true
67+
5768
- uses: haskell/actions/setup@v1
5869
with:
59-
ghc-version : ${{ matrix.ghc }}
70+
ghc-version: ${{ matrix.ghc }}
6071
cabal-version: ${{ matrix.cabal }}
6172

62-
- if: matrix.os == 'windows-latest'
63-
name: Set some window specific things
73+
- if: runner.os == 'Windows'
74+
name: (Windows) Platform config
6475
run: |
6576
echo "CABAL_STORE_DIR=$SYSTEMDRIVE\\SR" >> $GITHUB_ENV
6677
echo "CABAL_PKGS_DIR=~\\AppData\\cabal\\packages" >> $GITHUB_ENV
67-
68-
- if: matrix.os != 'windows-latest'
69-
name: Set some linux/macOS specific things
78+
- if: ( runner.os == 'Linux' ) || ( runner.os == 'macOS' )
79+
name: (Linux,macOS) Platform config
7080
run: |
7181
echo "CABAL_STORE_DIR=~/.cabal/store" >> $GITHUB_ENV
7282
echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV
7383
7484
# Needs to be before Cache Cabal so the cache can detect changes to the modified cabal.project file
7585
- if: matrix.ghc == '9.0.1'
76-
name: Use modified cabal.project for ghc9
77-
run: cp cabal-ghc901.project cabal.project
78-
79-
- if: matrix.ghc == '8.8.4' && matrix.os == 'windows-latest'
80-
name: Modify cabal.project to workaround segfaults for ghc-8.8.4 and windows
86+
name: (GHC 9.0.1) Use modified `cabal.project`
87+
run: |
88+
cp cabal-ghc901.project cabal.project
89+
- if: runner.os == 'Windows' && matrix.ghc == '8.8.4'
90+
name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults
8191
run: |
8292
echo "package floskell" >> cabal.project
8393
echo " ghc-options: -O0" >> cabal.project
@@ -98,15 +108,6 @@ jobs:
98108
99109
- run: cabal update
100110

101-
# Need this to work around filepath length limits in Windows
102-
- name: Shorten binary names
103-
run: |
104-
sed -i.bak -e 's/haskell-language-server/hls/g' \
105-
-e 's/haskell_language_server/hls/g' \
106-
haskell-language-server.cabal cabal.project
107-
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
108-
src/**/*.hs exe/*.hs
109-
110111
# repeating builds to workaround segfaults in windows and ghc-8.8.4
111112
- name: Build
112113
run: cabal build --only-dependencies || cabal build --only-dependencies || cabal build --only-dependencies

.github/workflows/hackage.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ jobs:
4747
steps:
4848

4949
- uses: actions/checkout@v2
50-
with:
51-
submodules: true
5250

5351
- uses: haskell/actions/setup@v1
5452
with:

.github/workflows/nix.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ jobs:
4444

4545
steps:
4646
- uses: actions/checkout@v2
47-
with:
48-
submodules: true
47+
4948
- uses: cachix/install-nix-action@v16
5049
with:
5150
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
@@ -79,8 +78,7 @@ jobs:
7978

8079
steps:
8180
- uses: actions/checkout@v2
82-
with:
83-
submodules: true
81+
8482
- uses: cachix/install-nix-action@v16
8583
with:
8684
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install

.github/workflows/test.yml

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -74,39 +74,45 @@ jobs:
7474

7575
steps:
7676
- uses: actions/checkout@v2
77-
with:
78-
submodules: true
77+
7978
- uses: haskell/actions/setup@v1
8079
with:
8180
ghc-version : ${{ matrix.ghc }}
8281
cabal-version: ${{ matrix.cabal }}
8382

84-
- run: ./fmt.sh
85-
name: "HLint via ./fmt.sh"
86-
87-
- if: matrix.os == 'windows-latest'
88-
name: Set some window specific things
83+
- if: runner.os == 'Windows'
84+
name: (Windows) Platform config
8985
run: |
9086
echo "CABAL_STORE_DIR=$SYSTEMDRIVE\\SR" >> $GITHUB_ENV
9187
echo "CABAL_PKGS_DIR=~\\AppData\\cabal\\packages" >> $GITHUB_ENV
92-
93-
- if: matrix.os != 'windows-latest'
94-
name: Set some linux/macOS specific things
88+
- if: ( runner.os == 'Linux' ) || ( runner.os == 'macOS' )
89+
name: (Linux,macOS) Platform config
9590
run: |
9691
echo "CABAL_STORE_DIR=~/.cabal/store" >> $GITHUB_ENV
9792
echo "CABAL_PKGS_DIR=~/.cabal/packages" >> $GITHUB_ENV
9893
9994
# Needs to be before Cache Cabal so the cache can detect changes to the modified cabal.project file
10095
- if: matrix.ghc == '9.0.1'
101-
name: Use modified cabal.project for ghc9
102-
run: cp cabal-ghc901.project cabal.project
103-
104-
- if: matrix.ghc == '8.8.4' && matrix.os == 'windows-latest'
105-
name: Modify cabal.project to workaround segfaults for ghc-8.8.4 and windows
96+
name: (GHC 9.0.1) Use modified `cabal.project`
97+
run: |
98+
cp cabal-ghc901.project cabal.project
99+
- if: runner.os == 'Windows' && matrix.ghc == '8.8.4'
100+
name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults
106101
run: |
107102
echo "package floskell" >> cabal.project
108103
echo " ghc-options: -O0" >> cabal.project
109104
105+
# Shorten binary names as a workaround for filepath length limits in Windows,
106+
# but since tests are hardcoded on this workaround -
107+
# all platforms (in 2021-12-07) need it.
108+
- name: Workaround shorten binary names
109+
run: |
110+
sed -i.bak -e 's/haskell-language-server/hls/g' \
111+
-e 's/haskell_language_server/hls/g' \
112+
haskell-language-server.cabal cabal.project
113+
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
114+
src/**/*.hs exe/*.hs
115+
110116
- name: Cache Cabal
111117
uses: actions/cache@v2
112118
env:
@@ -123,14 +129,9 @@ jobs:
123129
124130
- run: cabal update
125131

126-
# Need this to work around filepath length limits in Windows
127-
- name: Shorten binary names
132+
- name: "HLint via ./fmt.sh"
128133
run: |
129-
sed -i.bak -e 's/haskell-language-server/hls/g' \
130-
-e 's/haskell_language_server/hls/g' \
131-
haskell-language-server.cabal cabal.project
132-
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
133-
src/**/*.hs exe/*.hs
134+
./fmt.sh
134135
135136
# repeating builds to workaround segfaults in windows and ghc-8.8.4
136137
- name: Build

0 commit comments

Comments
 (0)