Skip to content

Commit a91009c

Browse files
authored
Add GitHub Actions CI workflow (#309)
* Add GitHub Actions CI workflow * Use coverage.jl master * Add CI status badge * Correctly add master of Coverage * Use command that works for julia v1.0 * Use coveralls token * Switch to codecov * Add codecov badge * Schedule nightly CI on master * Try coveralls again * Use github token * Add coveralls upload step * Name job instead of step * Test against more OSes and architectures * Fix name of OS * Don't try 32-bit on MacOS * Fix variable name * Add Nightly CI workflow * Rename nightly workflow * Add comment for cron schedule * Don't put Zero in differential * Increase tolerance for logdet test on 32-bit builds
1 parent f212f0a commit a91009c

File tree

5 files changed

+126
-3
lines changed

5 files changed

+126
-3
lines changed

.github/workflows/CI.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [master]
5+
tags: [v*]
6+
pull_request:
7+
schedule:
8+
- cron: "0 0 * * *" # run on default branch every night at midnight UTC
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.0'
19+
- '1'
20+
os:
21+
- ubuntu-latest
22+
- macOS-latest
23+
- windows-latest
24+
arch:
25+
- x86
26+
- x64
27+
# 32-bit Julia binaries are not available on macOS
28+
exclude:
29+
- os: macOS-latest
30+
arch: x86
31+
steps:
32+
- uses: actions/checkout@v2
33+
- uses: julia-actions/setup-julia@v1
34+
with:
35+
version: ${{ matrix.version }}
36+
arch: ${{ matrix.arch }}
37+
- uses: actions/cache@v1
38+
env:
39+
cache-name: cache-artifacts
40+
with:
41+
path: ~/.julia/artifacts
42+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
43+
restore-keys: |
44+
${{ runner.os }}-test-${{ env.cache-name }}-
45+
${{ runner.os }}-test-
46+
${{ runner.os }}-
47+
- uses: julia-actions/julia-buildpkg@v1
48+
- uses: julia-actions/julia-runtest@v1
49+
- uses: julia-actions/julia-processcoverage@v1
50+
- uses: codecov/codecov-action@v1
51+
with:
52+
file: lcov.info
53+
- uses: coverallsapp/github-action@master
54+
with:
55+
github-token: ${{ secrets.GITHUB_TOKEN }}
56+
flag-name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
57+
parallel: true
58+
path-to-lcov: lcov.info
59+
60+
finish:
61+
name: Coveralls Finished
62+
needs: test
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: coverallsapp/github-action@master
66+
with:
67+
github-token: ${{ secrets.GITHUB_TOKEN }}
68+
parallel-finished: true

.github/workflows/JuliaNightly.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# CI for Julia nightly, separate workflow to avoid failing CI badge on nightly fail
2+
name: JuliaNightly
3+
on:
4+
push:
5+
branches: [master]
6+
tags: [v*]
7+
pull_request:
8+
schedule:
9+
- cron: "0 0 * * *"
10+
11+
jobs:
12+
test:
13+
name: ${{ matrix.os }} - ${{ matrix.arch }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
version:
19+
- 'nightly'
20+
os:
21+
- ubuntu-latest
22+
- macOS-latest
23+
- windows-latest
24+
arch:
25+
- x86
26+
- x64
27+
# 32-bit Julia binaries are not available on macOS
28+
exclude:
29+
- os: macOS-latest
30+
arch: x86
31+
steps:
32+
- uses: actions/checkout@v2
33+
- uses: julia-actions/setup-julia@v1
34+
with:
35+
version: ${{ matrix.version }}
36+
arch: ${{ matrix.arch }}
37+
- uses: actions/cache@v1
38+
env:
39+
cache-name: cache-artifacts
40+
with:
41+
path: ~/.julia/artifacts
42+
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
43+
restore-keys: |
44+
${{ runner.os }}-test-${{ env.cache-name }}-
45+
${{ runner.os }}-test-
46+
${{ runner.os }}-
47+
- uses: julia-actions/julia-buildpkg@v1
48+
- uses: julia-actions/julia-runtest@v1

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
# ChainRules
44

5+
[![CI](https://github.com/JuliaDiff/ChainRules.jl/workflows/CI/badge.svg?branch=master)](https://github.com/JuliaDiff/ChainRules.jl/actions?query=workflow%3ACI)
56
[![Travis](https://travis-ci.org/JuliaDiff/ChainRules.jl.svg?branch=master)](https://travis-ci.org/JuliaDiff/ChainRules.jl)
7+
[![Codecov](https://codecov.io/gh/JuliaDiff/ChainRules.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaDiff/ChainRules.jl)
68
[![Coveralls](https://coveralls.io/repos/github/JuliaDiff/ChainRules.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaDiff/ChainRules.jl?branch=master)
79
[![PkgEval](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/C/ChainRules.svg)](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/report.html)
810
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)

test/rulesets/LinearAlgebra/dense.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,15 @@
105105
test_scalar(f, b)
106106
end
107107
@testset "$f(::Matrix{$T})" for T in (Float64, ComplexF64)
108+
if f === logdet && float(T) <: Float32
109+
kwargs = (atol=1e-5, rtol=1e-5)
110+
else
111+
kwargs = NamedTuple()
112+
end
108113
N = 3
109114
B = generate_well_conditioned_matrix(T, N)
110-
frule_test(f, (B, randn(T, N, N)))
111-
rrule_test(f, randn(T), (B, randn(T, N, N)))
115+
frule_test(f, (B, randn(T, N, N)); kwargs...)
116+
rrule_test(f, randn(T), (B, randn(T, N, N)); kwargs...)
112117
end
113118
end
114119
@testset "logabsdet(::Matrix{$T})" for T in (Float64, ComplexF64)

test/rulesets/packages/SpecialFunctions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ end
5050
isreal(x) || continue
5151

5252
Δx, x̄ = randn(2)
53-
Δz = Composite{Tuple{Float64, DoesNotExist}}(randn(), Zero())
53+
Δz = Composite{Tuple{Float64, DoesNotExist}}(randn(), randn())
5454

5555
frule_test(SpecialFunctions.logabsgamma, (x, Δx))
5656
rrule_test(SpecialFunctions.logabsgamma, Δz, (x, x̄))

0 commit comments

Comments
 (0)