66 - main
77 - update-why3-image
88 paths :
9- - Dockerfile
10- - .dockerignore
11- - .github/workflows/why3-image.yml
9+ - infra/reference-env/**
1210 workflow_dispatch :
1311
1412permissions :
@@ -24,28 +22,98 @@ jobs:
2422 name : build and push
2523 runs-on : ubuntu-24.04
2624 steps :
27- - uses : actions/checkout@v6
25+ - uses : actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803
2826
2927 - name : Log in to GHCR
30- uses : docker/login-action@v3
28+ uses : docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0
3129 with :
3230 registry : ghcr.io
3331 username : ${{ github.actor }}
3432 password : ${{ secrets.GITHUB_TOKEN }}
3533
3634 - name : Set up Docker Buildx
37- uses : docker/setup-buildx-action@v3
35+ uses : docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c
3836
39- - name : Build and push Why3 image
40- uses : docker/build-push-action@v6
37+ - name : Build and push reference environment
38+ id : build
39+ uses : docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a
4140 with :
42- context : .
41+ context : infra/reference-env
4342 platforms : linux/amd64
4443 push : true
4544 tags : |
46- ghcr.io/${{ github.repository }}-why3:1.7.2
47- ghcr.io/${{ github.repository }}-why3:1.7.2 -${{ github.sha }}
45+ ghcr.io/${{ github.repository }}-why3:1.7.2-z3-4.8.12
46+ ghcr.io/${{ github.repository }}-why3:reference-env -${{ github.sha }}
4847 build-args : |
48+ OCAML_VERSION=4.14.4
4949 WHY3_VERSION=1.7.2
50- cache-from : type=gha,scope=why3-1.7.2
51- cache-to : type=gha,mode=max,scope=why3-1.7.2
50+ WHY3_COMMIT=1343338d3bb1941c0d4f134283bb0790816113c4
51+ WHY3_TREE=f5e82693620413d7d8e3ebcba69addcb6a65f877
52+ WHY3_SOURCE_ARCHIVE_SHA256=c7bf782933a5d8ef9e78638cbf18e480eef895dca95317ba50231f20d45e92c7
53+ Z3_VERSION=4.8.12
54+ Z3_ARCHIVE_SHA256=648e8a7afb57445440ad711b733bd675e3888da2767c14ae5122582c924d8d52
55+ REFERENCE_MANIFEST_SHA256=d842c4413353e620a6ee409f58cef8f5572db7e3d0a6dd50c007981f44fee2eb
56+ cache-from : type=gha,scope=why3-reference-env-v1
57+ cache-to : type=gha,mode=max,scope=why3-reference-env-v1
58+
59+ - name : Verify pinned components and required Why3 capabilities
60+ env :
61+ IMAGE_DIGEST : ${{ steps.build.outputs.digest }}
62+ run : |
63+ image_ref="ghcr.io/${GITHUB_REPOSITORY}-why3@${IMAGE_DIGEST}"
64+ docker pull "$image_ref"
65+ docker run --rm --platform linux/amd64 "$image_ref" bash -ceu '
66+ test "$(ocamlc -version)" = 4.14.4
67+ test "$(why3 --version)" = "Why3 platform, version 1.7.2"
68+ test "$(z3 --version)" = "Z3 version 4.8.12 - 64 bit"
69+ printf "theory Simple\n goal trivial : true\nend\n" \
70+ > /tmp/why3-sexp-smoke.mlw
71+ why3 pp --output=sexp /tmp/why3-sexp-smoke.mlw \
72+ > /tmp/why3-sexp-smoke.sexp
73+ test -s /tmp/why3-sexp-smoke.sexp
74+ printf "%s %s\n" \
75+ c7bf782933a5d8ef9e78638cbf18e480eef895dca95317ba50231f20d45e92c7 \
76+ /opt/reference-env/why3-source.tar.gz \
77+ | sha256sum --check --strict
78+ printf "let _ = Driver.prepare_task_trace\n" > /tmp/trace_probe.ml
79+ if ocamlfind ocamlc -package why3 -c /tmp/trace_probe.ml >/dev/null 2>&1; then
80+ echo "global Why3 unexpectedly contains the repository trace extension" >&2
81+ exit 1
82+ fi
83+ '
84+
85+ - name : Generate the environment lock candidate
86+ env :
87+ IMAGE_DIGEST : ${{ steps.build.outputs.digest }}
88+ run : |
89+ image_ref="ghcr.io/${GITHUB_REPOSITORY}-why3@${IMAGE_DIGEST}"
90+ container_id="$(docker create --platform linux/amd64 "$image_ref")"
91+ docker cp "$container_id:/opt/reference-env/manifest.json" \
92+ "$RUNNER_TEMP/reference-env-manifest.json"
93+ docker rm "$container_id"
94+ node tools/why3_reference/generate_environment_lock_candidate.mjs \
95+ --image-digest "$IMAGE_DIGEST" \
96+ --manifest "$RUNNER_TEMP/reference-env-manifest.json" \
97+ --output "$RUNNER_TEMP/reference-environment-lock-v1.json"
98+
99+ - name : Report immutable image digest
100+ env :
101+ IMAGE_DIGEST : ${{ steps.build.outputs.digest }}
102+ run : |
103+ {
104+ echo '### Reference environment candidate'
105+ echo
106+ echo "Image digest: \`${IMAGE_DIGEST}\`"
107+ echo
108+ echo 'Promotion replaces only `tools/contracts/reference-environment-lock-v1.json`.'
109+ } >> "$GITHUB_STEP_SUMMARY"
110+
111+ - name : Upload environment lock candidate
112+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
113+ with :
114+ name : reference-environment-${{ github.sha }}
115+ path : |
116+ ${{ runner.temp }}/reference-env-manifest.json
117+ ${{ runner.temp }}/reference-environment-lock-v1.json
118+ if-no-files-found : error
119+ retention-days : 30
0 commit comments