diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c8caacd5..8e829c22 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,38 +6,46 @@ 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 runs-on: ${{ matrix.os }} timeout-minutes: 90 - continue-on-error: ${{ matrix.version == 'nightly' }} strategy: fail-fast: false matrix: version: - - '1.10' + - 'lts' + - '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 - 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 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 diff --git a/Project.toml b/Project.toml index a3b0059a..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.0" +version = "2.14.0" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" @@ -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" diff --git a/README.md b/README.md index 5b361bf7..8a7a9d06 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![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) +[![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. diff --git a/test/Project.toml b/test/Project.toml index 4cb01919..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" +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..ee856885 100644 --- a/test/ad_backends.jl +++ b/test/ad_backends.jl @@ -1,28 +1,20 @@ -@timed_testset "ad_backends" begin +using ForwardDiff: ForwardDiff +using ReverseDiff: ReverseDiff +using Mooncake: Mooncake + +@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 "$adtype" for adtype in ADTYPES + @test sample(m, NUTS(; adtype=adtype), 20) isa Chains end end