17
17
cancel_others : true
18
18
paths_ignore : ' ["**/docs/**", "**.md", "**/LICENSE", ".circleci/**", "install/**", "**.nix", "**/test/**", "flake.lock", "**/README.md", "FUNDING.yml"]'
19
19
20
- bench-init :
20
+ bench_init :
21
+ if : needs.pre_job.outputs.should_skip != 'true'
21
22
needs : pre_job
22
23
runs-on : ${{ matrix.os }}
23
24
@@ -28,19 +29,17 @@ jobs:
28
29
os : [ubuntu-latest]
29
30
30
31
steps :
31
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
32
- uses : actions/checkout@v2
33
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
34
- run : git fetch origin master # check the master branch for benchmarking
35
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
36
- uses : haskell/actions/setup@v1
32
+ - uses : actions/checkout@v2
33
+
34
+ - run : git fetch origin master # check the master branch for benchmarking
35
+
36
+ - uses : haskell/actions/setup@v1
37
37
with :
38
38
ghc-version : ${{ matrix.ghc }}
39
39
cabal-version : ' 3.2'
40
40
enable-stack : false
41
41
42
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
43
- name : Cache Cabal
42
+ - name : Cache Cabal
44
43
uses : actions/cache@v2
45
44
with :
46
45
path : |
@@ -52,55 +51,47 @@ jobs:
52
51
v2-${{ runner.os }}-${{ matrix.ghc }}-bench-
53
52
v2-${{ runner.os }}-${{ matrix.ghc }}
54
53
55
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
56
- run : cabal update
54
+ - run : cabal update
57
55
58
56
# max-backjumps is increased as a temporary solution
59
57
# for dependency resolution failure
60
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
61
- run : cabal configure --enable-benchmarks --max-backjumps 12000
58
+ - run : cabal configure --enable-benchmarks --max-backjumps 12000
62
59
63
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
64
- name : Build
60
+ - name : Build
65
61
shell : bash
66
62
run : cabal build ghcide:benchHist
67
63
68
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
69
- name : Bench init
64
+ - name : Bench init
70
65
shell : bash
71
66
run : cabal bench ghcide:benchHist -j --benchmark-options="all-binaries"
72
67
73
68
# tar is required to preserve file permissions
74
69
# compression speeds up upload/download nicely
75
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
76
- name : tar workspace
70
+ - name : tar workspace
77
71
shell : bash
78
72
run : tar -czf workspace.tar.gz * .git
79
73
80
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
81
- name : tar cabal
74
+ - name : tar cabal
82
75
run : |
83
76
cd ~/.cabal
84
77
tar -czf cabal.tar.gz *
85
78
86
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
87
- name : Upload workspace
79
+ - name : Upload workspace
88
80
uses : actions/upload-artifact@v2
89
81
with :
90
82
name : workspace
91
83
retention-days : 1
92
84
path : workspace.tar.gz
93
85
94
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
95
- name : Upload .cabal
86
+ - name : Upload .cabal
96
87
uses : actions/upload-artifact@v2
97
88
with :
98
89
name : cabal-home
99
90
retention-days : 1
100
91
path : ~/.cabal/cabal.tar.gz
101
92
102
- bench-example :
103
- needs : [bench-init , pre_job]
93
+ bench_example :
94
+ needs : [bench_init , pre_job]
104
95
runs-on : ${{ matrix.os }}
105
96
106
97
strategy :
@@ -111,47 +102,40 @@ jobs:
111
102
example : ['cabal', 'lsp-types']
112
103
113
104
steps :
114
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
115
- uses : haskell/actions/setup@v1
105
+ - uses : haskell/actions/setup@v1
116
106
with :
117
107
ghc-version : ${{ matrix.ghc }}
118
108
cabal-version : ' 3.2'
119
109
enable-stack : false
120
110
121
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
122
- name : Download cabal home
111
+ - name : Download cabal home
123
112
uses : actions/download-artifact@v2
124
113
with :
125
114
name : cabal-home
126
115
path : .
127
116
128
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
129
- name : Download workspace
117
+ - name : Download workspace
130
118
uses : actions/download-artifact@v2
131
119
with :
132
120
name : workspace
133
121
path : .
134
122
135
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
136
- name : untar
123
+ - name : untar
137
124
run : |
138
125
mkdir -p ~/.cabal
139
126
tar xzf workspace.tar.gz
140
127
tar xzf cabal.tar.gz --directory ~/.cabal
141
128
142
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
143
- name : Bench
129
+ - name : Bench
144
130
shell : bash
145
131
run : cabal bench ghcide:benchHist -j --benchmark-options="${{ matrix.example }}"
146
132
147
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
148
- name : Display results
133
+ - name : Display results
149
134
shell : bash
150
135
run : |
151
136
column -s, -t < ghcide/bench-results/unprofiled/${{ matrix.example }}/results.csv | tee ghcide/bench-results/unprofiled/${{ matrix.example }}/results.txt
152
137
153
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
154
- name : Archive benchmarking artifacts
138
+ - name : Archive benchmarking artifacts
155
139
uses : actions/upload-artifact@v2
156
140
with :
157
141
name : bench-results-${{ runner.os }}-${{ matrix.ghc }}
@@ -161,12 +145,24 @@ jobs:
161
145
ghcide/bench-results/**/*.svg
162
146
ghcide/bench-results/**/*.eventlog.html
163
147
164
- - if : ${{ needs.pre_job.outputs.should_skip != 'true' }}
165
- name : Archive benchmark logs
148
+ - name : Archive benchmark logs
166
149
uses : actions/upload-artifact@v2
167
150
with :
168
151
name : bench-logs-${{ runner.os }}-${{ matrix.ghc }}
169
152
path : |
170
153
ghcide/bench-results/**/*.log
171
154
ghcide/bench-results/**/*.eventlog
172
155
ghcide/bench-results/**/*.hp
156
+
157
+ post_job :
158
+ if : always()
159
+ runs-on : ubuntu-latest
160
+ needs : [pre_job, bench_init, bench_example]
161
+ steps :
162
+ - run : |
163
+ echo "jobs info: ${{ toJSON(needs) }}"
164
+ - if : contains(needs.*.result, 'failure')
165
+ run : exit 1
166
+ - if : contains(needs.*.result, 'cancelled')
167
+ name : cancelling
168
+
0 commit comments