Skip to content

Commit c8d5950

Browse files
authored
Update CI to Github Actions (#118)
1 parent 568d463 commit c8d5950

File tree

15 files changed

+278
-167
lines changed

15 files changed

+278
-167
lines changed

.github/workflows/TagBot.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
name: TagBot
22
on:
3-
schedule:
4-
- cron: 0 * * * *
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
57
jobs:
68
TagBot:
9+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
710
runs-on: ubuntu-latest
811
steps:
912
- uses: JuliaRegistries/TagBot@v1

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
jobs:
8+
test:
9+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
version: ['1.0', '1'] # Test against LTS and current minor release
15+
os: [ubuntu-latest]
16+
arch: [x64]
17+
include:
18+
# Also test against 32-bit Linux on LTS.
19+
- version: '1.0'
20+
os: ubuntu-latest
21+
arch: x86
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: julia-actions/setup-julia@v1
25+
with:
26+
version: ${{ matrix.version }}
27+
arch: ${{ matrix.arch }}
28+
- uses: actions/cache@v1
29+
env:
30+
cache-name: cache-artifacts
31+
with:
32+
path: ~/.julia/artifacts
33+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
34+
restore-keys: |
35+
${{ runner.os }}-test-${{ env.cache-name }}-
36+
${{ runner.os }}-test-
37+
${{ runner.os }}-
38+
- uses: julia-actions/julia-buildpkg@v1
39+
- uses: julia-actions/julia-runtest@v1
40+
- uses: julia-actions/julia-processcoverage@v1
41+
- uses: codecov/codecov-action@v1
42+
with:
43+
file: lcov.info

.github/workflows/minlptests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: MINLPTests
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
jobs:
8+
test:
9+
name: Julia ${{ github.event_name }}
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: julia-actions/setup-julia@v1
14+
with:
15+
version: '1'
16+
arch: x64
17+
- uses: actions/cache@v1
18+
env:
19+
cache-name: cache-artifacts
20+
with:
21+
path: ~/.julia/artifacts
22+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
23+
restore-keys: |
24+
${{ runner.os }}-test-${{ env.cache-name }}-
25+
${{ runner.os }}-test-
26+
${{ runner.os }}-
27+
- uses: julia-actions/julia-buildpkg@v1
28+
- name:
29+
shell: julia --color=yes {0}
30+
run: |
31+
amplnlwriter = ENV["GITHUB_WORKSPACE"]
32+
path = joinpath(amplnlwriter, "test", "MINLPTests")
33+
cd(path)
34+
using Pkg
35+
Pkg.activate(".")
36+
Pkg.instantiate()
37+
Pkg.add(PackageSpec(path=amplnlwriter))
38+
include(joinpath(path, "run_minlptests.jl"))

.travis.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
99

1010
[compat]
1111
Ipopt = "0.6"
12+
Ipopt_jll = "=3.13.2"
1213
MathOptInterface = "0.9.13"
1314
MathProgBase = "~0.5.0, ~0.6, ~0.7"
1415
julia = "1"
1516

1617
[extras]
1718
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
19+
Ipopt_jll = "9cc047cb-c261-5740-88fc-0cf96f7bdcc7"
1820
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1921

2022
[targets]
21-
test = ["Test", "Ipopt"]
23+
test = ["Test", "Ipopt", "Ipopt_jll"]

README.md

Lines changed: 67 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,78 @@
11
# AmplNLWriter.jl
22

3-
| **Build Status (Linux, OSX)** | **Build Status (Windows)** | **Coverage** |
4-
|:-----------------:|:--------------------:|:----------------:|
5-
| [![][build-img]][build-url] | [![Build Status][app-build-img]][app-build-url] | [![Codecov branch][codecov-img]][codecov-url]
6-
7-
[build-img]: https://travis-ci.org/jump-dev/AmplNLWriter.jl.svg?branch=master
8-
[build-url]: https://travis-ci.org/jump-dev/AmplNLWriter.jl
9-
10-
[app-build-img]: https://ci.appveyor.com/api/projects/status/wuf0bmk28wm2dym1?svg=true
11-
[app-build-url]: https://ci.appveyor.com/project/JuliaOpt/amplnlwriter-jl/branch/master
12-
13-
[codecov-img]: https://codecov.io/github/jump-dev/AmplNLWriter.jl/coverage.svg?branch=master
14-
[codecov-url]: https://codecov.io/github/jump-dev/AmplNLWriter.jl?branch=master
15-
16-
This [Julia](https://github.com/JuliaLang/julia) package is an interface between [MathOptInterface.jl](https://github.com/jump-dev/MathOptInterface.jl) and [AMPL-enabled](http://www.ampl.com) [solvers](http://ampl.com/products/solvers/all-solvers-for-ampl/). It is similar in nature to [CoinOptServices.jl](https://github.com/tkelman/CoinOptServices.jl), but instead uses AMPL's low-level [.nl](https://en.wikipedia.org/wiki/Nl_%28format%29) file format.
3+
This [Julia](https://github.com/JuliaLang/julia) package is an interface between
4+
[MathOptInterface.jl](https://github.com/jump-dev/MathOptInterface.jl) and
5+
[AMPL-enabled solvers](http://ampl.com/products/solvers/all-solvers-for-ampl/).
176

187
A list of AMPL-enabled solvers is available [here](http://ampl.com/products/solvers/all-solvers-for-ampl/).
198

209
*Development of AmplNLWriter.jl is community driven and has no official connection with the AMPL modeling language or AMPL Optimization Inc.*
2110

11+
[![Build Status](https://github.com/jump-dev/AmplNLWriter.jl/workflows/CI/badge.svg?branch=master)](https://github.com/jump-dev/AmplNLWriter.jl/actions?query=workflow%3ACI)
12+
[![codecov](https://codecov.io/gh/jump-dev/AmplNLWriter.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/jump-dev/AmplNLWriter.jl)
13+
2214
## Installation
2315

24-
AmplNLWriter.jl can be installed using the Julia package manager with the following command:
16+
AmplNLWriter.jl can be installed using the Julia package manager with the
17+
following command:
2518

2619
```julia
20+
import Pkg
2721
Pkg.add("AmplNLWriter")
2822
```
2923

3024
## Usage
3125

32-
AmplNLWriter.jl provides ``AmplNLWriter.Optimizer`` as a usable solver in JuMP. The following Julia code uses the Bonmin solver in JuMP via AmplNLWriter.jl:
26+
AmplNLWriter.jl provides `AmplNLWriter.Optimizer` as a usable solver in JuMP.
27+
The following Julia code uses the Bonmin solver in JuMP via AmplNLWriter.jl:
28+
29+
```julia
30+
using JuMP, AmplNLWriter
31+
model = Model(() -> AmplNLWriter.Optimizer("bonmin"))
32+
```
33+
34+
You can then model and solve your optimization problem as usual. See
35+
[JuMP.jl](https://github.com/jump-dev/JuMP.jl/blob/master/README.md) for more
36+
details.
37+
38+
The `AmplNLWriter.Optimizer()` constructor requires as the first argument the
39+
name of the solver command needed to run the desired solver.
3340

34-
julia> using JuMP, AmplNLWriter
35-
julia> m = Model(() -> AmplNLWriter.Optimizer("bonmin"))
41+
For example, if the `bonmin` executable is on the system path, you can use
42+
this solver using `AmplNLWriter.Optimizer("bonmin")`. If the solver is not on
43+
the path, the full path to the solver will need to be passed in. This solver
44+
executable must be an AMPL-compatible solver.
3645

37-
You can then model and solve your optimization problem as usual. See [JuMP.jl](https://github.com/jump-dev/JuMP.jl/blob/master/README.md) for more details.
46+
The second (optional) argument to `AmplNLWriter.Optimizer()` is a
47+
`Vector{String}` of solver options. These options are appended to the solve
48+
command separated by spaces, and the required format depends on the solver that
49+
you are using. Generally, they will be of the form `"key=value"`, where `key` is
50+
the name of the option to set and `value` is the desired value.
3851

39-
The ``AmplNLWriter.Optimizer()`` constructor requires as the first argument the name of the solver command needed to run the desired solver. For example, if the ``bonmin`` executable is on the system path, you can use this solver using ``AmplNLWriter.Optimizer("bonmin")``. If the solver is not on the path, the full path to the solver will need to be passed in. This solver executable must be an AMPL-compatible solver.
52+
For example, to set the NLP log level to 0 in Bonmin, you would run
53+
`AmplNLWriter.Optimizer("bonmin", ["bonmin.nlp_log_level=0"])`.
4054

41-
The second (optional) argument to ``AmplNLWriter.Optimizer()`` is a ``Vector{ASCIIString}`` of solver options. These options are appended to the solve command separated by spaces, and the required format depends on the solver that you are using. Generally, they will be of the form ``"key=value"``, where ``key`` is the name of the option to set and ``value`` is the desired value. For example, to set the NLP log level to 0 in Bonmin, you would run ``AmplNLWriter.Optimizer("bonmin", ["bonmin.nlp_log_level=0"])``. For a list of options supported by your solver, check the solver's documentation, or run ``/path/to/solver -=`` at the command line e.g. run ``bonmin -=`` for a list of all Bonmin options.
55+
For a list of options supported by your solver, check the solver's
56+
documentation, or run `/path/to/solver -=` at the command line, e.g., run
57+
`bonmin -=` for a list of all Bonmin options.
4258

43-
Note that some of the options don't seem to take effect when specified using the command-line options (especially for Couenne), and instead you need to use an ``.opt`` file. The ``.opt`` file takes the name of the solver, e.g. ``bonmin.opt``, and each line of this file contains an option name and the desired value separated by a space. For instance, to set the absolute and relative tolerances in Couenne to 1 and 0.05 respectively, the ``couenne.opt`` file should be
59+
Note that some of the options don't seem to take effect when specified using the
60+
command-line options (especially for Couenne), and instead you need to use an
61+
`.opt` file.
4462

63+
The `.opt` file takes the name of the solver, e.g. `bonmin.opt`, and each line
64+
of this file contains an option name and the desired value separated by a space.
65+
For instance, to set the absolute and relative tolerances in Couenne to 1 and
66+
0.05 respectively, the `couenne.opt` file should be
4567
```
4668
allowable_gap 1
4769
allowable_fraction_gap 0.05
4870
```
4971

50-
In order for the options to be loaded, this file must be located in the current working directory whenever the model is solved.
72+
In order for the options to be loaded, this file must be located in the current
73+
working directory whenever the model is solved.
5174

52-
A list of available options for the respective ``.opt`` files can be found here:
75+
A list of available options for the respective `.opt` files can be found here:
5376

5477
- [Ipopt](http://www.coin-or.org/Ipopt/documentation/node39.html#app.options_ref)
5578
- [Bonmin](https://github.com/coin-or/Bonmin/blob/master/Bonmin/test/bonmin.opt) (plus Ipopt options)
@@ -59,21 +82,32 @@ A list of available options for the respective ``.opt`` files can be found here:
5982

6083
### Bonmin/Couenne/Ipopt
6184

62-
**NOTE: AmplNLWriter v0.4.0 introduced a breaking change by removing `BonminNLSolver`, `CouenneNLSolver`, and `IpoptNLSolver`. Users are now expected
85+
**NOTE: AmplNLWriter v0.4.0 introduced a breaking change by removing
86+
`BonminNLSolver`, `CouenneNLSolver`, and `IpoptNLSolver`. Users are now expected
6387
to pass the path of the solver executable to `AmplNLWriter.Optimizer`.**
6488

65-
The easiest way to obtain a solver executable for Bonmin, Couenne, or Ipopt is to download one from [AMPL](https://ampl.com/products/solvers/open-source/).
89+
The easiest way to obtain a solver executable for Bonmin, Couenne, or Ipopt is
90+
to download one from [AMPL](https://ampl.com/products/solvers/open-source/).
6691

6792
### SCIP
6893

69-
To use SCIP with AmplNLWriter.jl, you must first compile the ``scipampl`` binary which is a version of SCIP with support for the AMPL .nl interface. To do this, you can follow the instructions [here](http://zverovich.net/2012/08/07/using-scip-with-ampl.html), which we have tested on OS X and Linux.
94+
To use SCIP with AmplNLWriter.jl, you must first compile the `scipampl` binary
95+
which is a version of SCIP with support for the AMPL .nl interface. To do this,
96+
you can follow the instructions [here](http://zverovich.net/2012/08/07/using-scip-with-ampl.html),
97+
which we have tested on OS X and Linux.
7098

71-
After doing this, you can access SCIP through ``AmplNLWriter.Optimizer("/path/to/scipampl")``. Options can be specified for SCIP using a ``scip.set`` file, where each line is of the form ``key = value``. For example, the following `scip.set` file will set the verbosity level to 0:
72-
73-
display/verblevel = 0
99+
After doing this, you can access SCIP through
100+
`AmplNLWriter.Optimizer("/path/to/scipampl")`. Options can be specified for SCIP
101+
using a `scip.set` file, where each line is of the form `key = value`. For
102+
example, the following `scip.set` file will set the verbosity level to 0:
103+
```
104+
display/verblevel = 0
105+
```
74106

75107
A list of valid options for the file can be found [here](http://plato.asu.edu/milp/scip.set).
76108

77-
To use the ``scip.set`` file, you must pass the path to the ``scip.set`` file as the first (and only) option to the solver:
78-
79-
AmplNLWriter.Optimizer("/path/to/scipampl", ["/path/to/scip.set"])
109+
To use the `scip.set` file, you must pass the path to the `scip.set` file as the
110+
first (and only) option to the solver:
111+
```julia
112+
AmplNLWriter.Optimizer("/path/to/scipampl", ["/path/to/scip.set"])
113+
```

appveyor.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

test/MINLPTests/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
[deps]
22
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
3+
Ipopt_jll = "9cc047cb-c261-5740-88fc-0cf96f7bdcc7"
34
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
45
MINLPTests = "ee0a3090-8ee9-5cdb-b8cb-8eeba3165522"
56
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
67

78
[compat]
89
Ipopt = "0.6"
10+
Ipopt_jll = "=3.13.2"
911
JuMP = "0.21"
1012
MINLPTests = "0.5"
1113
julia = "1"

test/MINLPTests/run_minlptests.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import AmplNLWriter
2-
import Ipopt
32
import MINLPTests
4-
53
using Test
64

7-
const OPTIMIZER = () -> AmplNLWriter.Optimizer(Ipopt.amplexe, ["print_level=0"])
5+
if VERSION < v"1.3"
6+
import Ipopt
7+
run_with_ampl(f) = f(Ipopt.amplexe)
8+
else
9+
import Ipopt_jll
10+
run_with_ampl(f) = Ipopt_jll.amplexe(f)
11+
end
812

9-
@testset "MINLPTests" begin
13+
run_with_ampl() do path
14+
OPTIMIZER = () -> AmplNLWriter.Optimizer(path, ["print_level=0"])
1015
###
1116
### src/nlp tests.
1217
###

0 commit comments

Comments
 (0)