From e7ef8ba70ad91e21e9c28599bbef2439aee4604e Mon Sep 17 00:00:00 2001 From: tmigot Date: Sat, 2 Mar 2024 18:40:13 -0500 Subject: [PATCH] Update CI (#41) * update badges in readme * Update CI --- .github/workflows/CompatHelper.yml | 45 +++++++++++--- .github/workflows/Documentation.yml | 23 -------- .../{format_pr.yml => Formatter.yml} | 7 ++- .github/workflows/Invalidations.yml | 42 +++++++++++++ .github/workflows/Register.yml | 14 +++++ .github/workflows/TagBot.yml | 15 +++++ .github/workflows/ci.yml | 59 +++++++++++-------- README.md | 13 ++-- 8 files changed, 152 insertions(+), 66 deletions(-) delete mode 100644 .github/workflows/Documentation.yml rename .github/workflows/{format_pr.yml => Formatter.yml} (88%) create mode 100644 .github/workflows/Invalidations.yml create mode 100644 .github/workflows/Register.yml create mode 100644 .github/workflows/TagBot.yml diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index 023e630..dcf5326 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -1,19 +1,46 @@ +# CompatHelper v3.5.0 name: CompatHelper - on: schedule: - - cron: '00 00 * * *' - + - cron: 0 0 * * * + workflow_dispatch: +permissions: + contents: write + pull-requests: write jobs: CompatHelper: runs-on: ubuntu-latest steps: - - uses: julia-actions/setup-julia@latest + - name: Check if Julia is already available in the PATH + id: julia_in_path + run: which julia + continue-on-error: true + - name: Install Julia, but only if it is not already available in the PATH + uses: julia-actions/setup-julia@v1 with: - version: 1.3 - - name: Pkg.add("CompatHelper") - run: julia -e 'using Pkg; Pkg.add("CompatHelper")' - - name: CompatHelper.main() + version: '1' + arch: ${{ runner.arch }} + if: steps.julia_in_path.outcome != 'success' + - name: "Add the General registry via Git" + run: | + import Pkg + ENV["JULIA_PKG_SERVER"] = "" + Pkg.Registry.add("General") + shell: julia --color=yes {0} + - name: "Install CompatHelper" + run: | + import Pkg + name = "CompatHelper" + uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" + version = "3" + Pkg.add(; name, uuid, version) + shell: julia --color=yes {0} + - name: "Run CompatHelper" + run: | + import CompatHelper + CompatHelper.main() + shell: julia --color=yes {0} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: julia -e 'using CompatHelper; CompatHelper.main()' \ No newline at end of file + COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} + # COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml deleted file mode 100644 index 5575279..0000000 --- a/.github/workflows/Documentation.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Documentation -on: - push: - branches: - - main - tags: '*' - pull_request: - types: [opened, synchronize, reopened] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@latest - 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 }} - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} - run: julia --project=docs --color=yes docs/make.jl diff --git a/.github/workflows/format_pr.yml b/.github/workflows/Formatter.yml similarity index 88% rename from .github/workflows/format_pr.yml rename to .github/workflows/Formatter.yml index c8f5308..9185602 100644 --- a/.github/workflows/format_pr.yml +++ b/.github/workflows/Formatter.yml @@ -1,5 +1,6 @@ -# https://github.com/julia-actions/julia-format/blob/master/workflows/format_pr.yml -name: format-pr +name: Formatter + +# Modified from https://github.com/julia-actions/julia-format/blob/master/workflows/format_pr.yml on: push: branches: @@ -29,4 +30,4 @@ jobs: - name: Check outputs run: | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" \ No newline at end of file + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" diff --git a/.github/workflows/Invalidations.yml b/.github/workflows/Invalidations.yml new file mode 100644 index 0000000..6d8b2d7 --- /dev/null +++ b/.github/workflows/Invalidations.yml @@ -0,0 +1,42 @@ +name: Invalidations +# Uses SnoopCompile to evaluate number of invalidations caused by `using` the package +# using https://github.com/julia-actions/julia-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@v1 + with: + version: '1' + - uses: actions/checkout@v3 + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-invalidations@v1 + id: invs_pr + + - uses: actions/checkout@v3 + 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 diff --git a/.github/workflows/Register.yml b/.github/workflows/Register.yml new file mode 100644 index 0000000..6e71f2f --- /dev/null +++ b/.github/workflows/Register.yml @@ -0,0 +1,14 @@ +name: Register Package +on: + workflow_dispatch: + inputs: + version: + description: Version to register or component to bump + required: true +jobs: + register: + runs-on: ubuntu-latest + steps: + - uses: julia-actions/RegisterAction@latest + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml new file mode 100644 index 0000000..f49313b --- /dev/null +++ b/.github/workflows/TagBot.yml @@ -0,0 +1,15 @@ +name: TagBot +on: + issue_comment: + types: + - created + workflow_dispatch: +jobs: + TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' + runs-on: ubuntu-latest + steps: + - uses: JuliaRegistries/TagBot@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ssh: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84e29be..4da44c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,35 +1,22 @@ name: CI on: - push: - branches: - - main - pull_request: - types: [opened, synchronize, reopened] + - push + - pull_request jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.allow_failure }} strategy: fail-fast: false matrix: - version: ['1.6', '1'] - os: [ubuntu-latest, macOS-latest, windows-latest] - arch: [x64] - allow_failure: [false] - include: - - version: 'nightly' - os: ubuntu-latest - arch: x64 - allow_failure: true - - version: 'nightly' - os: macOS-latest - arch: x64 - allow_failure: true - - version: 'nightly' - os: windows-latest - arch: x64 - allow_failure: true + version: + - '1.6' + - '1' + - 'nightly' + os: + - ubuntu-latest + arch: + - x64 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 @@ -51,4 +38,28 @@ jobs: - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v1 with: - file: lcov.info \ No newline at end of file + file: lcov.info + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@v1 + with: + version: '1' + - run: | + julia --project=docs -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' + - run: | + julia --project=docs -e ' + using Documenter: DocMeta, doctest + using PDEOptimizationProblems + DocMeta.setdocmeta!(PDEOptimizationProblems, :DocTestSetup, :(using PDEOptimizationProblems); recursive=true) + doctest(PDEOptimizationProblems)' + - run: julia --project=docs docs/make.jl + env: + JULIA_PKG_SERVER: "" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} diff --git a/README.md b/README.md index 9c19c62..5dc35f0 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ # PDEOptimizationProblems -[![DOI]()]() -[![GitHub release](https://img.shields.io/github/release/tmigot/PDEOptimizationProblems.svg)](https://github.com/tmigot/PDEOptimizationProblems/releases/latest) -[![](https://img.shields.io/badge/docs-stable-3f51b5.svg)](https://tmigot.github.io/PDEOptimizationProblems/stable) -[![](https://img.shields.io/badge/docs-dev-3f51b5.svg)](https://tmigot.github.io/PDEOptimizationProblems/dev) -[![codecov](https://codecov.io/gh/tmigot/PDEOptimizationProblems/branch/main/graph/badge.svg?token=eyiGsilbZx)](https://codecov.io/gh/tmigot/PDEOptimizationProblems) -![CI](https://github.com/tmigot/PDEOptimizationProblems/workflows/CI/badge.svg?branch=main) -[![Cirrus CI - Base Branch Build Status](https://img.shields.io/cirrus/github/tmigot/PDEOptimizationProblems?logo=Cirrus%20CI)](https://cirrus-ci.com/github/tmigot/PDEOptimizationProblems) +[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaSmoothOptimizers.github.io/PDEOptimizationProblems.jl/stable) +[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaSmoothOptimizers.github.io/PDEOptimizationProblems.jl/dev) +[![Build Status](https://github.com/JuliaSmoothOptimizers/PDEOptimizationProblems.jl/workflows/CI/badge.svg)](https://github.com/JuliaSmoothOptimizers/PDEOptimizationProblems.jl/actions) +[![Build Status](https://api.cirrus-ci.com/github/JuliaSmoothOptimizers/PDEOptimizationProblems.jl.svg)](https://cirrus-ci.com/github/JuliaSmoothOptimizers/PDEOptimizationProblems.jl) +[![Docs workflow Status](https://github.com/JuliaSmoothOptimizers/PDEOptimizationProblems.jl/actions/workflows/Docs.yml/badge.svg?branch=main)](https://github.com/JuliaSmoothOptimizers/PDEOptimizationProblems.jl/actions/workflows/Docs.yml?query=branch%3Amain) +[![Coverage](https://codecov.io/gh/JuliaSmoothOptimizers/PDEOptimizationProblems.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaSmoothOptimizers/PDEOptimizationProblems.jl) A list of optimization problems with ODE/PDE in the constraints model and discretized using [Gridap.jl](https://github.com/gridap/Gridap.jl) and [PDENLPModels.jl](https://github.com/tmigot/PDENLPModels.jl).