Skip to content

Build everparse package (windows) #3

Build everparse package (windows)

Build everparse package (windows) #3

name: Build everparse package (windows)
on:
workflow_dispatch:
inputs:
fstar_repo:
description: F* repository (use org/repo for Github repos)
default: 'FStarLang/FStar'
type: string
required: true
fstar_ref:
description: F* ref (branch, or tag, or commit hash)
default: 'master'
type: string
required: true
karamel_repo:
description: Karamel repository (use org/repo for Github repos)
default: 'FStarLang/karamel'
type: string
required: true
karamel_ref:
description: Karamel ref (branch, or tag, or commit hash)
default: 'master'
type: string
required: true
push:
defaults:
run:
shell: bash
jobs:
fstar-src:
## NOTE: This is copied from build-src in the F* repo.
runs-on: ubuntu-22.04
# We prefer slightly older Ubuntu so we get binaries that work on
# all more recent versions.
steps:
- uses: actions/checkout@master
id: checkout
with:
repository: ${{inputs.fstar_repo}}
ref: ${{inputs.fstar_ref}}
- name: Check cache
id: check-cache
uses: actions/cache/restore@v4
with:
path: fstar-src.tar.gz
key: FStar-src-${{steps.checkout.outputs.commit}}
- uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 4.14.2
- name: Prepare
run: |
./.scripts/get_fstar_z3.sh $HOME/bin
echo "PATH=$HOME/bin:$PATH" >> $GITHUB_ENV
opam install --deps-only ./fstar.opam
- name: Set F* version
run: |
echo FSTAR_VERSION="$(git describe --tags --dirty)" >> $GITHUB_ENV
# NB: release workflow later adds version number to the name
- name: Build package
if: steps.check-cache.outputs.cache-hit != 'true'
run: |
eval $(opam env)
export FSTAR_TAG=
# ^ no tag in source package
make -skj$(nproc) package-src ADMIT=1
- name: Save
if: steps.check-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: fstar-src.tar.gz
key: FStar-src-${{steps.checkout.outputs.commit}}
- uses: actions/upload-artifact@v4
with:
path: fstar-src.tar.gz
name: package-src
fstar-binary:
runs-on: [self-hosted, windows, X64, opam-2-3]
needs: fstar-src
steps:
- name: clean
shell: C:\cygwin64\bin\bash.exe --login '{0}'
run: cd $GITHUB_WORKSPACE/ && rm -rf * && echo "There is a CR at the end of this line"
- uses: actions/download-artifact@v4
with:
name: package-src
- name: Check cache
id: check-cache
uses: actions/cache/restore@v4
with:
path: fstar.zip
key: FStar-${{runner.os}}-${{ hashFiles('fstar-src.tar.gz') }}
- run: cd $GITHUB_WORKSPACE && tar xzf fstar-src.tar.gz
if: steps.check-cache.outputs.cache-hit != 'true'
shell: C:\cygwin64\bin\bash.exe --login '{0}'
- name: Build a package
if: steps.check-cache.outputs.cache-hit != 'true'
shell: C:\cygwin64\bin\bash.exe --login '{0}'
run: |
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"
- name: Save
if: steps.check-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: fstar.zip
key: FStar-${{runner.os}}-${{ hashFiles('fstar-src.tar.gz') }}
- uses: actions/upload-artifact@v4
with:
name: fstar-package
path: fstar.zip
build:
runs-on: [self-hosted, windows, X64, opam-2-3]
needs: fstar-binary
steps:
- uses: actions/checkout@master
with:
path: karamel
repository: ${{inputs.karamel_repo}}
ref: ${{inputs.karamel_ref}}
- uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 4.14.2
- uses: actions/download-artifact@v4
with:
name: fstar-package
- name: Prepare
run: |
eval $(opam env)
sudo apt-get update || true
# opam install --deps-only FStar/fstar.opam
# ^ relying on the fact that F* dependencies are already installed
sed -i '/"fstar"/d' karamel/karamel.opam
# ^ remove F* dependency of karamel, it is outdated and will conflict.
opam install --deps-only karamel/karamel.opam
opam install hex re sexplib
# ^ everparse deps
- name: Build package
run: |
eval $(opam env)
make package -kj$(nproc)
- uses: actions/upload-artifact@v4
with:
path: |
everparse*.zip
everparse*.tar.gz
name: everparse