Skip to content

Commit

Permalink
Use Github worlflow
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainCorlay committed Dec 23, 2021
1 parent 1335a19 commit 10a2ca4
Show file tree
Hide file tree
Showing 11 changed files with 221 additions and 165 deletions.
56 changes: 0 additions & 56 deletions .appveyor.yml

This file was deleted.

156 changes: 156 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: CI
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
unix:

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, macos-10.15]
include:
- os: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1

- name: install mamba
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: environment-dev.yml
environment-name: xtensor-julia

- name: install build dependencies
shell: bash -l {0}
run: |
$HOME/micromamba-bin/micromamba install cmake cxx-compiler -c conda-forge -y
# Cannot use julia from setup-julia because of https://github.com/julia-actions/setup-julia/issues/89
# - name: install julia
# uses: julia-actions/setup-julia@v1
# with:
# version: 1.6.3

- name: install CxxWrap
run: |
julia -E "using Pkg; Pkg.add(PackageSpec(name=\"CxxWrap\", version=\"0.11.2\"))"
- name: cmake configure
shell: bash -l {0}
run: |
JlCxx_DIR=$(julia -E "using CxxWrap; joinpath(CxxWrap.prefix_path(), \"lib\", \"cmake\", \"JlCxx\")")
JlCxx_DIR=${JlCxx_DIR//\"/}
mkdir -p build
cd build
cmake .. \
-D DOWNLOAD_GTEST=ON \
-D BUILD_TESTS=ON \
-D JlCxx_DIR=$JlCxx_DIR \
-DCMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=$CONDA_PREFIX
- name: build
shell: bash -l {0}
run: |
cd build
make -j ${{ steps.cpu-cores.outputs.count }} test_xtensor_julia
- name: Test xtensor-julia
shell: bash -l {0}
run: |
cd build
make xtest
- name: install xtensor-julia
shell: bash -l {0}
run: |
cd build
make install
# win:

# runs-on: ${{ matrix.os }}

# strategy:
# fail-fast: false
# matrix:
# os: [ windows-2016 ]

# steps:
# - uses: actions/checkout@v2

# - name: install mamba
# uses: mamba-org/provision-with-micromamba@main
# with:
# environment-file: environment-dev.yml
# environment-name: xtensor-julia

# - name: micromamba shell hook
# shell: powershell
# run: |
# micromamba shell hook -s cmd.exe -p C:\Users\runneradmin\micromamba
# Get-Content -Path C:\Users\runneradmin\micromamba\condabin\mamba_hook.bat

# - name: install cxx compiler
# shell: cmd
# run: |
# call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xtensor-julia
# micromamba install cxx-compiler -c conda-forge -y

# - name: install julia
# uses: julia-actions/setup-julia@v1
# with:
# version: 1.6.3

# - name: install CxxWrap
# shell: cmd
# run: |
# julia -E "using Pkg; Pkg.add(PackageSpec(name=\"CxxWrap\", version=\"0.11.2\"))"

# - name: install host dependencies
# shell: bash -l {0}
# run: |
# call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xtensor-julia
# micromamba install xtensor=0.24.0 -c conda-forge -y
# micromamba install gtest -c conda-forge -y

# - name: cmake configure
# shell: cmd
# run: |
# call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xtensor-julia
# julia -E "using CxxWrap; joinpath(CxxWrap.prefix_path(), \"lib\", \"cmake\", \"JlCxx\")" > temp.txt
# set /p JlCxx_DIR=<temp.txt
# set JlCxx_DIR=%JlCxx_DIR:"=%
# mkdir -p build
# cd build
# cmake .. ^
# -G "NMake Makefiles" ^
# -D BUILD_TESTS=ON ^
# -D JlCxx_DIR=%JlCxx_DIR% ^
# -DCMAKE_BUILD_TYPE=Release ^
# -D CMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\\LIBRARY

# - name: build
# shell: cmd
# run: |
# call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xtensor-julia
# cd build
# nmake test_xtensor_julia

# - name: run test
# shell: cmd
# run: |
# call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate xtensor-julia
# cd build
# nmake xtest
84 changes: 0 additions & 84 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ from the `docs` subdirectory.
## Running the tests

```
cmake -D JlCxx_DIR=/path/to/.julia/v0.6/CxxWrap/deps/usr/lib/cmake/JlCxx -D BUILD_TESTS=ON ..
cmake -D BUILD_TESTS=ON ..
```

## Dependencies on `xtensor` and `libcxxwrap-julia`
Expand All @@ -191,7 +191,7 @@ cmake -D JlCxx_DIR=/path/to/.julia/v0.6/CxxWrap/deps/usr/lib/cmake/JlCxx -D BUIL

| `xtensor-julia` | `xtensor` | `libcxxwrap` | `julia` |
|-----------------|-----------|---------------|----------------|
| master | ^0.21.2 | >=0.5.3,<0.6 | >=1.0.0,<2.0 |
| master | ^0.24.0 | >=0.8.3,<0.9 | >=1.6.4,<2.0 |
| 0.9.0 | ^0.21.2 | >=0.5.3,<0.6 | >=1.0.0,<2.0 |
| 0.8.4 | ^0.20.8 | >=0.5.3,<0.6 | >=1.0.0,<2.0 |
| 0.8.3 | ^0.20.8 | >=0.5.3,<0.6 | >=1.0.0,<2.0 |
Expand Down
6 changes: 6 additions & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: xtensor-julia
channels:
- conda-forge
dependencies:
- cmake
- xtensor=0.24.0
14 changes: 9 additions & 5 deletions include/xtensor-julia/jlarray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace xt
template <class T>
struct xcontainer_inner_types<jlarray<T>>
{
using storage_type = xbuffer_adaptor<jlcxx::mapped_julia_type<T>*>;
using storage_type = xbuffer_adaptor<jlcxx::static_julia_type<T>*>;
using reference = typename storage_type::reference;
using const_reference = typename storage_type::const_reference;
using size_type = typename storage_type::size_type;
Expand Down Expand Up @@ -430,7 +430,7 @@ namespace jlcxx
****************************************************************/

template <class T>
struct ConvertToJulia<xt::jlarray<T>, false, false, false>
struct ConvertToJulia<xt::jlarray<T>>
{
template <class U>
jl_array_t* operator()(U&& arr) const
Expand All @@ -440,7 +440,7 @@ namespace jlcxx
};

template <class T>
struct ConvertToCpp<xt::jlarray<T>, false, false, false>
struct ConvertToCpp<xt::jlarray<T>>
{
xt::jlarray<T> operator()(jl_array_t* arr) const
{
Expand All @@ -452,12 +452,16 @@ namespace jlcxx
struct static_type_mapping<xt::jlarray<T>>
{
using type = jl_array_t*;
static constexpr bool is_dynamic = false;
};

template <class T>
struct julia_type_factory<xt::jlarray<T>>
{
static jl_datatype_t* julia_type()
{
create_if_not_exists<T>();
jl_module_t* current_mod = jlcxx::registry().has_current_module() ? jlcxx::registry().current_module().julia_module() : jl_main_module;
// Array{T}
// Array{T} - dimension is not specified.
return (jl_datatype_t*)apply_type(
jl_get_global(current_mod, jl_symbol("Array")),
jl_svec1(jlcxx::julia_type<T>()));
Expand Down
3 changes: 2 additions & 1 deletion include/xtensor-julia/jlcontainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ namespace xt
template <class T>
inline jl_value_t* make_julia_array_type(std::size_t dimension)
{
return jlcxx::apply_array_type(jlcxx::static_type_mapping<T>::julia_type(), dimension);
jlcxx::create_if_not_exists<T>();
return jlcxx::apply_array_type(jlcxx::julia_type<T>(), dimension);
}
}

Expand Down
Loading

0 comments on commit 10a2ca4

Please sign in to comment.