Skip to content

ci: fix CI and standardize things #13

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

Merged
merged 4 commits into from
Apr 8, 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
56 changes: 9 additions & 47 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,34 @@ on:
push:
branches:
- main
tags: ['*']
paths-ignore:
- 'docs/**'
pull_request:
workflow_dispatch:
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/') }}
paths-ignore:
- 'docs/**'
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
strategy:
fail-fast: false
matrix:
version:
- '1.10'
- 'nightly'
- '1'
os:
- ubuntu-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@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
depwarn: error
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
files: lcov.info
docs:
name: Documentation
runs-on: ubuntu-latest
permissions:
actions: write # needed to allow julia-actions/cache to proactively delete old caches that it has created
contents: write
statuses: write
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v1
- name: Configure doc environment
shell: julia --project=docs --color=yes {0}
run: |
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run doctests
shell: julia --project=docs --color=yes {0}
run: |
using Documenter: DocMeta, doctest
using UDEComponents
DocMeta.setdocmeta!(UDEComponents, :DocTestSetup, :(using UDEComponents); recursive=true)
doctest(UDEComponents)
14 changes: 11 additions & 3 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
name: CompatHelper

on:
schedule:
- cron: 0 0 * * *
- cron: '00 00 * * *'
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@v2
with:
version: 1.3
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
run: julia -e 'using CompatHelper; CompatHelper.main(;subdirs=["", "docs"])'
28 changes: 28 additions & 0 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Documentation
on:
push:
branches:
- main
tags: '*'
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
run: julia --project=docs/ docs/make.jl
- uses: julia-actions/julia-processcoverage@v1
with:
directories: src
- uses: codecov/codecov-action@v3
with:
files: lcov.info
16 changes: 9 additions & 7 deletions .github/workflows/Downgrade.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Downgrade
on:
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
push:
Expand All @@ -12,20 +10,24 @@ on:
- 'docs/**'
jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version: ['1']
group:
- Core
version:
- '1'
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
- uses: julia-actions/julia-downgrade-compat@v1
# if: ${{ matrix.version == '1.6' }}
with:
skip: Pkg,TOML
- uses: julia-actions/cache@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
12 changes: 6 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

[compat]
Aqua = "0.8"
ComponentArrays = "0.15"
ComponentArrays = "0.15.11"
ForwardDiff = "0.10.36"
JET = "0.8"
Lux = "0.5.32"
LuxCore = "0.1.14"
ModelingToolkit = "9.9.0"
ModelingToolkit = "9.9"
ModelingToolkitStandardLibrary = "2.6"
Optimization = "3.22"
OptimizationOptimisers = "0.2"
Optimization = "3.24"
OptimizationOptimisers = "0.2.1"
OrdinaryDiffEq = "6.74"
Random = "1"
Random = "1.10"
SafeTestsets = "0.1"
SciMLStructures = "1.1.0"
StableRNGs = "1"
SymbolicIndexingInterface = "0.3.15"
Symbolics = "5.27"
Test = "1"
Test = "1.10"
julia = "1.10"

[extras]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://SciML.github.io/UDEComponents.jl/dev/)
[![Build Status](https://github.com/SciML/UDEComponents.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/SciML/UDEComponents.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Coverage](https://codecov.io/gh/SciML/UDEComponents.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/SciML/UDEComponents.jl)
[![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)
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor%27s%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
[![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

## Build UDEs with ModelingToolkit
4 changes: 2 additions & 2 deletions src/UDEComponents.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ include("utils.jl")
"""
NeuralNetworkBlock(n_input = 1, n_output = 1;
chain = multi_layer_feed_forward(n_input, n_output),
rng = Xoshiro(0))
rng = Xoshiro(0), eltype = Float64)

Create an `ODESystem` with a neural network inside.
"""
function NeuralNetworkBlock(n_input = 1,
n_output = 1;
chain = multi_layer_feed_forward(n_input, n_output),
rng = Xoshiro(0), eltype=Float64)
rng = Xoshiro(0), eltype = Float64)
lux_p = Lux.initialparameters(rng, chain)
ca = ComponentArray{eltype}(lux_p)

Expand Down
4 changes: 2 additions & 2 deletions test/lotka_volterra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using StableRNGs

function lotka_ude()
@variables t x(t)=3.1 y(t)=1.5
@parameters α=1.3 [tunable=false] δ=1.8 [tunable=false]
@parameters α=1.3 [tunable = false] δ=1.8 [tunable = false]
Dt = ModelingToolkit.D_nounits
@named nn_in = RealInput(nin = 2)
@named nn_out = RealOutput(nout = 2)
Expand Down Expand Up @@ -115,7 +115,7 @@ res = solve(op, Adam(), maxiters = 5000)#, callback = plot_cb)

res_p = SciMLStructures.replace(Tunable(), prob.p, res)
res_prob = remake(prob, p = res_p)
res_sol = solve(res_prob, Rodas4(), saveat=sol_ref.t)
res_sol = solve(res_prob, Rodas4(), saveat = sol_ref.t)

# using Plots
# plot(sol_ref, idxs = [model_true.x, model_true.y])
Expand Down