Skip to content

Commit 9203ca8

Browse files
committed
workflows: windows package
1 parent 86310ec commit 9203ca8

File tree

1 file changed

+137
-6
lines changed

1 file changed

+137
-6
lines changed

.github/workflows/package-windows.yml

Lines changed: 137 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,143 @@ on:
2323
type: string
2424
required: true
2525

26-
defaults:
27-
run:
28-
shell: bash
29-
3026
jobs:
31-
nop:
27+
fstar-src:
28+
## NOTE: This is copied from build-src in the F* repo.
29+
3230
runs-on: ubuntu-22.04
31+
# We prefer slightly older Ubuntu so we get binaries that work on
32+
# all more recent versions.
33+
steps:
34+
- uses: actions/checkout@master
35+
id: checkout
36+
with:
37+
repository: ${{inputs.fstar_repo}}
38+
ref: ${{inputs.fstar_ref}}
39+
40+
- name: Check cache
41+
id: check-cache
42+
uses: actions/cache/restore@v4
43+
with:
44+
path: fstar-src.tar.gz
45+
key: FStar-src-${{steps.checkout.outputs.commit}}
46+
47+
- uses: ocaml/setup-ocaml@v3
48+
if: steps.check-cache.outputs.cache-hit != 'true'
49+
with:
50+
ocaml-compiler: 4.14.2
51+
52+
- name: Prepare
53+
if: steps.check-cache.outputs.cache-hit != 'true'
54+
run: |
55+
./.scripts/get_fstar_z3.sh $HOME/bin
56+
echo "PATH=$HOME/bin:$PATH" >> $GITHUB_ENV
57+
opam install --deps-only ./fstar.opam
58+
59+
- name: Set F* version
60+
if: steps.check-cache.outputs.cache-hit != 'true'
61+
run: |
62+
echo FSTAR_VERSION="$(git describe --tags --dirty)" >> $GITHUB_ENV
63+
64+
# NB: release workflow later adds version number to the name
65+
- name: Build package
66+
if: steps.check-cache.outputs.cache-hit != 'true'
67+
run: |
68+
eval $(opam env)
69+
export FSTAR_TAG=
70+
# ^ no tag in source package
71+
make -skj$(nproc) package-src ADMIT=1
72+
73+
- name: Save
74+
if: steps.check-cache.outputs.cache-hit != 'true'
75+
uses: actions/cache/save@v4
76+
with:
77+
path: fstar-src.tar.gz
78+
key: FStar-src-${{steps.checkout.outputs.commit}}
79+
80+
- uses: actions/upload-artifact@v4
81+
with:
82+
path: fstar-src.tar.gz
83+
name: package-src
84+
85+
fstar-binary:
86+
runs-on: [self-hosted, windows, X64, opam-2-3]
87+
needs: fstar-src
3388
steps:
34-
- run: exit 0
89+
- name: clean
90+
shell: C:\cygwin64\bin\bash.exe --login '{0}'
91+
run: cd $GITHUB_WORKSPACE/ && rm -rf * && echo "There is a CR at the end of this line"
92+
93+
- uses: actions/download-artifact@v4
94+
with:
95+
name: package-src
96+
97+
# - name: Check cache
98+
# id: check-cache
99+
# uses: actions/cache/restore@v4
100+
# with:
101+
# path: fstar.zip
102+
# key: FStar-${{runner.os}}-${{ hashFiles('/fstar-src.tar.gz') }}
103+
104+
- run: cd $GITHUB_WORKSPACE && tar xzf fstar-src.tar.gz && echo ""
105+
# if: steps.check-cache.outputs.cache-hit != 'true'
106+
shell: C:\cygwin64\bin\bash.exe --login '{0}'
107+
108+
- name: Build a package
109+
# if: steps.check-cache.outputs.cache-hit != 'true'
110+
shell: C:\cygwin64\bin\bash.exe --login '{0}'
111+
run: |
112+
cd $GITHUB_WORKSPACE && cd fstar && eval $(opam env) && make clean && CC=x86_64-w64-mingw32-gcc.exe DUNE_CONFIG__BACKGROUND_SANDBOXES=disabled make -j$(nproc) package V=1 ADMIT=1 && mv fstar.zip .. && echo "There is a CR at the end of this line"
113+
114+
# - name: Save
115+
# if: steps.check-cache.outputs.cache-hit != 'true'
116+
# uses: actions/cache/save@v4
117+
# with:
118+
# path: fstar.zip
119+
# key: FStar-${{runner.os}}-${{ hashFiles('/fstar-src.tar.gz') }}
120+
121+
- uses: actions/upload-artifact@v4
122+
with:
123+
name: fstar-package
124+
path: fstar.zip
125+
126+
build:
127+
runs-on: [self-hosted, windows, X64, opam-2-3]
128+
needs: fstar-binary
129+
steps:
130+
- uses: actions/checkout@master
131+
132+
- uses: actions/checkout@master
133+
with:
134+
path: karamel
135+
repository: ${{inputs.karamel_repo}}
136+
ref: ${{inputs.karamel_ref}}
137+
138+
- uses: actions/download-artifact@v4
139+
with:
140+
name: fstar-package
141+
142+
- name: Prepare
143+
# opam install --deps-only FStar/fstar.opam
144+
# ^ relying on the fact that F* dependencies are already installed
145+
if: false
146+
# Disabling this, I get
147+
# Error: Package karamel has no version opam.
148+
# but karamel.opam should refer to the file? This also did not
149+
# work with karamel/karamel.opam (without cd'ing).
150+
shell: C:\cygwin64\bin\bash.exe --login '{0}'
151+
run: |
152+
cd $GITHUB_WORKSPACE && eval $(opam env) && cd karamel && sed -i '/"fstar"/d' karamel.opam && opam install --deps-only karamel.opam && opam install hex re sexplib && echo ""
153+
154+
- name: Build package
155+
shell: C:\cygwin64\bin\bash.exe --login '{0}'
156+
run: |
157+
cd $GITHUB_WORKSPACE && eval $(opam env) && CC=x86_64-w64-mingw32-gcc.exe make package -kj$(nproc) && echo ""
158+
159+
- uses: actions/upload-artifact@v4
160+
with:
161+
path: |
162+
everparse*.zip
163+
everparse*.tar.gz
164+
everparse*.nupkg
165+
name: everparse

0 commit comments

Comments
 (0)