-
Notifications
You must be signed in to change notification settings - Fork 232
160 lines (137 loc) · 5.97 KB
/
windows-dk.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: FStar Windows Package built with Dk
on:
push:
branches:
- 'dkml*'
pull_request:
workflow_dispatch:
jobs:
build-windows:
# runs-on: [self-hosted, Windows, X64]
runs-on: windows-2022
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
TRIPLET: x64-windows
OPAMYES: 1
# Settings for MSYS2
CHERE_INVOKING: yes
MSYSTEM: CLANG64
MSYS2_ARG_CONV_EXCL: '*'
# Use bash shell as default.
defaults:
run:
shell: ${{ github.workspace }}\msys64\usr\bin\bash.exe --login --noprofile --norc -eo pipefail {0}
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Restore GMP and z3 from cache
uses: actions/cache/restore@v4
id: cache-vcpkg-z3
with:
path: |
vcpkg_installed
z3_installed
key: vcpkg-z3-${{ runner.os }}
- name: Install GMP library and Z3 executable
if: steps.cache-vcpkg-z3.outputs.cache-hit != 'true'
shell: powershell -command ". '{0}'"
run: |
.github/setup-vcpkg.cmd
.github/setup-z3.cmd
- name: Cache GMP and z3
uses: actions/cache/save@v4
# always save cache, even on failures
if: steps.cache-vcpkg-z3.outputs.cache-hit != 'true'
with:
path: |
vcpkg_installed
z3_installed
key: ${{ steps.cache-vcpkg-z3.outputs.cache-primary-key }}
- name: Cache MSYS2
uses: actions/cache@v4
id: cache-msys2
with:
path: msys64
key: msys2-${{ runner.os }}
- name: Get DkML cache key
# Because GitHub public runners have indeterminate MSVC versions (ex. 14.41.34120 or 14.40.33807), or
# more accurately multiple runner versions (ex. 20240825.1.0) can be active in the GitHub runner fleet,
# we have to cache OCaml specific to the MSVC version. For example, one on runner the libraries
# can be in C:\VS\VC\Tools\MSVC\14.40.33807\lib\x64 while another is at
# C:\VS\VC\Tools\MSVC\14.40.34120\lib\x64.
#
# Hardcoded MSVC versions are in:
# 1. The values in .ci/sd4/msvcenv (from setup-dkml) are specific to the MSVC minor version.
# 2. Worse, OCaml is not relocatable, so ocamlopt.exe is specific to the MSVC minor version.
#
# Artifacts:
# - msys64/ (cached in prior step)
# - .ci/sd4/ (.ci/sd4/msvcenv is used as a cache key 1-to-1 with MSVC version)
shell: powershell -command ". '{0}'"
run: |
.github/setup-dkml.cmd -SKIP_OPAM_MODIFICATIONS true
Get-Content .ci\sd4\msvcenv
- name: Restore DkML distribution from cache
uses: actions/cache/restore@v4
id: cache-dkml
with:
path: |
.ci/o
.ci/sd4
key: dkml-1-${{ runner.os }}-${{ hashFiles('.ci/sd4/msvcenv') }}
- name: Setup DkML distribution
if: steps.cache-dkml.outputs.cache-hit != 'true'
shell: powershell -command ". '{0}'"
run: .github/setup-dkml.cmd
- name: Cache DkML distribution
uses: actions/cache/save@v4
# always save cache, even on failures
if: steps.cache-dkml.outputs.cache-hit != 'true'
with:
path: |
.ci/o
.ci/sd4
key: ${{ steps.cache-dkml.outputs.cache-primary-key }}
- name: Restore .NET
uses: actions/cache/restore@v4
id: cache-dotnet
with:
path: dotnet
key: dotnet-${{ runner.os }}
- name: Setup .NET
if: steps.cache-dotnet.outputs.cache-hit != 'true'
shell: powershell -command ". '{0}'"
run: .github/setup-dotnet.cmd
- name: Cache .NET
uses: actions/cache/save@v4
# always save cache, even on failures
if: steps.cache-dotnet.outputs.cache-hit != 'true'
with:
path: dotnet
key: ${{ steps.cache-dotnet.outputs.cache-primary-key }}
- name: Build a package
# Test in PowerShell with:
# $env:CHERE_INVOKING = "yes"; $env:MSYSTEM = "CLANG64"; msys64\usr\bin\dash.exe -lc 'export OPAMYES=1 TRIPLET=x64-windows MSYS_NO_PATHCONV=1 MSYS2_ARG_CONV_EXCL=\*; export VCPKG_INSTALLED=$(cygpath -am vcpkg_installed/$TRIPLET); export FSTAR_HOME="$PWD/src/ocaml-output/fstar"; PATH="$PWD/.ci/sd4/opamrun:$PWD/vcpkg_installed/$TRIPLET/bin:$PWD/z3_installed/bin:$PATH"; opamrun pin process git+https://github.com/tahina-pro/ocaml-process.git#taramana_dune --no-action && opamrun install ./ocaml/repo/packages/conf-gmp/conf-gmp.4+vcpkg/opam && env "PKG_CONFIG_PATH=$VCPKG_INSTALLED/lib/pkgconfig" opamrun install dune sedlex memtrace ppx_deriving ppx_deriving_yojson menhir process pprint stdint zarith batteries && opamrun exec -- make package DOTNET=$(cygpath -am dotnet/dotnet.exe)'
run: |
export VCPKG_INSTALLED=$(cygpath -am "vcpkg_installed/$TRIPLET")
export FSTAR_HOME=$PWD/src/ocaml-output/fstar
PATH="$PWD/.ci/sd4/opamrun:$PWD/vcpkg_installed/$TRIPLET/bin:$PWD/z3_installed/bin:$PATH"
opamrun exec -- sh -c 'echo $PATH'
opamrun exec -- sh -c 'echo $VCToolsRedistDir'
opamrun exec -- sh -c 'command -v cl'
opamrun pin process git+https://github.com/tahina-pro/ocaml-process.git#taramana_dune --no-action
opamrun install ./ocaml/repo/packages/conf-gmp/conf-gmp.4+vcpkg
export "TMP=$RUNNER_TEMP"
export "PKG_CONFIG_PATH=$VCPKG_INSTALLED/lib/pkgconfig"
opamrun install dune sedlex memtrace ppx_deriving ppx_deriving_yojson menhir process pprint stdint zarith batteries
opamrun exec -- make -j package DOTNET=$(cygpath -am dotnet/dotnet.exe) && echo "There is a CR at the end of this line"
- name: Test the package
run: |
PATH="$PWD/.ci/sd4/opamrun:$PWD/vcpkg_installed/$TRIPLET/bin:$PWD/z3_installed/bin:$PATH"
export TMP=$RUNNER_TEMP
opamrun exec -- env CI_THREADS=24 bash -x .scripts/test_package.sh && echo "There is a CR at the end of this line"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: fstar-Windows_x86_64.zip
path: src\ocaml-output\fstar.zip