From 22fc08347628caf469eb31ea8bb72ddfc99de986 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Tue, 10 Dec 2024 21:45:33 +0100 Subject: [PATCH 1/2] Update CI setup and add dependabot --- .github/dependabot.yml | 7 +++++++ .github/workflows/CI.yml | 43 ++++++++++++++++++---------------------- 2 files changed, 26 insertions(+), 24 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..d60f0707 --- /dev/null +++ b/.github/dependabot.yml @@ -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" diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1a07ebd6..61da26fc 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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: @@ -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: | From 9e38229e318525811198a2ccb276c8444698903b Mon Sep 17 00:00:00 2001 From: David Widmann Date: Tue, 10 Dec 2024 21:57:57 +0100 Subject: [PATCH 2/2] Update Julia compat to 1.10 --- Project.toml | 2 +- src/LogExpFunctions.jl | 10 ---------- src/basicfuns.jl | 8 ++++---- test/basicfuns.jl | 2 +- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/Project.toml b/Project.toml index eedc0555..b64ce477 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/src/LogExpFunctions.jl b/src/LogExpFunctions.jl index 739e0051..05287eb7 100644 --- a/src/LogExpFunctions.jl +++ b/src/LogExpFunctions.jl @@ -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") diff --git a/src/basicfuns.jl b/src/basicfuns.jl index e013adfa..0b0839b9 100644 --- a/src/basicfuns.jl +++ b/src/basicfuns.jl @@ -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 @@ -246,7 +246,7 @@ $(SIGNATURES) Return `log(2 - exp(x))` evaluated as `log1p(-expm1(x))` """ -log2mexp(x::Real) = log1p(-_expm1(x)) +log2mexp(x::Real) = log1p(-expm1(x)) """ $(SIGNATURES) @@ -254,7 +254,7 @@ $(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 @@ -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: diff --git a/test/basicfuns.jl b/test/basicfuns.jl index 1e615c04..c6523131 100644 --- a/test/basicfuns.jl +++ b/test/basicfuns.jl @@ -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