Skip to content

Commit 5ba7462

Browse files
committed
Merge branch '_taramana_release'
2 parents 9e92254 + 3da598c commit 5ba7462

File tree

12 files changed

+308
-11
lines changed

12 files changed

+308
-11
lines changed

.github/setup-macos.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Install OCaml and other GNU build tools
44
# coreutils: for the `install` command used in install-ulib.sh
55
export OPAMYES=1
6-
brew install opam bash gnu-getopt coreutils gnu-sed
6+
brew install opam bash gnu-getopt coreutils gnu-sed make
77
opam init --compiler=4.12.0
88
eval $(opam env)
99

.github/workflows/linux-build.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@ on:
44
jobs:
55
build:
66
runs-on: [self-hosted, linux, X64]
7-
defaults:
8-
run:
9-
# Setting the default shell to bash. This is not only more standard,
10-
# but also makes sure that we run with -o pipefail, so we can safely
11-
# pipe data (such as | tee LOG) without missing out on failures
12-
# and getting false positives. If you want to change the default shell,
13-
# keep in mind you need a way to handle this.
14-
shell: bash
157
steps:
168
- name: Check out repo
179
uses: actions/checkout@v2
10+
- name: Identify the base FStar branch and the notification channel
11+
run: |
12+
echo "FSTAR_BRANCH=$(jq -c -r '.BranchName' .docker/build/config.json)" >> $GITHUB_ENV
13+
- name: Build Steel and its dependencies
14+
run: |
15+
ci_docker_image_tag=steel:local-binary-run-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT
16+
docker buildx build --secret id=DZOMO_GITHUB_TOKEN -t $ci_docker_image_tag -f src/ci/package.Dockerfile --build-arg FSTAR_BRANCH=$FSTAR_BRANCH --build-arg CI_BRANCH=$GITHUB_REF_NAME .
17+
docker run $ci_docker_image_tag /bin/bash -c 'cat $STEEL_HOME/src/ci/steel.tar.gz || true' > steel.tar.gz
18+
gunzip steel.tar.gz
19+
env:
20+
DZOMO_GITHUB_TOKEN: ${{ secrets.DZOMO_GITHUB_TOKEN }}
21+
- name: Archive Steel package
22+
uses: actions/upload-artifact@v3
23+
with:
24+
name: steel.tar
25+
path: steel.tar

.github/workflows/macos-build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,23 @@ jobs:
1414
uses: actions/checkout@v3
1515
with:
1616
path: steel
17+
- name: Checkout everest
18+
uses: actions/checkout@v3
19+
with:
20+
repository: project-everest/everest
21+
path: steel/.github/everest
22+
- name: Install .NET SDK
23+
uses: actions/setup-dotnet@v3
24+
with:
25+
dotnet-version: '6.0.x'
26+
- name: Setup dependencies
27+
run: ./steel/.github/setup-macos.sh
28+
- name: Package Steel
29+
run: |
30+
source steel/.github/env.sh
31+
steel/src/ci/package.sh -j
32+
- name: Upload artifact
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: steel-Darwin_x86_64.tar.gz
36+
path: steel/src/ci/steel.tar.gz

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ lib/steel/META
1212
lib/steel/dune-package
1313
*.krml
1414
*.o
15+
LICENSE-z3.txt
1516

1617
# Created by CI
1718
BUILDLOG

pulse2rust/src/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_build

pulse2rust/src/ocaml/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = ["Aseem Rastogi"]
77
edition = "2018"
88

99
[lib]
10-
crate-type = ["staticlib", "cdylib"]
10+
crate-type = ["staticlib"]
1111
path = "rust/src/lib.rs"
1212

1313
[dependencies]

pulse2rust/src/ocaml/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
(no-infer
88
(progn
99
(run cargo build)
10-
(run cp target/debug/deps/librustast_bindings.a ./librustast_bindings.a)
10+
(run cp target/debug/librustast_bindings.a ./librustast_bindings.a)
1111
))))
1212

1313
(executable

share/steel/examples/pulse/Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,28 @@ CBOR_CHECKED_FILES=$(filter $(CACHE_DIRECTORY)/CBOR.% $(CACHE_DIRECTORY)/CDDL.%
4343

4444
.PHONY: cbor
4545
cbor: lib $(CBOR_CHECKED_FILES)
46+
47+
PREFIX ?= /usr/local
48+
ifeq ($(OS),Windows_NT)
49+
STEEL_INSTALL_PREFIX=$(shell cygpath -m $(PREFIX))
50+
else
51+
STEEL_INSTALL_PREFIX=$(PREFIX)
52+
endif
53+
export STEEL_INSTALL_PREFIX
54+
55+
ifeq (,$(INSTALL))
56+
INSTALL := $(shell ginstall --version 2>/dev/null | cut -c -8 | head -n 1)
57+
ifdef INSTALL
58+
INSTALL := ginstall
59+
else
60+
INSTALL := install
61+
endif
62+
export INSTALL
63+
endif
64+
65+
.PHONY: install-lib %.install
66+
67+
%.install: %
68+
$(INSTALL) -m 644 -D $< $(STEEL_INSTALL_PREFIX)/share/steel/examples/pulse/$<
69+
70+
install-lib: $(addsuffix .install,$(PULSE_LIB_CHECKED_FILES) $(wildcard lib/*.fst lib/*.fsti))

src/ci/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
steel
2+
steel.zip
3+
steel.tar.gz

src/ci/package-README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# The Steel and Pulse separation logic system for F*
2+
3+
## Contents of this package
4+
5+
This binary package contains z3 4.8.5, F*, Karamel, Steel, Pulse, and
6+
(except on Windows) Pulse2Rust:
7+
8+
* in `bin`: the executables for z3, F* and Karamel
9+
10+
* in `lib/steel`:
11+
* the Steel F* modules of the `Steel` and `Steel.ST` namespaces
12+
* the Steel F* plugin, `steel.cmxs`, containing the Steel and Pulse
13+
tactics, and the Steel and SteelC extraction to krml, is installed
14+
here
15+
* the LibSteel C library, `libsteel.a`, containing an implementation of
16+
what used to be the Steel part of krmllib (currently binding the
17+
pthreads spinlock), is installed here
18+
19+
* in `lib/steel/runtime`: the Steel OCaml runtime,
20+
`steel_runtime.cmxa`, necessary to compile and run Steel code
21+
extracted to OCaml, is installed here
22+
23+
* in `lib/steel/pulse`: the Pulse F* modules of the `Pulse` namespace
24+
(except `Pulse.Lib`)
25+
26+
* in `lib/steel/c`: the SteelC F* modules of the `Steel.C` and
27+
`Steel.ST.C` namespaces
28+
29+
* in `include/steel`: the C include files necessary to compile Steel
30+
code extracted to C
31+
32+
* in `share/steel`: `Makefile.include`, the GNU Make rules to verify
33+
Steel and Pulse code
34+
35+
* in `share/steel/examples/pulse`:
36+
* in `lib`: the Pulse user library files (namespace `Pulse.Lib`)
37+
* in `_output/cache`: the corresponding `.checked` files
38+
39+
* in `pulse2rust`: the executable for Pulse2Rust. (Absent from the
40+
Windows binary package)
41+
42+
## Using Steel and Pulse
43+
44+
### Writing a Makefile to verify Steel or Pulse code
45+
46+
Steel and Pulse come with `share/steel/Makefile.include`, which contains the
47+
GNU Make rules to call F* with the Steel include path and the Steel/Pulse
48+
plugin loaded.
49+
50+
1. Make sure the `bin` subdirectory is in your `PATH`.
51+
52+
2. Define the `STEEL_HOME` environment variable to the root directory
53+
of this package.
54+
55+
3. (Optional) In your Makefile, define the following variables with `+=` or `:=` :
56+
* `FSTAR_FILES`: some more F* files to verify, in addition to the
57+
`*.fst` and `.fsti` files of your project
58+
* `EXCLUDE_FILES`: some F* to skip for verification
59+
* `FSTAR_OPTIONS`: additional options to pass to F*. While
60+
`Makefile.include` is already configured to use Steel, you need
61+
to add more options if you need Pulse and/or SteelC:
62+
* if you want to use Pulse, add `--include $STEEL_HOME/lib/steel/pulse`
63+
* if you want to use SteelC, add `--include $STEEL_HOME/lib/steel/c`
64+
* `FSTAR_DEP_OPTIONS`: additional options to pass to F* to compute
65+
dependencies (in addition to `FSTAR_OPTIONS`), such as `--extract`
66+
* `FSTAR_ML_CODEGEN`: useful only if you want to extract OCaml
67+
code. If you want to extract a F* plugin, set this option to
68+
`Plugin`. Otherwise, it is set by default to `OCaml`.
69+
70+
4. After those variable definitions, insert `include
71+
$STEEL_HOME/share/steel/Makefile.include` to your Makefile.
72+
73+
5. In your project directory, run `make -j verify`
74+
75+
### Calling F* directly
76+
77+
If you already have an existing `Makefile` for your Steel- or
78+
Pulse-based project, you now need to pass new options to your Makefile
79+
to use Steel from this repository, as described in this section.
80+
81+
To call F* with Steel or Pulse, pass the following options to F*:
82+
* in all cases, `--include $STEEL_HOME/lib/steel --load_cmxs steel`
83+
* if you want to use Pulse, add `--include $STEEL_HOME/lib/steel/pulse`
84+
* if you want to use SteelC, add `--include $STEEL_HOME/lib/steel/c`

0 commit comments

Comments
 (0)