Skip to content

Commit

Permalink
Merge pull request #133 from SciML/at/use-reusable-workflows
Browse files Browse the repository at this point in the history
ci: standardize workflows using SciML's reusable workflows
  • Loading branch information
ChrisRackauckas authored Jul 29, 2024
2 parents 878c460 + 2fae387 commit 37d1364
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 96 deletions.
54 changes: 19 additions & 35 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: "Tests"

on:
pull_request:
Expand All @@ -9,45 +9,29 @@ on:
- master

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/') }}
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch || github.ref != 'refs/tags/v*' }}

jobs:
test:
runs-on: ubuntu-latest
tests:
name: "Tests"
strategy:
fail-fast: false
matrix:
version:
- "1"
- "lts"
project:
- '.'
- lib/DAEProblemLibrary
- lib/DDEProblemLibrary
- lib/JumpProblemLibrary
- lib/ODEProblemLibrary
- lib/SDEProblemLibrary
- lib/BVProblemLibrary
- lib/NonlinearProblemLibrary
version:
- '1'
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
with:
project: ${{ matrix.project }}
- uses: julia-actions/julia-runtest@v1
with:
project: ${{ matrix.project }}
- uses: julia-actions/julia-processcoverage@v1
with:
directories: ${{ matrix.project }}/src
- uses: codecov/codecov-action@v4
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
- 'lib/DAEProblemLibrary'
- 'lib/DDEProblemLibrary'
- 'lib/JumpProblemLibrary'
- 'lib/ODEProblemLibrary'
- 'lib/SDEProblemLibrary'
- 'lib/BVPProblemLibrary'
- 'lib/NonlinearProblemLibrary'
uses: "SciML/.github/.github/workflows/tests.yml@v1"
with:
julia-version: "${{ matrix.version }}"
project: "${{ matrix.project }}"
secrets: "inherit"
36 changes: 4 additions & 32 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: format-check
name: "Format Check"

on:
push:
branches:
- 'master'
- 'release-'
tags: '*'
pull_request:

Expand All @@ -15,33 +14,6 @@ concurrency:
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: 1
- name: Install JuliaFormatter
run: |
using Pkg
name = "JuliaFormatter"
uuid = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
Pkg.add(; name, uuid)
shell: julia --color=yes {0}
- name: Format Julia code
run: |
using JuliaFormatter
format("."; verbose = true)
shell: julia --color=yes {0}
- name: Format check
run: |
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
shell: julia --color=yes {0}
format-check:
name: "Format Check"
uses: "SciML/.github/.github/workflows/format-check.yml@v1"
33 changes: 4 additions & 29 deletions .github/workflows/Invalidations.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Invalidations
name: "Invalidations"

on:
pull_request:
Expand All @@ -10,31 +10,6 @@ concurrency:
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"

0 comments on commit 37d1364

Please sign in to comment.