Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI setup, add dependabot, and update Julia compat to 1.10 #87

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
43 changes: 19 additions & 24 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# from https://discourse.julialang.org/t/easy-workflow-file-for-setting-up-github-actions-ci-for-your-julia-package/49765

name: CI

on:
pull_request:
branches:
Expand All @@ -9,49 +8,45 @@ on:
branches:
- master
tags: '*'

# needed to allow julia-actions/cache to delete old caches that it has created
permissions:
actions: write
contents: read

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.0' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
- 'nightly'
- 'min'
- '1'
- 'pre'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v5
with:
file: lcov.info
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- run: |
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ChangesOfVariables = "0.1"
DocStringExtensions = "0.8, 0.9"
InverseFunctions = "0.1"
IrrationalConstants = "0.1, 0.2"
julia = "1"
julia = "1.10"

[extras]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
10 changes: 0 additions & 10 deletions src/LogExpFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ export xlogx, xlogy, xlog1py, xexpx, xexpy, logistic, logit, log1psq, log1pexp,
softmax!, logcosh, logabssinh, cloglog, cexpexp,
loglogistic, logitexp, log1mlogistic, logit1mexp

# expm1(::Float16) is not defined in older Julia versions,
# hence for better Float16 support we use an internal function instead
# https://github.com/JuliaLang/julia/pull/40867
if VERSION < v"1.7.0-DEV.1172"
_expm1(x) = expm1(x)
_expm1(x::Float16) = Float16(expm1(Float32(x)))
else
const _expm1 = expm1
end

include("basicfuns.jl")
include("logsumexp.jl")

Expand Down
8 changes: 4 additions & 4 deletions src/basicfuns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function log1mexp(x::Real)
if x < oftype(float(x), IrrationalConstants.loghalf)
return log1p(-exp(x))
else
return log(-_expm1(x))
return log(-expm1(x))
end
end

Expand All @@ -246,15 +246,15 @@ $(SIGNATURES)

Return `log(2 - exp(x))` evaluated as `log1p(-expm1(x))`
"""
log2mexp(x::Real) = log1p(-_expm1(x))
log2mexp(x::Real) = log1p(-expm1(x))

"""
$(SIGNATURES)

Return `log(exp(x) - 1)` or the “invsoftplus” function. It is the inverse of
[`log1pexp`](@ref) (aka “softplus”).
"""
logexpm1(x::Real) = x <= 18.0 ? log(_expm1(x)) : x <= 33.3 ? x - exp(-x) : oftype(exp(-x), x)
logexpm1(x::Real) = x <= 18.0 ? log(expm1(x)) : x <= 33.3 ? x - exp(-x) : oftype(exp(-x), x)
logexpm1(x::Float32) = x <= 9f0 ? log(expm1(x)) : x <= 16f0 ? x - exp(-x) : oftype(exp(-x), x)

const softplus = log1pexp
Expand Down Expand Up @@ -440,7 +440,7 @@ $(SIGNATURES)

Compute the complementary double exponential, `1 - exp(-exp(x))`.
"""
cexpexp(x) = -_expm1(-exp(x))
cexpexp(x) = -expm1(-exp(x))

#=
this uses the identity:
Expand Down
2 changes: 1 addition & 1 deletion test/basicfuns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ end
@test cloglog(T(x)) ≈ cloglog_big(T(x))
# Julia bug for Float32 and Float16 initially introduced in https://github.com/JuliaLang/julia/pull/37440
# and fixed in https://github.com/JuliaLang/julia/pull/50989
if T === Float64 || VERSION < v"1.7.0-DEV.887" || VERSION >= v"1.11.0-DEV.310"
if T === Float64 || VERSION >= v"1.11.0-DEV.310"
@test cexpexp(T(x)) ≈ cexpexp_big(T(x))
end
end
Expand Down
Loading