From b59ab17df2cdd6b9aaf111a46ac6de61321696f9 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Sun, 15 Jun 2025 16:44:17 +0100 Subject: [PATCH 01/14] bump test ForwardDiff -> 1 --- README.md | 2 -- test/Project.toml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 5b361bf7..777546af 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,6 @@ [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://TuringLang.github.io/TuringGLM.jl/stable) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://TuringLang.github.io/TuringGLM.jl/dev) [![Build Status](https://github.com/TuringLang/TuringGLM.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/TuringLang/TuringGLM.jl/actions/workflows/CI.yml?query=branch%3Amain) -[![Coverage](https://codecov.io/gh/TuringLang/TuringGLM.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/TuringLang/TuringGLM.jl) -[![Coverage](https://coveralls.io/repos/github/TuringLang/TuringGLM.jl/badge.svg?branch=main)](https://coveralls.io/github/TuringLang/TuringGLM.jl?branch=main) [![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle) [![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac) diff --git a/test/Project.toml b/test/Project.toml index 4cb01919..2b68c5f8 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -15,7 +15,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" CSV = "0.10" CategoricalArrays = "0.10" DataFrames = "1" -ForwardDiff = "0.10" +ForwardDiff = "0.10, 1" ReverseDiff = "1" Statistics = "1" TimerOutputs = "0.5" From a13bc6e2394c5b899e0b60c24e3797f4aac8a4ba Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Sun, 15 Jun 2025 16:45:42 +0100 Subject: [PATCH 02/14] bump Turing to include 0.38, 0.39 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index a3b0059a..c73b3406 100644 --- a/Project.toml +++ b/Project.toml @@ -29,5 +29,5 @@ StatsBase = "0.33 - 0.34" StatsModels = "0.6.28 - 0.7" TableOperations = "1.2" Tables = "1.6" -Turing = "0.20 - 0.37" +Turing = "0.20 - 0.39" julia = "1" From 2a037c1ee56c48653601ce673e7ffdb750a392e2 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Sun, 15 Jun 2025 16:49:36 +0100 Subject: [PATCH 03/14] replace Tracker / Zygote with Mooncake --- test/Project.toml | 6 ++---- test/ad_backends.jl | 32 ++++++++++---------------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/test/Project.toml b/test/Project.toml index 2b68c5f8..80eed6c8 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -3,21 +3,19 @@ CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" +Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" -Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" -Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [compat] CSV = "0.10" CategoricalArrays = "0.10" DataFrames = "1" ForwardDiff = "0.10, 1" +Mooncake = "0.4.122" ReverseDiff = "1" Statistics = "1" TimerOutputs = "0.5" -Tracker = "0.2" -Zygote = "0.6" diff --git a/test/ad_backends.jl b/test/ad_backends.jl index 243d9a4a..6dd19fa9 100644 --- a/test/ad_backends.jl +++ b/test/ad_backends.jl @@ -1,28 +1,16 @@ -@timed_testset "ad_backends" begin +@timed_testset "ad_backends.jl" begin DATA_DIR = joinpath("..", "data") cheese = CSV.read(joinpath(DATA_DIR, "cheese.csv"), DataFrame) f = @formula(y ~ (1 | cheese) + background) m = turing_model(f, cheese) - # only running 2 samples to test if the different ADs runs - @timed_testset "ForwardDiff" begin - chn = sample(m, NUTS(; adtype=AutoForwardDiff(; chunksize=8)), 2) - @test chn isa Chains - end - # TODO: fix Tracker tests - # @timed_testset "Tracker" begin - # using Tracker - # chn = sample(m, NUTS(; adtype=AutoTracker()), 2) - # @test chn isa Chains - # end - # TODO: fix Zygote tests - # @timed_testset "Zygote" begin - # using Zygote - # chn = sample(m, NUTS(; adtype=AutoZygote()), 2) - # @test chn isa Chains - # end - @timed_testset "ReverseDiff" begin - using ReverseDiff - chn = sample(m, NUTS(; adtype=AutoReverseDiff(; compile=true)), 2) - @test chn isa Chains + + ADTYPES = [ + AutoForwardDiff(), + AutoReverseDiff(; compile=false), + AutoReverseDiff(; compile=true), + AutoMooncake(; config=nothing), + ] + @testset for "$adtype" in ADTYPES + @test sample(m, NUTS(; adtype=adtype), 20) isa Chains end end From f30526434f6f3a9504aedb686528596633c1bcbd Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Sun, 15 Jun 2025 16:51:06 +0100 Subject: [PATCH 04/14] bump patch --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index c73b3406..863dc7e3 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "TuringGLM" uuid = "0004c1f4-53c5-4d43-a221-a1dac6cf6b74" authors = ["Jose Storopoli ", "Rik Huijzer ", "contributors"] -version = "2.13.0" +version = "2.13.1" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" From 630bc6e75fd996b3de65cce6bea02e48a146c8b5 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Sun, 15 Jun 2025 16:52:44 +0100 Subject: [PATCH 05/14] use turinglang/actions/format --- .github/workflows/Format.yml | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/.github/workflows/Format.yml b/.github/workflows/Format.yml index 0cb8ebac..920bf1c0 100644 --- a/.github/workflows/Format.yml +++ b/.github/workflows/Format.yml @@ -3,30 +3,19 @@ name: Format on: push: branches: - - "main" - - "release-" - tags: ["*"] + - main pull_request: +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + jobs: format: - name: "Format Check" runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: 1 - - name: Install JuliaFormatter and format - run: | - using Pkg - Pkg.add(PackageSpec(name="JuliaFormatter")) - using JuliaFormatter - format("."; verbose=true) - shell: julia --color=yes {0} - - name: Suggest formatting changes - uses: reviewdog/action-suggester@v1 - if: github.event_name == 'pull_request' - with: - tool_name: JuliaFormatter - fail_on_error: true + - name: Format code + uses: TuringLang/actions/Format@main From 96a0e1bd40b5e3b6da56f54b3b049fd998db8c0b Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Sun, 15 Jun 2025 16:54:48 +0100 Subject: [PATCH 06/14] fix CI workflow (macOS doesn't use x86) --- .github/workflows/CI.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c8caacd5..f017e4a5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -16,24 +16,21 @@ jobs: name: Julia CI runs-on: ${{ matrix.os }} timeout-minutes: 90 - continue-on-error: ${{ matrix.version == 'nightly' }} strategy: fail-fast: false matrix: version: - - '1.10' + - 'min' + - '1' os: - ubuntu-latest - windows-latest - macOS-latest - arch: - - x64 steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} - arch: ${{ matrix.arch }} - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 From bd03def5566fa371d20ea616c7b9ab36581336b1 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Sun, 15 Jun 2025 17:01:28 +0100 Subject: [PATCH 07/14] fix concurrency behaviour on CI --- .github/workflows/CI.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f017e4a5..a2e74f21 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,11 +6,12 @@ on: tags: ["*"] pull_request: workflow_dispatch: + +# Cancel existing tests on the same PR if a new commit is added to a pull request concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: false + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + jobs: test: name: Julia CI From 2d5eac50492bca2b396ef506ad1d8362d93559dd Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Sun, 15 Jun 2025 17:03:02 +0100 Subject: [PATCH 08/14] min -> lts since this doesn't have a min --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a2e74f21..cec04367 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false matrix: version: - - 'min' + - 'lts' - '1' os: - ubuntu-latest From a5382575df920572e4e8a25d4724c0ed92df9a81 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Wed, 18 Jun 2025 10:17:49 +0100 Subject: [PATCH 09/14] fix syntax --- test/ad_backends.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ad_backends.jl b/test/ad_backends.jl index 6dd19fa9..d9bd8472 100644 --- a/test/ad_backends.jl +++ b/test/ad_backends.jl @@ -10,7 +10,7 @@ AutoReverseDiff(; compile=true), AutoMooncake(; config=nothing), ] - @testset for "$adtype" in ADTYPES + @testset "$adtype" for adtype in ADTYPES @test sample(m, NUTS(; adtype=adtype), 20) isa Chains end end From 69c726a457572bd1213e35bf8888a1a9ddf867c3 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Wed, 18 Jun 2025 11:12:41 +0100 Subject: [PATCH 10/14] imports --- test/ad_backends.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/ad_backends.jl b/test/ad_backends.jl index d9bd8472..81eb2d6d 100644 --- a/test/ad_backends.jl +++ b/test/ad_backends.jl @@ -1,3 +1,7 @@ +import ForwardDiff +import ReverseDiff +import Mooncake + @timed_testset "ad_backends.jl" begin DATA_DIR = joinpath("..", "data") cheese = CSV.read(joinpath(DATA_DIR, "cheese.csv"), DataFrame) From ce483e47bbfd2be2c0597e2c2b4547e65f89bd37 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Wed, 18 Jun 2025 11:18:24 +0100 Subject: [PATCH 11/14] Update test/ad_backends.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- test/ad_backends.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/ad_backends.jl b/test/ad_backends.jl index 81eb2d6d..ee856885 100644 --- a/test/ad_backends.jl +++ b/test/ad_backends.jl @@ -1,6 +1,6 @@ -import ForwardDiff -import ReverseDiff -import Mooncake +using ForwardDiff: ForwardDiff +using ReverseDiff: ReverseDiff +using Mooncake: Mooncake @timed_testset "ad_backends.jl" begin DATA_DIR = joinpath("..", "data") From fac5c4a4819514db9126ebbd847546dbbb621ed5 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Wed, 18 Jun 2025 14:26:23 +0100 Subject: [PATCH 12/14] Bump minor version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 863dc7e3..68f14dfa 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "TuringGLM" uuid = "0004c1f4-53c5-4d43-a221-a1dac6cf6b74" authors = ["Jose Storopoli ", "Rik Huijzer ", "contributors"] -version = "2.13.1" +version = "2.14.0" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" From 2ae34170447f78f2e6461978150d8ad14afd7ae2 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Wed, 18 Jun 2025 15:16:54 +0100 Subject: [PATCH 13/14] enable coverage --- .github/workflows/CI.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index cec04367..8e829c22 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -35,7 +35,17 @@ jobs: - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - with: - coverage: "false" env: JULIA_NUM_THREADS: "auto" + + - uses: julia-actions/julia-processcoverage@v1 + + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + + - uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: lcov.info From b7e5ffb0db55248dc5cbaf471776bb485c606883 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Wed, 18 Jun 2025 15:34:51 +0100 Subject: [PATCH 14/14] Re-add coverage badges --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 777546af..8a7a9d06 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,9 @@ [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://TuringLang.github.io/TuringGLM.jl/stable) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://TuringLang.github.io/TuringGLM.jl/dev) [![Build Status](https://github.com/TuringLang/TuringGLM.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/TuringLang/TuringGLM.jl/actions/workflows/CI.yml?query=branch%3Amain) -[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle) +[![Coverage](https://codecov.io/gh/TuringLang/TuringGLM.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/TuringLang/TuringGLM.jl) +[![Coverage](https://coveralls.io/repos/github/TuringLang/TuringGLM.jl/badge.svg?branch=main)](https://coveralls.io/github/TuringLang/TuringGLM.jl?branch=main) +[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/JuliaDiff/BlueStyle) [![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac) TuringGLM makes easy to specify Bayesian **G**eneralized **L**inear **M**odels using the formula syntax and returns an instantiated [Turing](https://github.com/TuringLang/Turing.jl) model.