Skip to content

Commit 2ac2de2

Browse files
authored
Merge branch 'viperproject:master' into master
2 parents 0e5f872 + 5bc98f0 commit 2ac2de2

2 files changed

Lines changed: 51 additions & 22 deletions

File tree

.github/workflows/scala.yml

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,61 @@ on:
3636
# them. This job automatically runs every night.
3737
# - create-stable-release
3838
# takes the fat and skinny JARs produced by configuration `release` during `build` job and creates a draft release with
39-
# them.
39+
# them. This only works on branch `release`.
4040

4141
env:
4242
Z3_VERSION: "4.8.6"
4343

4444
jobs:
45-
build:
45+
prepare-matrix:
4646
# build is the base job on which all other jobs depend
4747
# we enforce here that the nightly build job only runs in the main repo:
4848
if: (github.event_name == 'schedule' && github.repository == 'viperproject/viperserver') || (github.event_name != 'schedule')
49+
# sets up matrix for `build` job (based on https://stackoverflow.com/a/65434401/1990080)
50+
runs-on: ubuntu-latest
51+
outputs:
52+
matrix: ${{ steps.set-matrix.outputs.matrix }}
53+
steps:
54+
- id: set-matrix
55+
run: |
56+
# note that the values of `NAME` are also used in all other jobs and they have to match!
57+
IS_RELEASE=${{ github.ref == 'refs/heads/release' }}
58+
# skip 'latest' name on 'release' branch and ignore 'release' on all other branches'
59+
if [[ "$IS_RELEASE" == ${{ true }} ]]
60+
then
61+
NAME="release"
62+
SILVER_REF="v.21.07-release"
63+
SILICON_REF="v.21.07-release"
64+
CARBON_REF="v.21.07-release"
65+
else
66+
NAME="latest"
67+
SILVER_REF="master"
68+
SILICON_REF="master"
69+
CARBON_REF="master"
70+
fi
71+
# creates a JSON object that looks like the key-values in the GitHub documentation on `strategy.matrix`
72+
MATRIX="{ \
73+
\"name\":[\"$NAME\"], \
74+
\"include\": [{ \
75+
\"name\":\"$NAME\", \
76+
\"silver-ref\":\"$SILVER_REF\", \
77+
\"silicon-ref\":\"$SILICON_REF\", \
78+
\"carbon-ref\":\"$CARBON_REF\" \
79+
}] \
80+
}"
81+
# print matrix for debugging purposes:
82+
echo $MATRIX
83+
# set outputs of job:
84+
echo ::set-output name=matrix::$MATRIX
85+
86+
build:
87+
needs: prepare-matrix
4988
runs-on: ubuntu-latest
5089
container: viperproject/viperserver:v3_z3_4.8.6
5190
strategy:
5291
# tests should not be stopped when they fail on one of the configurations:
5392
fail-fast: false
54-
matrix:
55-
# note that the same names are also used in all other jobs and they have to match!
56-
name: [latest, release]
57-
include:
58-
- name: latest
59-
silver-ref: "master"
60-
silicon-ref: "master"
61-
carbon-ref: "master"
62-
- name: release
63-
silver-ref: "v.21.07-release"
64-
silicon-ref: "v.21.07-release"
65-
carbon-ref: "v.21.07-release"
93+
matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
6694
steps:
6795
- name: Checkout ViperServer
6896
uses: actions/checkout@v2
@@ -180,13 +208,13 @@ jobs:
180208

181209

182210
test:
183-
needs: build
211+
needs: [prepare-matrix, build]
184212
strategy:
185213
# tests should not be stopped when they fail on one of the OSes:
186214
fail-fast: false
187215
matrix:
188216
os: [macos-latest, ubuntu-latest, windows-latest]
189-
name: [latest, release]
217+
name: ${{ fromJson(needs.prepare-matrix.outputs.matrix).name }}
190218
runs-on: ${{ matrix.os }}
191219
steps:
192220
# we need to checkout the repo to have access to the test files
@@ -262,9 +290,9 @@ jobs:
262290

263291

264292
create-nightly-release:
293+
needs: [prepare-matrix, test]
265294
# this job creates a new nightly pre-release, set viperserver.jar as artifacts, and deletes old releases
266-
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly') || github.event_name == 'schedule'
267-
needs: test
295+
if: contains(fromJson(needs.prepare-matrix.outputs.matrix).name, 'latest') && ((github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly') || github.event_name == 'schedule')
268296
runs-on: ubuntu-latest
269297
env:
270298
# specifies that `latest` artifacts from `build` job should be used for nightly releases:
@@ -370,9 +398,9 @@ jobs:
370398
371399
372400
create-stable-release:
401+
needs: [prepare-matrix, test]
373402
# this job creates a stable draft-release and set viperserver.jar as artifacts
374-
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'stable'
375-
needs: test
403+
if: contains(fromJson(needs.prepare-matrix.outputs.matrix).name, 'release') && github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'stable'
376404
runs-on: ubuntu-latest
377405
env:
378406
# specifies that `release` artifacts from `build` job should be used for stable releases:

src/main/scala/viper/server/frontends/http/jsonWriters/ViperIDEProtocol.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,14 @@ object ViperIDEProtocol extends akka.http.scaladsl.marshallers.sprayjson.SprayJs
170170
implicit val abstractError_writer: RootJsonFormat[AbstractError] = lift(new RootJsonWriter[AbstractError] {
171171
override def write(obj: AbstractError): JsValue = {
172172
obj match {
173-
case e: VerificationError if e.counterexample.isDefined =>
173+
case e: VerificationError =>
174+
val counterexamples: Seq[Counterexample] = e.failureContexts.flatMap(ctx => ctx.counterExample)
174175
JsObject(
175176
"tag" -> JsString(obj.fullId),
176177
"text" -> JsString(obj.readableMessage),
177178
"position" -> obj.pos.toJson,
178179
"cached" -> JsBoolean(obj.cached),
179-
"counterexample" -> e.counterexample.get.toJson)
180+
"counterexamples" -> JsArray(counterexamples.map(_.toJson).toVector))
180181
case _ =>
181182
JsObject(
182183
"tag" -> JsString(obj.fullId),

0 commit comments

Comments
 (0)