Skip to content

Commit

Permalink
Update CI (#18)
Browse files Browse the repository at this point in the history
* Update CI.yml

* Update Docs.yml

* Update JuliaNightly.yml

* Simplify docs and remove Manifest file

* Update sinkhorn2 doctest

* Actually fix doctest

* Use example from POT documentation

* Actually use example

* Update lib.jl

* Update lib.jl

* Revert example
  • Loading branch information
devmotion committed May 16, 2022
1 parent 135f45e commit 9afa6af
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 147 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
- main
pull_request:

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ (matrix.python && 'system Python') || 'conda' }}
Expand Down Expand Up @@ -38,9 +44,6 @@ jobs:
python-version: '3.x'
architecture: ${{ matrix.arch }}
if: matrix.python
# Limitation of pip: https://pythonot.github.io/index.html#pip-installation
- run: python -m pip install cython numpy
if: matrix.python
- run: python -m pip install pot
if: matrix.python
- uses: julia-actions/setup-julia@v1
Expand All @@ -67,7 +70,7 @@ jobs:
PYTHON: ${{ matrix.python }}
- uses: julia-actions/julia-processcoverage@v1
if: matrix.coverage
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v2
if: matrix.coverage
with:
file: lcov.info
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/Docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ on:
tags: '*'
pull_request:

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
docs:
name: Documentation
Expand All @@ -16,14 +22,7 @@ jobs:
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- run: |
julia --project=docs -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
env:
PYTHON: ''
- run: julia --project=docs docs/make.jl
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/JuliaNightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ on:
- main
pull_request:

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ (matrix.python && 'system Python') || 'conda' }}
Expand All @@ -35,9 +41,6 @@ jobs:
python-version: '3.x'
architecture: ${{ matrix.arch }}
if: matrix.python
# Limitation of pip: https://pythonot.github.io/index.html#pip-installation
- run: python -m pip install cython numpy
if: matrix.python
- run: python -m pip install pot
if: matrix.python
- uses: julia-actions/setup-julia@v1
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*.jl.*.cov
*.jl.cov
*.jl.mem
/Manifest.toml
/test/Manifest.toml
Manifest.toml
/docs/build/
123 changes: 0 additions & 123 deletions docs/Manifest.toml

This file was deleted.

13 changes: 6 additions & 7 deletions src/lib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,8 @@ julia> ν = [0.0, 1.0];
julia> C = [0.0 1.0; 2.0 0.0; 0.5 1.5];
julia> round.(sinkhorn2(μ, ν, C, 0.01); sigdigits=6)
1-element Vector{Float64}:
0.95
julia> round(sinkhorn2(μ, ν, C, 0.01); sigdigits=6)
0.95
```
It is possible to provide multiple target marginals as columns of a matrix.
Expand Down Expand Up @@ -258,17 +257,17 @@ in the Python Optimal Transport package. Keyword arguments are listed in the doc
# Examples
```jldoctest
julia> xsource = [1];
julia> xsource = [1.0];
julia> xtarget = [2, 3];
julia> xtarget = [2.0, 3.0];
julia> ε = 0.01;
julia> empirical_sinkhorn_divergence(xsource, xtarget, ε) ≈
sinkhorn2([1], [0.5, 0.5], [1 4], ε) -
sinkhorn2([1], [0.5, 0.5], [1.0 4.0], ε) -
(
sinkhorn2([1], [1], zeros(1, 1), ε) +
sinkhorn2([0.5, 0.5], [0.5, 0.5], [0 1; 1 0], ε)
sinkhorn2([0.5, 0.5], [0.5, 0.5], Float64[0 1; 1 0], ε)
) / 2
true
```
Expand Down

0 comments on commit 9afa6af

Please sign in to comment.