[new release] aifad (2.3.2) #7398
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
OPAMROOT: D:\opamroot | |
OPAMSOLVERTIMEOUT: 120 | |
MSYS: winsymlinks:native | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows-latest | |
windows_env: | |
- cygwin | |
- msys2 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout tree | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 2 | |
- name: Download install.ps1 | |
run: | | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
(New-Object System.Net.WebClient).DownloadFile("https://raw.githubusercontent.com/ocaml/opam/master/shell/install.ps1", ".\install.ps1") | |
- name: Restore opam cache | |
id: cache-opam | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
D:\opam\bin | |
D:\opamroot | |
key: ${{ runner.os }}-${{ matrix.windows_env }}-opam-${{ hashFiles('install.ps1') }} | |
- name: Add MSys2 to PATH and install prerequisites | |
if: matrix.windows_env == 'msys2' | |
run: | | |
"C:\msys64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
C:\msys64\usr\bin\pacman.exe --noconfirm -Syuu # Core update (in case any core packages are outdated) | |
C:\msys64\usr\bin\pacman.exe --noconfirm -Syuu m4 make mingw-w64-i686-gcc mingw-w64-x86_64-gcc rsync unzip | |
- name: Install opam | |
if: steps.cache-opam.outputs.cache-hit != 'true' | |
run: | | |
Invoke-Expression "& ./install.ps1 -OpamBinDir 'D:\opam\bin'" | |
- name: Add opam to PATH | |
run: | | |
D:\opam\bin\opam --version | |
"D:\opam\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Init opam | |
if: steps.cache-opam.outputs.cache-hit != 'true' | |
run: opam init --yes --no-setup ${{ matrix.windows_env == 'msys2' && '--cygwin-local-install' || '' }} . | |
- name: Restrict testing to available compilers | |
if: steps.cache-opam.outputs.cache-hit != 'true' | |
# TODO Amend this lowerbound as older compiler packages are updated | |
run: opam switch set-invariant --formula "`"ocaml`" {>= `"4.13`"}" | |
- name: Save opam cache | |
if: steps.cache-opam.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
D:\opam\bin | |
D:\opamroot | |
key: ${{ steps.cache-opam.outputs.cache-primary-key }} | |
- name: Print version information | |
run: | | |
opam --version | |
opam exec -- ocaml -version | |
- name: Get changed files | |
id: changed-files | |
if: github.event_name != 'push' | |
uses: tj-actions/changed-files@v47 | |
- name: List all changed packages | |
id: changed-packages | |
if: github.event_name != 'push' | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
$output = @() | |
Foreach ($file in ($env:ALL_CHANGED_FILES).Split(" ")) { | |
switch -Regex ($file) { | |
'^packages\\[^\\]*\\([^\\]*)\\.*' { $output += "$($matches[1])"; Break } | |
default { Write-Host "$file skipped"; Break } | |
} | |
} | |
$outputJson = $output | ConvertTo-Json | |
"data<<@@@" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
$outputJson | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
"@@@" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
- name: Install packages | |
env: | |
ALL_CHANGED_PACKAGES: ${{ steps.changed-packages.outputs.data }} | |
if: github.event_name != 'push' | |
run: | | |
$pkgs = $env:ALL_CHANGED_PACKAGES | ConvertFrom-Json | |
$failed = $false | |
opam update | |
Foreach ($pkg in $pkgs) { | |
Write-Host "::group::Testing `e[1;34m$pkg`e[0m" | |
opam install --color=always --confirm-level=unsafe-yes "$pkg" | |
Write-Host "::endgroup::" | |
switch ($LASTEXITCODE) { | |
0 { Write-Host "`e[1;32m$pkg installed successfully`e[0m."; Break } | |
5 { Write-Host "$pkg is not installable. `e[1;33mSkip`e[0m."; Break } # TODO: Remove when https://github.com/ocaml/opam/issues/6017 is fixed | |
20 { Write-Host "$pkg is not installable. `e[1;33mSkip`e[0m."; Break } | |
31 { Write-Host "`e[1;31m$pkg failed to build`e[0m."; $failed = $true; Break } | |
default { throw "Unexpected error $_" } | |
} | |
Write-Host | |
} | |
if ($failed) { | |
throw "One or more packages failed to build" | |
} | |
Exit |