Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 19 additions & 43 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- 'master'
- 'release-'
- 'release-*'
tags: '*'
pull_request:

Expand All @@ -22,58 +22,43 @@ jobs:
fail-fast: false
matrix:
julia-version:
- '1.6' # current LTS
- lts
- 1 # latest stable release
#- 'nightly'
os:
- ubuntu-latest
include:
# Add a few windows and macOS jobs (not too many, the number we can run in parallel is limited)
- julia-version: '1.6'
- julia-version: lts
os: macOS-latest
#- julia-version: '1.6'
#- julia-version: ls
# os: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
with:
# For Codecov, we must also fetch the parent of the HEAD commit to
# be able to properly deal with PRs / merges
fetch-depth: 2

- name: "Set up Julia"
uses: julia-actions/setup-julia@v1
uses: julia-actions/setup-julia@v3
with:
version: ${{ matrix.julia-version }}

- name: "Cache artifacts"
uses: actions/cache@v3
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-

uses: julia-actions/cache@v3
# Setup ccache, to speed up repeated compilation of the same binaries
- name: "Setup ccache"
uses: Chocobo1/setup-ccache-action@v1
with:
update_packager_index: false

- name: "Build package"
uses: julia-actions/julia-buildpkg@latest

uses: julia-actions/julia-buildpkg@v1
- name: "Run tests"
uses: julia-actions/julia-runtest@latest
uses: julia-actions/julia-runtest@v1
with:
depwarn: error

- name: "Run doctests"
if: ${{ matrix.julia-version == '1.6' }}
if: ${{ matrix.julia-version == '1.10' }}
run: |
julia --project=docs --color=yes --code-coverage -e '
using Pkg
Expand All @@ -84,34 +69,25 @@ jobs:
doctest(Normaliz)'

- name: "Process code coverage"
continue-on-error: true
uses: julia-actions/julia-processcoverage@v1

- name: "Upload coverage data to Codecov"
continue-on-error: true
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}

docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v3
with:
version: '1.6'
- name: Cache artifacts
uses: actions/cache@v3
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
version: '1.10'
- name: "Cache artifacts"
uses: julia-actions/cache@v3
- name: "Build package"
uses: julia-actions/julia-buildpkg@latest
uses: julia-actions/julia-buildpkg@v1
- run: |
julia --project=docs --color=yes -e '
using Pkg
Expand Down
9 changes: 4 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
normaliz_jll = "6690c6e9-4e12-53b8-b8fd-4bffaef8839f"

[compat]
julia = "1.6"
CxxWrap = "0.14"
Libdl = "1.6"
Pkg = "1.6"

julia = "1.10"
CxxWrap = "0.17"
Libdl = "1.10"
Pkg = "1.10"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
17 changes: 7 additions & 10 deletions deps/src/normaliz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,20 @@ to_normaliz_matrix(jl_value_t* input_dict)
}
jl_array_t* keys =
reinterpret_cast<jl_array_t*>(jl_get_field(input_dict, "keys"));
jl_array_t* value =
jl_array_t* vals =
reinterpret_cast<jl_array_t*>(jl_get_field(input_dict, "vals"));
size_t len = jl_array_len(keys);
std::map<libnormaliz::Type::InputType, Matrix<T>> input_map;

jl_sym_t* * keys_data = jlcxx::jlcxx_array_data<jl_sym_t*>(keys);
Matrix<T>* * vals_data = jlcxx::jlcxx_array_data<Matrix<T>*>(vals);
for (size_t i = 0; i < len; i++) {
if (!jl_array_isassigned(keys, i)) {
if (!keys_data[i]) {
continue;
}
// We assume the matrix has the right type
Matrix<T>* mat = reinterpret_cast<Matrix<T>*>(
*reinterpret_cast<void**>(jl_arrayref(value, i)));
std::string key(jl_symbol_name(
reinterpret_cast<jl_sym_t*>(jl_arrayref(keys, i))));
Matrix<T>* mat = vals_data[i];
std::string key(jl_symbol_name(keys_data[i]));
input_map[libnormaliz::to_type(key)] = Matrix<T>(*mat);
}
return input_map;
Expand All @@ -74,14 +75,10 @@ JLCXX_MODULE define_module_normaliz(jlcxx::Module& normaliz)
.constructor<long>()
.method("to_string", [](mpz_class& i) { return i.get_str(); });

jlcxx::stl::apply_stl<mpz_class>(normaliz);

normaliz.add_type<mpq_class>("NmzRational")
.constructor<long, long>()
.method("to_string", [](mpq_class& i) { return i.get_str(); });

jlcxx::stl::apply_stl<mpq_class>(normaliz);

#ifdef ENFNORMALIZ
normaliz.add_type<renf_class>("RenfClass")
#if 0
Expand Down
Loading