Skip to content

Commit f692dd9

Browse files
authored
migrate CI to GitHub Actions (JuliaML#64)
* migrate CI to GitHub Actions * fix jl version * CI * refine runtests.jl * remove appveyor
1 parent 9764360 commit f692dd9

File tree

7 files changed

+179
-116
lines changed

7 files changed

+179
-116
lines changed

.github/workflows/CI.yml

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: CI
2+
3+
# Run on master, tags, or any pull request
4+
on:
5+
push:
6+
branches: [master]
7+
tags: ["*"]
8+
pull_request:
9+
10+
jobs:
11+
test:
12+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
version:
18+
- '1.3'
19+
- '1.4'
20+
- '1' # Latest Release
21+
os:
22+
- ubuntu-latest
23+
- windows-latest
24+
- macos-latest
25+
arch:
26+
- x64
27+
28+
steps:
29+
- uses: actions/checkout@v2
30+
- uses: julia-actions/setup-julia@v1
31+
with:
32+
version: ${{ matrix.version }}
33+
arch: ${{ matrix.arch }}
34+
- uses: actions/cache@v1
35+
env:
36+
cache-name: cache-artifacts
37+
with:
38+
path: ~/.julia/artifacts
39+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
40+
restore-keys: |
41+
${{ runner.os }}-test-${{ env.cache-name }}-
42+
${{ runner.os }}-test-
43+
${{ runner.os }}-
44+
- uses: julia-actions/julia-buildpkg@latest
45+
- run: |
46+
git config --global user.name Tester
47+
git config --global user.email [email protected]
48+
- uses: julia-actions/julia-runtest@latest
49+
- uses: julia-actions/julia-processcoverage@v1
50+
- uses: codecov/codecov-action@v1
51+
with:
52+
file: lcov.info
53+
54+
# ATM, we only have README
55+
#
56+
# docs:
57+
# name: Documentation
58+
# runs-on: ubuntu-latest
59+
# steps:
60+
# - uses: actions/checkout@v2
61+
# - uses: julia-actions/setup-julia@v1
62+
# with:
63+
# version: '1'
64+
# - run: |
65+
# git config --global user.name name
66+
# git config --global user.email email
67+
# git config --global github.user username
68+
# - run: |
69+
# julia --project=docs -e '
70+
# using Pkg;
71+
# Pkg.develop(PackageSpec(path=pwd()));
72+
# Pkg.instantiate();'
73+
# - run: |
74+
# julia --project=docs -e '
75+
# using Documenter: doctest
76+
# using TimeSeries
77+
# doctest(TimeSeries)'
78+
# - run: julia --project=docs docs/make.jl
79+
# env:
80+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/CompatHelper.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: CompatHelper
2+
3+
on:
4+
schedule:
5+
- cron: '00 00 * * *'
6+
7+
jobs:
8+
CompatHelper:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: julia-actions/setup-julia@latest
12+
- name: Pkg.add("CompatHelper")
13+
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
14+
- name: CompatHelper.main()
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
run: julia -e 'using CompatHelper; CompatHelper.main()'

.github/workflows/TagBot.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: TagBot
2+
on:
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
7+
jobs:
8+
TagBot:
9+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: JuliaRegistries/TagBot@v1
13+
with:
14+
token: ${{ secrets.GITHUB_TOKEN }}

.travis.yml

-17
This file was deleted.

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# LIBSVM.jl
22

3-
[![Build Status](https://travis-ci.org/mpastell/LIBSVM.jl.svg?branch=master)](https://travis-ci.org/mpastell/LIBSVM.jl)
4-
[![Build status](https://ci.appveyor.com/api/projects/status/1v8jpbiy1o7mpi6q/branch/master?svg=true)](https://ci.appveyor.com/project/mpastell/libsvm-jl/branch/master)
5-
[![Coverage Status](https://coveralls.io/repos/github/mpastell/LIBSVM.jl/badge.svg?branch=master)](https://coveralls.io/github/mpastell/LIBSVM.jl?branch=master)
3+
[![Build Status](https://github.com/JuliaML/LIBSVM.jl/workflows/CI/badge.svg)](https://github.com/JuliaML/LIBSVM.jl/actions?query=workflow%3ACI)
4+
[![Coverage Status](https://coveralls.io/repos/github/JuliaML/LIBSVM.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaML/LIBSVM.jl?branch=master)
65

76
This is a Julia interface for [LIBSVM](http://www.csie.ntu.edu.tw/~cjlin/libsvm/).
87

appveyor.yml

-42
This file was deleted.

test/runtests.jl

+66-54
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,79 @@
1-
using LIBSVM, Test
21
using DelimitedFiles
2+
using LIBSVM
33
using SparseArrays
4+
using Test
45

5-
iris = readdlm(joinpath(dirname(@__FILE__), "iris.csv"), ',')
6-
labels = iris[:, 5]
7-
instances = convert(Matrix{Float64}, iris[:, 1:4]')
8-
model = svmtrain(instances[:, 1:2:end], labels[1:2:end]; verbose=true)
9-
GC.gc()
10-
(class, decvalues) = svmpredict(model, instances[:, 2:2:end])
11-
correct = Bool[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]
12-
@test (class .== labels[2:2:end]) == correct
6+
@testset "LibSVM" begin
137

14-
skmodel = fit!(SVC(), instances[:,1:2:end]', labels[1:2:end])
15-
skclass = predict(skmodel, instances[:, 2:2:end]')
16-
@test skclass == class
178

18-
model = svmtrain(sparse(instances[:, 1:2:end]), labels[1:2:end]; verbose=true)
19-
GC.gc()
20-
(class, decvalues) = svmpredict(model, sparse(instances[:, 2:2:end]))
21-
correct = Bool[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]
22-
@test (class .== labels[2:2:end]) == correct
9+
@testset "IRIS" begin
10+
iris = readdlm(joinpath(@__DIR__, "iris.csv"), ',')
11+
labels = iris[:, 5]
2312

24-
#Regression tests, results confirmed using e1071 R-package
25-
#whiteside = RDatasets.dataset("MASS", "whiteside")
26-
whiteside, hdr = readdlm(joinpath(dirname(@__FILE__), "whiteside.csv"), ',', header=true)
27-
ws = convert(Matrix{Float64}, whiteside[:,2:3])
28-
X = Array{Float64, 2}(ws[:, 2]')
29-
y = ws[:, 1]
13+
instances = convert(Matrix{Float64}, iris[:, 1:4]')
14+
model = svmtrain(instances[:, 1:2:end], labels[1:2:end]; verbose = true)
15+
GC.gc()
16+
(class, decvalues) = svmpredict(model, instances[:, 2:2:end])
17+
correct = Bool[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]
18+
@test (class .== labels[2:2:end]) == correct
3019

31-
m = svmtrain(X, y, svmtype = EpsilonSVR, cost = 10., gamma = 1.)
32-
yeps, d = svmpredict(m, X)
33-
@test sum(yeps - y) 7.455509045783046
34-
skm = fit!(EpsilonSVR(cost = 10., gamma = 1.), X', y)
35-
ysk = predict(skm, X')
36-
@test isapprox(yeps,ysk)
20+
skmodel = fit!(SVC(), instances[:,1:2:end]', labels[1:2:end])
21+
skclass = predict(skmodel, instances[:, 2:2:end]')
22+
@test skclass == class
23+
model = svmtrain(sparse(instances[:, 1:2:end]), labels[1:2:end]; verbose=true)
24+
GC.gc()
25+
(class, decvalues) = svmpredict(model, sparse(instances[:, 2:2:end]))
26+
correct = Bool[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1]
27+
@test (class .== labels[2:2:end]) == correct
28+
end
3729

38-
nu1 = svmtrain(X, y, svmtype = NuSVR, cost = 10.,
39-
nu = .7, gamma = 2., tolerance = .001)
40-
ynu1, d = svmpredict(nu1, X)
41-
@test sum(ynu1 - y) 14.184665717092
42-
sknu1 = fit!(NuSVR(cost = 10., nu=.7, gamma = 2.), X', y)
43-
ysknu1 = predict(sknu1, X')
44-
@test isapprox(ysknu1,ynu1)
4530

46-
nu2 = svmtrain(X, y, svmtype = NuSVR, cost = 10., nu = .9)
47-
ynu2, d =svmpredict(nu2, X)
48-
@test sum(ynu2 - y) 6.686819661799177
49-
sknu2 = fit!(NuSVR(cost = 10., nu=.9), X', y)
50-
ysknu2 = predict(sknu2, X')
51-
@test isapprox(ysknu2,ynu2)
31+
@testset "Whiteside" begin
32+
#Regression tests, results confirmed using e1071 R-package
33+
#whiteside = RDatasets.dataset("MASS", "whiteside")
34+
whiteside, hdr = readdlm(joinpath(@__DIR__, "whiteside.csv"), ',', header=true)
35+
ws = convert(Matrix{Float64}, whiteside[:,2:3])
36+
X = Array{Float64, 2}(ws[:, 2]')
37+
y = ws[:, 1]
5238

53-
# Multithreading testing
39+
m = svmtrain(X, y, svmtype = EpsilonSVR, cost = 10., gamma = 1.)
40+
yeps, d = svmpredict(m, X)
41+
@test sum(yeps - y) 7.455509045783046
42+
skm = fit!(EpsilonSVR(cost = 10., gamma = 1.), X', y)
43+
ysk = predict(skm, X')
44+
@test isapprox(yeps,ysk)
5445

55-
# Assign by maximum number of threads
56-
ntnu1 = svmtrain(X, y, svmtype = NuSVR, cost = 10.,
57-
nu = .7, gamma = 2., tolerance = .001,
58-
nt = -1)
59-
ntynu1, ntd = svmpredict(ntnu1, X)
60-
@test sum(ntynu1 - y) 14.184665717092
46+
nu1 = svmtrain(X, y, svmtype = NuSVR, cost = 10.,
47+
nu = .7, gamma = 2., tolerance = .001)
48+
ynu1, d = svmpredict(nu1, X)
49+
@test sum(ynu1 - y) 14.184665717092
50+
sknu1 = fit!(NuSVR(cost = 10., nu=.7, gamma = 2.), X', y)
51+
ysknu1 = predict(sknu1, X')
52+
@test isapprox(ysknu1,ynu1)
6153

62-
# Assign by environment
63-
ENV["OMP_NUM_THREADS"] = 2
54+
nu2 = svmtrain(X, y, svmtype = NuSVR, cost = 10., nu = .9)
55+
ynu2, d =svmpredict(nu2, X)
56+
@test sum(ynu2 - y) 6.686819661799177
57+
sknu2 = fit!(NuSVR(cost = 10., nu=.9), X', y)
58+
ysknu2 = predict(sknu2, X')
59+
@test isapprox(ysknu2, ynu2)
6460

65-
ntm = svmtrain(X, y, svmtype = EpsilonSVR, cost = 10., gamma = 1.)
66-
ntyeps, ntd = svmpredict(m, X)
67-
@test sum(ntyeps - y) 7.455509045783046
61+
@testset "Multithreading" begin
62+
# Assign by maximum number of threads
63+
ntnu1 = svmtrain(X, y, svmtype = NuSVR, cost = 10.,
64+
nu = .7, gamma = 2., tolerance = .001,
65+
nt = -1)
66+
ntynu1, ntd = svmpredict(ntnu1, X)
67+
@test sum(ntynu1 - y) 14.184665717092
68+
69+
# Assign by environment
70+
ENV["OMP_NUM_THREADS"] = 2
71+
72+
ntm = svmtrain(X, y, svmtype = EpsilonSVR, cost = 10., gamma = 1.)
73+
ntyeps, ntd = svmpredict(m, X)
74+
@test sum(ntyeps - y) 7.455509045783046
75+
end
76+
end
77+
78+
79+
end # @testset "LIBSVM"

0 commit comments

Comments
 (0)