Skip to content

Commit 8982f7a

Browse files
authored
1 parent ada9407 commit 8982f7a

File tree

2 files changed

+131
-10
lines changed

2 files changed

+131
-10
lines changed

.github/workflows/CI.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# based on https://github.com/WolframResearch/WL-FunctionCompile-CI-Template/blob/d130d1fef06f0597a2e81987140fd21eedb4dd3f/.github/workflows/compile-wl-functions.yml
2+
3+
name: CI
4+
on:
5+
push:
6+
branches: [master]
7+
tags: ["*"]
8+
pull_request:
9+
jobs:
10+
Linux:
11+
runs-on: ubuntu-latest
12+
container:
13+
image: wolframresearch/wolframengine:latest
14+
options: --user root
15+
env:
16+
WOLFRAMINIT: -entitlement ${{ secrets.WOLFRAM_LICENSE_ENTITLEMENT_ID }} -pwfile !cloudlm.wolfram.com
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: julia-actions/setup-julia@v1
20+
- uses: julia-actions/cache@v1
21+
- uses: julia-actions/julia-buildpkg@v1
22+
- uses: julia-actions/julia-runtest@v1
23+
- uses: julia-actions/julia-processcoverage@v1
24+
- uses: codecov/codecov-action@v1
25+
with:
26+
file: lcov.info
27+
28+
MacOS:
29+
runs-on: macos-latest
30+
env:
31+
WOLFRAMINIT: -entitlement ${{ secrets.WOLFRAM_LICENSE_ENTITLEMENT_ID }} -pwfile !cloudlm.wolfram.com
32+
steps:
33+
- name: Check out repository
34+
uses: actions/checkout@v2
35+
36+
# we don't cache the installation, as it doesn't play nice with spotlight
37+
- name: Install Wolfram Engine
38+
if: steps.cache-restore.outputs.cache-hit != 'true'
39+
run: |
40+
echo 'Installing Wolfram Engine...'
41+
brew install --cask wolfram-engine
42+
echo 'Installed Wolfram Engine.'
43+
44+
- uses: julia-actions/setup-julia@v1
45+
- uses: julia-actions/cache@v1
46+
- uses: julia-actions/julia-buildpkg@v1
47+
- uses: julia-actions/julia-runtest@v1
48+
- uses: julia-actions/julia-processcoverage@v1
49+
- uses: codecov/codecov-action@v1
50+
with:
51+
file: lcov.info
52+
53+
Windows:
54+
runs-on: windows-latest
55+
env:
56+
WOLFRAM_SYSTEM_ID: Windows-x86-64
57+
WOLFRAMENGINE_INSTALL_MSI_DOWNLOAD_URL: https://files.wolframcdn.com/packages/winget/13.0.0.0/WolframEngine_13.0.0_WIN.msi
58+
WOLFRAMENGINE_CACHE_KEY: WolframEngine-A
59+
WOLFRAMENGINE_INSTALLATION_SUBDIRECTORY: WolframEngine
60+
WOLFRAMINIT: -entitlement ${{ secrets.WOLFRAM_LICENSE_ENTITLEMENT_ID }} -pwfile !cloudlm.wolfram.com
61+
steps:
62+
- name: Check out repository
63+
uses: actions/checkout@v2
64+
65+
- name: Cache/restore Wolfram Engine install
66+
id: cache-restore
67+
uses: actions/cache@v2
68+
env:
69+
WOLFRAMENGINE_INSTALLATION_DIRECTORY: '${{ runner.temp }}\${{ env.WOLFRAMENGINE_INSTALLATION_SUBDIRECTORY }}'
70+
with:
71+
path: ${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}
72+
key: wolframengine-${{ env.WOLFRAM_SYSTEM_ID }}-${{ env.WOLFRAMENGINE_CACHE_KEY }}
73+
74+
- name: Download and install Wolfram Engine
75+
if: steps.cache-restore.outputs.cache-hit != 'true'
76+
env:
77+
WOLFRAMENGINE_INSTALLATION_DIRECTORY: '${{ runner.temp }}\${{ env.WOLFRAMENGINE_INSTALLATION_SUBDIRECTORY }}'
78+
WOLFRAMENGINE_INSTALL_MSI_PATH: '${{ runner.temp }}\WolframEngine-Install.msi'
79+
WOLFRAMENGINE_INSTALL_LOG_PATH: '${{ runner.temp }}\WolframEngine-Install.log'
80+
run: |
81+
echo 'Downloading Wolfram Engine installer...'
82+
$msiFile = '${{ env.WOLFRAMENGINE_INSTALL_MSI_PATH }}'
83+
$logFile = '${{ env.WOLFRAMENGINE_INSTALL_LOG_PATH }}'
84+
85+
Import-Module BitsTransfer
86+
Start-BitsTransfer '${{ env.WOLFRAMENGINE_INSTALL_MSI_DOWNLOAD_URL }}' $msiFile
87+
echo 'Downloaded Wolfram Engine installer.'
88+
89+
$DataStamp = get-date -Format yyyyMMddTHHmmss
90+
$MSIArguments = @(
91+
"/i"
92+
('"{0}"' -f $msiFile)
93+
'INSTALLLOCATION="${{ env.WOLFRAMENGINE_INSTALLATION_DIRECTORY }}"'
94+
"/qn"
95+
"/norestart"
96+
"/L*v"
97+
$logFile
98+
)
99+
echo 'Installing Wolfram Engine...'
100+
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow
101+
echo 'Installed Wolfram Engine.'
102+
- run: reg query 'HKCU\SOFTWARE\' /s
103+
- uses: julia-actions/setup-julia@v1
104+
- uses: julia-actions/cache@v1
105+
- uses: julia-actions/julia-buildpkg@v1
106+
env:
107+
JULIA_WOLFRAM_DIR: '${{ runner.temp }}\${{ env.WOLFRAMENGINE_INSTALLATION_SUBDIRECTORY }}'
108+
- uses: julia-actions/julia-runtest@v1
109+
- uses: julia-actions/julia-processcoverage@v1
110+
- uses: codecov/codecov-action@v1
111+
with:
112+
file: lcov.info
113+

deps/build.jl

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function find_lib_ker()
55
return ENV["JULIA_MATHLINK"], ENV["JULIA_MATHKERNEL"]
66
elseif Sys.isapple()
77
# we query OS X metadata for possible non-default installations
8-
# TODO: can use `mdls -raw -name kMDItemVersion $path` to get the version
8+
# TODO: can use `mdls -raw -name kMDItemVersion $path` to get the versio
99

1010
# Mathematica
1111
for path in readlines(`mdfind "kMDItemCFBundleIdentifier == 'com.wolfram.Mathematica'"`)
@@ -69,17 +69,25 @@ function find_lib_ker()
6969
# it looks like it registers stuff in
7070
# HKEY_LOCAL_MACHINE\SOFTWARE\Wolfram Research\Installations\
7171
# but not clear how it is organized
72-
for mpath in ["C:\\Program Files\\Wolfram Research\\Mathematica", "C:\\Program Files\\Wolfram Research\\Wolfram Engine"]
73-
if isdir(mpath)
74-
vers = readdir(mpath)
75-
ver = vers[argmax(map(VersionNumber,vers))]
76-
lib = Libdl.find_library(
77-
["ml$(Sys.WORD_SIZE)i4.dll", "libML$(Sys.WORD_SIZE)i4", "ml$(Sys.WORD_SIZE)i3.dll", "libML$(Sys.WORD_SIZE)i3"],
78-
[joinpath(mpath,ver,"SystemFiles\\Links\\MathLink\\DeveloperKit",archdir,"SystemAdditions")])
79-
ker = joinpath(mpath,ver,"math.exe")
80-
return lib, ker
72+
if haskey(ENV, "JULIA_WOLFRAM_DIR")
73+
wpaths = [ENV["JULIA_WOLFRAM_DIR"]]
74+
else
75+
wpaths = String[]
76+
for dir in ["C:\\Program Files\\Wolfram Research\\Mathematica", "C:\\Program Files\\Wolfram Research\\Wolfram Engine"]
77+
if isdir(mpath)
78+
for ver in readdir(mpath)
79+
push!(wpaths, joinpath(dir, ver))
80+
end
81+
end
8182
end
8283
end
84+
for wpath in wpaths
85+
lib = Libdl.find_library(
86+
["ml$(Sys.WORD_SIZE)i4.dll", "libML$(Sys.WORD_SIZE)i4", "ml$(Sys.WORD_SIZE)i3.dll", "libML$(Sys.WORD_SIZE)i3"],
87+
[joinpath(wpath,"SystemFiles\\Links\\MathLink\\DeveloperKit",archdir,"SystemAdditions")])
88+
ker = joinpath(wpath,"math.exe")
89+
return lib, ker
90+
end
8391
end
8492

8593
error("Could not find Mathematica or Wolfram Engine installation.\nPlease set the `JULIA_MATHLINK` and `JULIA_MATHKERNEL` variables.")

0 commit comments

Comments
 (0)