Skip to content

Commit

Permalink
Update CI: No nightly tests, improve macOS CI setup + use julia-actio…
Browse files Browse the repository at this point in the history
…ns/cache (#1863)

* Test prereleases if available

* Fix name?

* Fix matrix

* Fixes

* Fix syntax

* Another round of fixes

* Remove prerelease CI

* Better mac fix?

* Fix typo

* Fix failing tests on 1.11-beta (#1862)

* Increase sample size when testing empirical moments of DiscreteNonParametric

* Use StableRNGs for semicircle.jl to avoid breakage on 1.11-beta

* Run CI on all PRs. Also CI for workflow_dispatch and merge_group

* Update semicircle.jl

Co-authored-by: David Widmann <[email protected]>

* Update locationscale.jl

Co-authored-by: David Widmann <[email protected]>

* Update locationscale.jl

Co-authored-by: David Widmann <[email protected]>

---------

Co-authored-by: David Widmann <[email protected]>

---------

Co-authored-by: Andreas Noack <[email protected]>
  • Loading branch information
devmotion and andreasnoack authored Jun 28, 2024
1 parent b356da0 commit 65f056c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 32 deletions.
30 changes: 8 additions & 22 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: CI

on:
pull_request:
branches:
- master
push:
branches:
- master
tags: '*'
workflow_dispatch:
merge_group:

concurrency:
# Skip intermediate builds: always.
Expand All @@ -17,42 +17,27 @@ concurrency:

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 }}
continue-on-error: ${{ matrix.version == 'nightly' }}
strategy:
fail-fast: false
matrix:
version:
- '1.3'
- '1'
- 'nightly'
os:
- ubuntu-latest
- macos-latest
- windows-latest
arch:
- x64
include:
- os: macOS-14
arch: aarch64
version: '1'
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v4
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 }}-
# ARM64 on macos-latest is neither supported by older Julia versions nor setup-julia
arch: ${{ matrix.os == 'macos-latest' && matrix.version != '1.3' && 'aarch64' || 'x64' }}
show-versioninfo: true
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- run: |
Expand All @@ -74,6 +59,7 @@ jobs:
- uses: julia-actions/setup-julia@v2
with:
version: '1'
show-versioninfo: true
- run: |
julia --project=docs -e '
using Pkg
Expand Down
6 changes: 3 additions & 3 deletions test/univariate/continuous/semicircle.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Distributions
using Random: MersenneTwister
using StableRNGs
using Test

d = Semicircle(2.0)
Expand Down Expand Up @@ -39,8 +39,8 @@ d = Semicircle(2.0)
@test quantile(d, .5) == .0
@test quantile(d, 1.0) == +2.0

rng = MersenneTwister(0)
for r in rand(rng, Uniform(0,10), 5)
rng = StableRNG(123)
@testset for r in rand(rng, Uniform(0,10), 5)
N = 10^4
semi = Semicircle(r)
sample = rand(rng, semi, N)
Expand Down
14 changes: 7 additions & 7 deletions test/univariate/locationscale.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function test_location_scale(
@test invlogccdf(dtest, log(0.5)) invlogccdf(dref, log(0.5))
@test invlogccdf(dtest, log(0.8)) invlogccdf(dref, log(0.8))

r = Array{float(eltype(dtest))}(undef, 100000)
r = Array{float(eltype(dtest))}(undef, 200000)
if ismissing(rng)
rand!(dtest, r)
else
Expand Down Expand Up @@ -148,19 +148,19 @@ end
rng = MersenneTwister(123)

@testset "Normal" begin
for _rng in (missing, rng), sign in (1, -1)
@testset for _rng in (missing, rng), sign in (1, -1)
test_location_scale_normal(_rng, 0.3, sign * 0.2, 0.1, 0.2)
test_location_scale_normal(_rng, -0.3, sign * 0.1, -0.1, 0.3)
test_location_scale_normal(_rng, 1.3, sign * 0.4, -0.1, 0.5)
end
test_location_scale_normal(rng, ForwardDiff.Dual(0.3), 0.2, 0.1, 0.2)
end
@testset "DiscreteNonParametric" begin
probs = normalize!(rand(10), 1)
for _rng in (missing, rng), sign in (1, -1)
test_location_scale_discretenonparametric(_rng, 1//3, sign * 1//2, 1:10, probs)
test_location_scale_discretenonparametric(_rng, -1//4, sign * 1//3, (-10):(-1), probs)
test_location_scale_discretenonparametric(_rng, 6//5, sign * 3//2, 15:24, probs)
_probs = normalize!(rand(10), 1)
@testset for _rng in (missing, rng), sign in (1, -1)
test_location_scale_discretenonparametric(_rng, 1//3, sign * 1//2, 1:10, _probs)
test_location_scale_discretenonparametric(_rng, -1//4, sign * 1//3, (-10):(-1), _probs)
test_location_scale_discretenonparametric(_rng, 6//5, sign * 3//2, 15:24, _probs)
end
end

Expand Down

0 comments on commit 65f056c

Please sign in to comment.