Skip to content

Commit b3b3267

Browse files
committed
Does this work?
1 parent 5793527 commit b3b3267

File tree

1 file changed

+65
-28
lines changed

1 file changed

+65
-28
lines changed

.github/workflows/main.yml

Lines changed: 65 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,84 @@
1-
name: build
1+
name: Windows CI
22

33
on:
44
- push
55
- pull_request
66

7+
env:
8+
OPAMROOT: D:\opamroot
9+
OPAMSOLVERTIMEOUT: 120
10+
MSYS: winsymlinks:native
711
jobs:
8-
build-and-test:
9-
name: build
10-
12+
build:
1113
strategy:
1214
fail-fast: false
1315
matrix:
14-
include:
15-
- { ocaml-compiler: 5.0.0, os: ubuntu-latest }
16-
- { ocaml-compiler: 5.0.0, os: macos-latest }
17-
- { ocaml-compiler: 4.14.0, os: ubuntu-latest }
18-
- { ocaml-compiler: 4.14.0, os: windows-latest }
19-
- { ocaml-compiler: 4.14.0, os: macos-latest }
20-
- { ocaml-compiler: 4.08.0, os: ubuntu-latest }
21-
16+
os:
17+
- windows-latest
18+
windows_env:
19+
- cygwin
20+
- msys2
2221
runs-on: ${{ matrix.os }}
23-
2422
steps:
25-
- name: Checkout code
26-
uses: actions/checkout@v2
23+
- run: git config --global core.autocrlf false
24+
- name: Checkout tree
25+
uses: actions/checkout@v6
2726
with:
28-
submodules: true
27+
fetch-depth: 2
2928

30-
- name: Re-synchronize the package index files on Ubuntu
31-
if: matrix.os == 'ubuntu-latest'
32-
run: sudo apt-get update
29+
- name: Download install.ps1
30+
run: |
31+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
32+
(New-Object System.Net.WebClient).DownloadFile("https://raw.githubusercontent.com/ocaml/opam/master/shell/install.ps1", ".\install.ps1")
3333
34-
- name: Use OCaml ${{ matrix.ocaml-compiler }}
35-
uses: ocaml/setup-ocaml@v3
34+
- name: Restore opam cache
35+
id: cache-opam
36+
uses: actions/cache/restore@v4
3637
with:
37-
ocaml-compiler: ${{ matrix.ocaml-compiler }}
38+
path: |
39+
D:\opam\bin
40+
D:\opamroot
41+
key: ${{ runner.os }}-${{ matrix.windows_env }}-opam-${{ hashFiles('install.ps1') }}
42+
43+
- name: Add MSys2 to PATH and install prerequisites
44+
if: matrix.windows_env == 'msys2'
45+
run: |
46+
"C:\msys64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
47+
C:\msys64\usr\bin\pacman.exe --noconfirm -Syuu # Core update (in case any core packages are outdated)
48+
C:\msys64\usr\bin\pacman.exe --noconfirm -Syuu m4 make mingw-w64-i686-gcc mingw-w64-x86_64-gcc rsync unzip
3849
39-
- run: opam pin -n .
50+
- name: Install opam
51+
if: steps.cache-opam.outputs.cache-hit != 'true'
52+
run: |
53+
Invoke-Expression "& ./install.ps1 -OpamBinDir 'D:\opam\bin'"
4054
41-
- run: opam install . --deps-only
55+
- name: Add opam to PATH
56+
run: |
57+
D:\opam\bin\opam --version
58+
"D:\opam\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
59+
60+
- name: Init opam
61+
if: steps.cache-opam.outputs.cache-hit != 'true'
62+
run: opam init --yes --no-setup ${{ matrix.windows_env == 'msys2' && '--cygwin-local-install' || '' }}
63+
64+
- name: Restrict testing to available compilers
65+
if: steps.cache-opam.outputs.cache-hit != 'true'
66+
# TODO Amend this lowerbound as older compiler packages are updated
67+
run: opam switch set-invariant --formula "`"ocaml`" {>= `"4.13`"}"
68+
69+
- name: Save opam cache
70+
if: steps.cache-opam.outputs.cache-hit != 'true'
71+
uses: actions/cache/save@v4
72+
with:
73+
path: |
74+
D:\opam\bin
75+
D:\opamroot
76+
key: ${{ steps.cache-opam.outputs.cache-primary-key }}
4277

43-
- run: opam exec -- dune build
44-
if: matrix.ocaml-compiler != '4.08.0'
78+
- name: Print version information
79+
run: |
80+
opam --version
81+
opam exec -- ocaml -version
82+
opam var
4583
46-
- run: opam install .
47-
if: matrix.os != 'windows-latest'
84+
- run: opam install . -y

0 commit comments

Comments
 (0)