Skip to content

Commit

Permalink
ci: standardise workflows using SciML's reusable workflows (#289)
Browse files Browse the repository at this point in the history
* ci: update invalidations workflow to use centralised reusable workflow

* ci: update format check workflow to use centralised reusable workflow

* ci: standardize the tests workflow, using the reusable workflow

* Standardize the tests workflow, using the reusab SciML tests workflow.
* Rename the tests workflow to `Tests.yml`, instead of `CI.yml`, since
it's more semantically correct and CI encompasses all the workflows that
are run.

* ci(Tests): remove the `exclude` block for the test matrix

Since we don't test with Julia 1.6 anyways, remove the exclude block.
Note: this was initially left in while the workflow was standardised to
maintain status quo (with the previous version of the workflow).

* Fix deprecations

* Fix more deprecations

---------

Co-authored-by: David Widmann <devmotion@users.noreply.github.com>
  • Loading branch information
thazhemadam and devmotion committed Apr 23, 2024
1 parent 1ad28dd commit c78ec37
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 155 deletions.
82 changes: 0 additions & 82 deletions .github/workflows/CI.yml

This file was deleted.

36 changes: 4 additions & 32 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: format-check
name: "Format Check"

on:
push:
Expand All @@ -9,34 +9,6 @@ on:
pull_request:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
julia-arch: [x64]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v4
- name: Install JuliaFormatter and format
# This will use the latest version by default but you can set the version like so:
#
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
julia -e 'using JuliaFormatter; format(".", verbose=true)'
- name: Format check
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
end'
format-check:
name: "Format Check"
uses: "SciML/.github/.github/workflows/format-check.yml@v1"
37 changes: 3 additions & 34 deletions .github/workflows/Invalidations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,7 @@ name: Invalidations
on:
pull_request:

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: always.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
evaluate:
# Only run on PRs to the default branch.
# In the PR trigger above branches can be specified only explicitly whereas this check should work for master, main, or any other default branch
if: github.base_ref == github.event.repository.default_branch
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: actions/checkout@v4
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-invalidations@v1
id: invs_pr

- uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-invalidations@v1
id: invs_default

- name: Report invalidation counts
run: |
echo "Invalidations on default branch: ${{ steps.invs_default.outputs.total }} (${{ steps.invs_default.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY
echo "This branch: ${{ steps.invs_pr.outputs.total }} (${{ steps.invs_pr.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY
- name: Check if the PR does increase number of invalidations
if: steps.invs_pr.outputs.total > steps.invs_default.outputs.total
run: exit 1
evaluate-invalidations:
name: "Evaluate Invalidations"
uses: "SciML/.github/.github/workflows/invalidations.yml@v1"
39 changes: 39 additions & 0 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Run Tests"

on:
push:
branches:
- master
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch || github.ref != 'refs/tags/v*' }}

jobs:
tests:
name: "Tests"
strategy:
fail-fast: false
matrix:
version:
- '1'
arch:
- x64
- x86
group:
- Interface
- Integrators
- Regression
include:
- coverage: false
- version: '1'
arch: x64
coverage: true
uses: "SciML/.github/.github/workflows/tests.yml@v1"
with:
group: ${{ matrix.group }}
julia-version: '1'
julia-arch: ${{ matrix.arch }}
coverage: ${{ matrix.coverage }}
secrets: "inherit"
4 changes: 2 additions & 2 deletions test/interface/parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ h(p, t; idxs = nothing) = 0.1
sol1 = solve(prob, MethodOfSteps(Tsit5()))
@test length(sol1) == 21
@test first(sol1(12))0.884 atol=1e-4
@test first(sol1[end])1 atol=1e-5
@test first(sol1.u[end])1 atol=1e-5

# solve problem with updated parameter
prob.p[1] = 1.4
sol2 = solve(prob, MethodOfSteps(Tsit5()))
@test length(sol2) == 47
@test first(sol2(12))1.125 atol=5e-4
@test first(sol2[end])0.994 atol=2e-5
@test first(sol2.u[end])0.994 atol=2e-5
end
10 changes: 5 additions & 5 deletions test/interface/unconstrained.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ using Test
sol4 = solve(prob, alg4; abstol = 1e-12, reltol = 1e-12)

# relaxed tests to prevent floating point issues
@test abs(sol1[end] - sol2[end]) < 2.5e-8
@test abs(sol1[end] - sol3[end]) < 3.7e-8
@test abs(sol1[end] - sol4[end]) < 9.0e-11 # 9.0e-13
@test abs(sol1.u[end] - sol2.u[end]) < 2.5e-8
@test abs(sol1.u[end] - sol3.u[end]) < 3.7e-8
@test abs(sol1.u[end] - sol4.u[end]) < 9.0e-11 # 9.0e-13
end
end

Expand Down Expand Up @@ -82,8 +82,8 @@ using Test
sol4 = solve(prob, alg4; abstol = 1e-12, reltol = 1e-12)

# relaxed tests to prevent floating point issues
@test abs(sol1[end] - sol3[end]) < 1.2e-13 # 1.2e-15
@test abs(sol1[end] - sol4[end]) < 3.1e-13 # 3.1e-15
@test abs(sol1.u[end] - sol3.u[end]) < 1.2e-13 # 1.2e-15
@test abs(sol1.u[end] - sol4.u[end]) < 3.1e-13 # 3.1e-15
end
end
end
Expand Down

0 comments on commit c78ec37

Please sign in to comment.