Skip to content

Commit

Permalink
Merge pull request #46 from leejm516/develop-julia1.0
Browse files Browse the repository at this point in the history
change codes for julia 1.0+
  • Loading branch information
laurentheirendt authored Sep 12, 2019
2 parents 0de7d5f + 9aab41e commit 3e3558a
Show file tree
Hide file tree
Showing 28 changed files with 231 additions and 249 deletions.
23 changes: 17 additions & 6 deletions .artenolis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,35 @@ script:
# rename the cloned folder
- cd .. && cp -r $NODE_LABELS COBRA && cd COBRA

# change the test dependencies on Linux and macOS (ARTENOLIS)
- if [ "$ARCH" == "Linux" ] || [ "$ARCH" == "macOS" ]; then
perl -i -pe's/test = \["GLPKMathProgInterface", "GLPK", "Test"\]/test = \["GLPKMathProgInterface", "GLPK", "Test", "MAT", "MATLAB", "Gurobi", "CPLEX"\]/g' Project.toml;
fi

# launch the tests
- bash .artenolis/runtests.sh

# clean up the build directory
- cd .. && rm -rf COBRA

# clean up the tmp folder
- rm -rf ~/tmp

after_success:
- if [ "$ARCH" == "Linux" ]; then $ARTENOLIS_SOFT_PATH/julia/$JULIA_VER/bin/julia --color=yes -e 'cd(Pkg.dir("COBRA")); using Coverage; tmp=process_folder(); Codecov.submit(tmp, verbose=false); Coveralls.submit(tmp);'; fi

# submit coverage report
- if [ "$ARCH" == "Linux" && "$JULIA_VER" = "v1.2.0" ]; then
$ARTENOLIS_SOFT_PATH/julia/$JULIA_VER/bin/julia --color=yes -e 'import Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())';
fi

# set environment variables for documentation deployment
- if [[ "$ARCH" == "Linux" && "$JENKINS_PULL_REQUEST" != "True" ]]; then
export TRAVIS_BRANCH=$GIT_BRANCH;
export TRAVIS_PULL_REQUEST=false;
var=$GIT_URL; export TRAVIS_REPO_SLUG=${var:7:${#var}};
export TRAVIS_OS_NAME="linux";
export TRAVIS_OS_NAME=$label;
export TRAVIS_JULIA_VERSION=$JULIA_VER;
$ARTENOLIS_SOFT_PATH/julia/$JULIA_VER/bin/julia --color=yes -e 'cd(Pkg.dir("COBRA")); include(joinpath("docs", "makeDoc.jl"))';
$ARTENOLIS_SOFT_PATH/julia/$JULIA_VER/bin/julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()';
$ARTENOLIS_SOFT_PATH/julia/$JULIA_VER/bin/julia --project=docs/ docs/make.jl;
fi

after_script:
# clean up the build directory
- cd .. && rm -rf COBRA
34 changes: 8 additions & 26 deletions .artenolis/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,21 @@ echo "MATLAB_VER = $MATLAB_VER"

# launch the test script
if [ "$ARCH" == "Linux" ]; then
if [ "$JULIA_VER" == "v0.6.4" ]; then
# remove th julia directory to clean the installation directory
rm -rf $JULIA_PKGDIR/v0.6/COBRA

# add the COBRA module
$ARTENOLIS_SOFT_PATH/julia/$JULIA_VER/bin/julia --color=yes -e 'Pkg.clone(pwd()); cd(Pkg.dir("COBRA")); Pkg.test(pwd(), coverage=true);'

elif [ "$JULIA_VER" == "v0.7.0" ]; then
# add the COBRA module
$ARTENOLIS_SOFT_PATH/julia/$JULIA_VER/bin/julia --color=yes -e 'using Pkg; Pkg.clone(pwd())'
fi
$ARTENOLIS_SOFT_PATH/julia/$JULIA_VER/bin/julia --color=yes -e 'import Pkg; Pkg.clone(pwd()); Pkg.test("COBRA", coverage=true); Pkg.rm("COBRA");'

elif [ "$ARCH" == "macOS" ]; then
# remove th julia directory to clean the installation directory
rm -rf ~/.julia/v0.6/COBRA

caffeinate -u &
/Applications/Julia-$JULIA_VER.app/Contents/Resources/julia/bin/julia --color=yes -e 'Pkg.clone(pwd()); cd(Pkg.dir("COBRA")); Pkg.test(pwd());'
/Applications/Julia-$JULIA_VER.app/Contents/Resources/julia/bin/julia --color=yes -e 'import Pkg; Pkg.clone(pwd()); Pkg.test("COBRA"); Pkg.rm("COBRA");'

elif [ "$ARCH" == "windows" ]; then
if [ "$JULIA_VER" == "v0.6.4" ]; then
# remove th julia directory to clean the installation directory
rm -rf ~/.julia/v0.6/COBRA

unset Path
nohup "$ARTENOLIS_SOFT_PATH\\julia\\$JULIA_VER\\\bin\\julia.exe" --color=yes -e 'import Base; ENV["MATLAB_HOME"]="D:\\MATLAB\\$(ENV["MATLAB_VER"])"; Pkg.clone(pwd()); cd(Pkg.dir("COBRA")); Pkg.test(pwd());' > output.log & PID=$!
unset Path
nohup "$ARTENOLIS_SOFT_PATH\\julia\\$JULIA_VER\\\bin\\julia.exe" --color=yes -e 'import Pkg; Pkg.clone(pwd()); Pkg.test("COBRA"); Pkg.rm("COBRA");' > output.log & PID=$!

# follow the log file
tail -n0 -F --pid=$! output.log 2>/dev/null
# follow the log file
tail -n0 -F --pid=$! output.log 2>/dev/null

# wait until the background process is done
wait $PID
fi
# wait until the background process is done
wait $PID
fi

CODE=$?
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ docs/build/
docs/tutorial/results.mat
results/*
test/testModels

docs/src/tutorials.md
Manifest.toml
docs/src/tutorials.md
19 changes: 1 addition & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ os:
- linux

julia:
- 0.6
- 0.7
- 1.0
- nightly

matrix:
allow_failures:
- julia: 0.7
- julia: nightly

notifications:
Expand All @@ -25,18 +23,3 @@ addons:
- libgmp-dev
- libglpk-dev

git:
depth: 99999

before_install:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi

script:
# update all packages
- julia --color=yes -e 'Pkg.update();'

# temporary addition for julia 0.6 until new version of MAT tagged
- julia --color=yes -e 'Pkg.add("MAT"); Pkg.checkout("MAT")'

# add and test the COBRA module
- julia --color=yes -e 'Pkg.clone(pwd()); Pkg.test("COBRA")'
32 changes: 32 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name = "COBRA"
uuid = "58298e0b-d05c-52ec-a210-0694647ebfc7"
version = "0.3.0"

[deps]
CPLEX = "a076750e-1247-5638-91d2-ce28b192dca0"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
GLPK = "60bf3e95-4087-53dc-ae20-288a0d20c6a6"
GLPKMathProgInterface = "3c7084bd-78ad-589a-b5bb-dbd673274bea"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MAT = "23992714-dd62-5051-b70f-ba57cb901cac"
MathProgBase = "fdba3010-5040-5b88-9595-932c9decdf73"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
HTTP = ">= 0.8.0"
MAT = ">= 0.5.0"
julia = "1"

[extras]
CPLEX = "a076750e-1247-5638-91d2-ce28b192dca0"
GLPK = "60bf3e95-4087-53dc-ae20-288a0d20c6a6"
GLPKMathProgInterface = "3c7084bd-78ad-589a-b5bb-dbd673274bea"
Gurobi = "2e9cd046-0924-5485-92f1-d5272153d98b"
MAT = "23992714-dd62-5051-b70f-ba57cb901cac"
MATLAB = "10e44e05-a98a-55b3-a45b-ba969058deb6"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["GLPKMathProgInterface", "GLPK", "Test"]
4 changes: 0 additions & 4 deletions REQUIRE

This file was deleted.

8 changes: 4 additions & 4 deletions config/sshCfg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@

#-------------------------------------------------------------------------------------------

sshWorkers = Array{Dict{Any, Any}}(3)
sshWorkers = Array{Dict{Any, Any}}(undef, 3)

sshWorkers[1,:] = Dict( "usernode" => "[email protected]",
sshWorkers[1] = Dict( "usernode" => "[email protected]",
"procs" => 8,
"dir" => `"~"/COBRA.jl/`,
"flags" => `-6 -p8022`,
"exename"=> "/usr/bin/julia/bin/./julia")

sshWorkers[2,:] = Dict( "usernode" => "[email protected]",
sshWorkers[2] = Dict( "usernode" => "[email protected]",
"procs" => 16,
"dir" => `"~"/COBRA.jl/`,
"flags" => "-p22",
"exename"=> "/usr/bin/julia/bin/./julia")

sshWorkers[3,:] = Dict( "usernode" => "[email protected]",
sshWorkers[3] = Dict( "usernode" => "[email protected]",
"procs" => 32,
"dir" => `"~"/COBRA.jl/`,
"flags" => "-4 -p9997",
Expand Down
9 changes: 5 additions & 4 deletions src/COBRA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ The documentation is here: http://opencobra.github.io/COBRA.jl
module COBRA

# include the load file to load a model of .mat format
using MAT
using MathProgBase
if sizeof(Pkg.installed("MATLAB")) > 0
import Pkg
using SparseArrays, Distributed, LinearAlgebra
using MAT, MathProgBase
if "MATLAB" in keys(Pkg.installed())
using MATLAB
end

Expand All @@ -30,7 +31,7 @@ module COBRA
include("solve.jl")
include("distributedFBA.jl")
include("tools.jl")
if sizeof(Pkg.installed("MATLAB")) > 0
if "MATLAB" in keys(Pkg.installed())
include("PALM.jl")
end

Expand Down
Loading

0 comments on commit 3e3558a

Please sign in to comment.