From 952830435103600af4cedeada35f4a04f62467c5 Mon Sep 17 00:00:00 2001 From: tmigot Date: Fri, 28 Mar 2025 07:50:35 -0400 Subject: [PATCH 1/6] Apply BestieTemplate --- .JuliaFormatter.toml | 10 +- .all-contributorsrc | 5 + .breakage/Project.toml | 6 +- .copier-answers.yml | 30 + .editorconfig | 18 + .github/ISSUE_TEMPLATE/10-bug-report.yml | 60 ++ .github/ISSUE_TEMPLATE/20-feature-request.yml | 41 + .github/ISSUE_TEMPLATE/30-usage.yml | 23 + .github/ISSUE_TEMPLATE/99-general.yml | 21 + .github/ISSUE_TEMPLATE/config.yml | 5 + .github/PULL_REQUEST_TEMPLATE.md | 27 + .github/dependabot.yml | 7 + .github/workflows/Breakage.yml | 330 ++++---- .github/workflows/CompatHelper.yml | 46 +- .github/workflows/Docs.yml | 57 ++ .github/workflows/Documentation.yml | 46 +- .github/workflows/Lint.yml | 62 ++ .github/workflows/PreCommitUpdate.yml | 40 + .github/workflows/ReusableTest.yml | 52 ++ .github/workflows/TagBot.yml | 52 +- .github/workflows/Test.yml | 46 ++ .github/workflows/TestOnPRs.yml | 29 + .github/workflows/ci.yml | 108 +-- .github/workflows/format_pr.yml | 2 +- .gitignore | 14 +- .lychee.toml | 12 + .markdownlint.json | 13 + .pre-commit-config.yaml | 53 ++ .yamlfmt.yml | 7 + .yamllint.yml | 2 + .zenodo.json | 38 +- CODE_OF_CONDUCT.md | 133 ++++ LICENSE | 373 ++++++++++ LICENSE.md | 702 +++++++++--------- README.md | 42 +- docs/make.jl | 34 +- .../{jso-compliant.md => 1-jso-compliant.md} | 0 docs/src/90-contributing.md | 25 + docs/src/91-developer.md | 163 ++++ docs/src/95-reference.md | 17 + docs/src/index.md | 23 +- docs/src/reference.md | 12 +- src/stats.jl | 2 +- test/Project.toml | 6 + test/runtests.jl | 36 +- test/test-allocs.jl | 13 + test/{test_callback.jl => test-callback.jl} | 0 test/{test_logging.jl => test-logging.jl} | 0 test/{test_restart.jl => test-restart.jl} | 0 test/{test_stats.jl => test-stats.jl} | 0 test/teststats.out | 30 + 51 files changed, 2180 insertions(+), 693 deletions(-) create mode 100644 .all-contributorsrc create mode 100644 .copier-answers.yml create mode 100644 .editorconfig create mode 100644 .github/ISSUE_TEMPLATE/10-bug-report.yml create mode 100644 .github/ISSUE_TEMPLATE/20-feature-request.yml create mode 100644 .github/ISSUE_TEMPLATE/30-usage.yml create mode 100644 .github/ISSUE_TEMPLATE/99-general.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/Docs.yml create mode 100644 .github/workflows/Lint.yml create mode 100644 .github/workflows/PreCommitUpdate.yml create mode 100644 .github/workflows/ReusableTest.yml create mode 100644 .github/workflows/Test.yml create mode 100644 .github/workflows/TestOnPRs.yml create mode 100644 .lychee.toml create mode 100644 .markdownlint.json create mode 100644 .pre-commit-config.yaml create mode 100644 .yamlfmt.yml create mode 100644 .yamllint.yml create mode 100644 CODE_OF_CONDUCT.md create mode 100644 LICENSE rename docs/src/{jso-compliant.md => 1-jso-compliant.md} (100%) create mode 100644 docs/src/90-contributing.md create mode 100644 docs/src/91-developer.md create mode 100644 docs/src/95-reference.md create mode 100644 test/Project.toml create mode 100644 test/test-allocs.jl rename test/{test_callback.jl => test-callback.jl} (100%) rename test/{test_logging.jl => test-logging.jl} (100%) rename test/{test_restart.jl => test-restart.jl} (100%) rename test/{test_stats.jl => test-stats.jl} (100%) create mode 100644 test/teststats.out diff --git a/.JuliaFormatter.toml b/.JuliaFormatter.toml index 15fa654..bee44f1 100644 --- a/.JuliaFormatter.toml +++ b/.JuliaFormatter.toml @@ -1,7 +1,7 @@ -margin = 100 +annotate_untyped_fields_with_any = false indent = 2 -whitespace_typedefs = true -whitespace_ops_in_indices = true +margin = 100 +normalize_line_endings = "unix" remove_extra_newlines = true -annotate_untyped_fields_with_any = false -normalize_line_endings = "unix" \ No newline at end of file +whitespace_ops_in_indices = true +whitespace_typedefs = true diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 0000000..a3e3adc --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,5 @@ +{ + "projectName": "SolverCore", + "projectOwner": "JuliaSmoothOptimizers", + "files": ["README.md", "docs/src/index.md"] +} diff --git a/.breakage/Project.toml b/.breakage/Project.toml index a65fa1c..7f17b55 100644 --- a/.breakage/Project.toml +++ b/.breakage/Project.toml @@ -1,3 +1,3 @@ -[deps] -GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26" -PkgDeps = "839e9fc8-855b-5b3c-a3b7-2833d3dd1f59" +[deps] +GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26" +PkgDeps = "839e9fc8-855b-5b3c-a3b7-2833d3dd1f59" diff --git a/.copier-answers.yml b/.copier-answers.yml new file mode 100644 index 0000000..22edadf --- /dev/null +++ b/.copier-answers.yml @@ -0,0 +1,30 @@ +# Changes here will be overwritten by Copier +AddAllcontributors: true +AddCodeOfConduct: true +AddContributionDocs: true +AddCopierCI: false +AddGitHubTemplates: true +AddMacToCI: true +AddPrecommit: true +AddWinToCI: true +AnswerStrategy: ask +Authors: Tangi Migot , Abel Soares Siqueira , + Dominique Orban +AutoIncludeTests: true +CheckExplicitImports: true +CodeOfConductContact: tangi.migot@gmail.com +ConfigIndentation: 2 +ExplicitImportsChecklist: exclude_all_qualified_access_are_public +JuliaIndentation: 2 +JuliaMinCIVersion: lts +JuliaMinVersion: lts +License: MPL-2.0 +LicenseCopyrightHolders: Tangi Migot, Abel Soares Siqueira, Dominique Orban +MarkdownIndentation: 2 +PackageName: SolverCore +PackageOwner: JuliaSmoothOptimizers +PackageUUID: ff4d7338-4cf1-434d-91df-b86cb86fb843 +RunJuliaNightlyOnCI: true +UseCirrusCI: false +_commit: v0.15.0 +_src_path: https://github.com/JuliaBesties/BestieTemplate.jl diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..cbb163b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +# https://editorconfig.org +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +trim_trailing_whitespace = true + +[*.jl] +indent_size = 2 + +[*.md] +indent_size = 2 + +[*.{yml,toml,json}] +indent_size = 2 diff --git a/.github/ISSUE_TEMPLATE/10-bug-report.yml b/.github/ISSUE_TEMPLATE/10-bug-report.yml new file mode 100644 index 0000000..72b3dbd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/10-bug-report.yml @@ -0,0 +1,60 @@ +name: Bug Report +description: File a bug report related to running the package +title: "[Bug] " +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + + Please, before submitting, make sure that: + + - There is not an [existing issue](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/issues) with the same question + - You have read the [contributing guide](https://JuliaSmoothOptimizers.github.io/SolverCore.jl/dev/90-contributing/) + - You are following the [code of conduct](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/blob/main/CODE_OF_CONDUCT.md) + The form below should help you in filling out this issue. + - type: textarea + id: description + attributes: + label: Description + description: Describe the bug + validations: + required: true + - type: input + id: pkg-version + attributes: + label: Package Version + description: What version of the package are you running? + validations: + required: true + - type: input + id: version + attributes: + label: Julia Version + description: What version of Julia are you running? + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: Reproduction steps + description: What steps led to the bug happening? Please provide a minimal reproducible example. + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + - type: dropdown + id: os + attributes: + label: "Operating System" + description: What is the impacted environment? + multiple: true + options: + - Windows + - Linux + - Mac diff --git a/.github/ISSUE_TEMPLATE/20-feature-request.yml b/.github/ISSUE_TEMPLATE/20-feature-request.yml new file mode 100644 index 0000000..3a32a16 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/20-feature-request.yml @@ -0,0 +1,41 @@ +name: "Feature Request" +description: Suggest a new feature for the package +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this feature request! + + Please, before submitting, make sure that: + + - There is not an [existing issue](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/issues) with the same question + - You have read the [contributing guide](https://JuliaSmoothOptimizers.github.io/SolverCore.jl/dev/90-contributing/) + - You are following the [code of conduct](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/blob/main/CODE_OF_CONDUCT.md) + The form below should help you in filling out this issue. + - type: textarea + id: description + attributes: + label: Description + description: Describe the requested feature + validations: + required: true + - type: textarea + id: validation + attributes: + label: Validation and testing + description: How could we verify that the new feature works? What kind of tests can be done? + - type: textarea + id: motivation + attributes: + label: Motivation + description: Explain why this feature is relevant + - type: textarea + id: target + attributes: + label: Target audience + description: Tell more about the users of this feature, or where it could be useful + - type: textarea + id: can-help + attributes: + label: Can you help? + description: Can you help developing this feature? diff --git a/.github/ISSUE_TEMPLATE/30-usage.yml b/.github/ISSUE_TEMPLATE/30-usage.yml new file mode 100644 index 0000000..93987bb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/30-usage.yml @@ -0,0 +1,23 @@ +name: "Usage question" +description: Questions related to the usage +labels: ["documentation"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this question! + + Please, before submitting, make sure that: + + - You have checked the [documentation](https://JuliaSmoothOptimizers.github.io/SolverCore.jl) and haven't found enough information + - There is not an [existing issue](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/issues) with the same question + - You have read the [contributing guide](https://JuliaSmoothOptimizers.github.io/SolverCore.jl/dev/90-contributing/) + - You are following the [code of conduct](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/blob/main/CODE_OF_CONDUCT.md) + The form below should help you in filling out this issue. + - type: textarea + id: description + attributes: + label: Description + description: Write your question + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/99-general.yml b/.github/ISSUE_TEMPLATE/99-general.yml new file mode 100644 index 0000000..0b8c623 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/99-general.yml @@ -0,0 +1,21 @@ +name: "General issue" +description: In case none of the others templates apply +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this issue! + + Please, before submitting, make sure that: + + - There is not an [existing issue](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/issues) with the same question + - You have read the [contributing guide](https://JuliaSmoothOptimizers.github.io/SolverCore.jl/dev/90-contributing/) + - You are following the [code of conduct](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/blob/main/CODE_OF_CONDUCT.md) + The form below should help you in filling out this issue. + - type: textarea + id: description + attributes: + label: Description + description: Describe the issue + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..ec694c3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Discussions + url: https://github.com/JuliaSmoothOptimizers/SolverCore.jl/discussions + about: Create and follow discussions here diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..663d4f9 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,27 @@ + + +## Related issues + + + + +Closes # + + + + +## Checklist + + + +- [ ] I am following the [contributing guidelines](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/blob/main/docs/src/90-contributing.md) +- [ ] Tests are passing +- [ ] Lint workflow is passing +- [ ] Docs were updated and workflow is passing diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..700707c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/Breakage.yml b/.github/workflows/Breakage.yml index 5a9d623..484ff19 100644 --- a/.github/workflows/Breakage.yml +++ b/.github/workflows/Breakage.yml @@ -1,165 +1,165 @@ -# Ref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests -name: Breakage - -# read-only repo token -# no access to secrets -on: - pull_request: - -jobs: - # Build dynamically the matrix on which the "break" job will run. - # The matrix contains the packages that depend on ${{ env.pkg }}. - # Job "setup_matrix" outputs variable "matrix", which is in turn - # the output of the "getmatrix" step. - # The contents of "matrix" is a JSON description of a matrix used - # in the next step. It has the form - # { - # "pkg": [ - # "PROPACK", - # "LLSModels", - # "FletcherPenaltySolver" - # ] - # } - setup_matrix: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.getmatrix.outputs.matrix }} - env: - pkg: ${{ github.event.repository.name }} - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: 1 - arch: x64 - - id: getmatrix - run: | - julia -e 'using Pkg; Pkg.Registry.add(RegistrySpec(url = "https://github.com/JuliaRegistries/General.git"))' - julia --project=.breakage -e 'using Pkg; Pkg.update(); Pkg.instantiate()' - pkgs=$(julia --project=.breakage .breakage/get_jso_users.jl ${{ env.pkg }}) - vs='["latest", "stable"]' - # Check if pkgs is empty, and set it to a JSON array if necessary - if [[ -z "$pkgs" || "$pkgs" == "String[]" ]]; then - echo "No packages found; exiting successfully." - exit 0 - fi - vs='["latest", "stable"]' - matrix=$(jq -cn --argjson deps "$pkgs" --argjson vers "$vs" '{pkg: $deps, pkgversion: $vers}') # don't escape quotes like many posts suggest - echo "matrix=$matrix" >> "$GITHUB_OUTPUT" - - break: - needs: setup_matrix - if: needs.setup_matrix.result == 'success' && needs.setup_matrix.outputs.matrix != '' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{ fromJSON(needs.setup_matrix.outputs.matrix) }} - - steps: - - uses: actions/checkout@v4 - - # Install Julia - - uses: julia-actions/setup-julia@v2 - with: - version: 1 - arch: x64 - - 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 }}- - - uses: julia-actions/julia-buildpkg@v1 - - # Breakage test - - name: 'Breakage of ${{ matrix.pkg }}, ${{ matrix.pkgversion }} version' - env: - PKG: ${{ matrix.pkg }} - VERSION: ${{ matrix.pkgversion }} - run: | - set -v - mkdir -p ./breakage - git clone https://github.com/JuliaSmoothOptimizers/$PKG.jl.git - cd $PKG.jl - if [ $VERSION == "stable" ]; then - TAG=$(git tag -l "v*" --sort=-creatordate | head -n1) - if [ -z "$TAG" ]; then - TAG="no_tag" - else - git checkout $TAG - fi - else - TAG=$VERSION - fi - export TAG - julia -e 'using Pkg; - PKG, TAG, VERSION = ENV["PKG"], ENV["TAG"], ENV["VERSION"] - joburl = joinpath(ENV["GITHUB_SERVER_URL"], ENV["GITHUB_REPOSITORY"], "actions/runs", ENV["GITHUB_RUN_ID"]) - open("../breakage/breakage-$PKG-$VERSION", "w") do io - try - TAG == "no_tag" && error("No tag for $VERSION") - pkg"activate ."; - pkg"instantiate"; - pkg"dev ../"; - if TAG == "latest" - global TAG = chomp(read(`git rev-parse --short HEAD`, String)) - end - pkg"build"; - pkg"test"; - - print(io, "[![](https://img.shields.io/badge/$TAG-Pass-green)]($joburl)"); - catch e - @error e; - print(io, "[![](https://img.shields.io/badge/$TAG-Fail-red)]($joburl)"); - end; - end' - - - uses: actions/upload-artifact@v4 - with: - name: breakage-${{ matrix.pkg }}-${{ matrix.pkgversion }} - path: breakage/breakage-* - - upload: - needs: break - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/download-artifact@v4 - with: - path: breakage - pattern: breakage-* - merge-multiple: true - - - run: ls -R - - run: | - cd breakage - echo "| Package name | latest | stable |" > summary.md - echo "|--|--|--|" >> summary.md - count=0 - for file in breakage-* - do - if [ $count == "0" ]; then - name=$(echo $file | cut -f2 -d-) - echo -n "| $name | " - else - echo -n "| " - fi - cat $file - if [ $count == "0" ]; then - echo -n " " - count=1 - else - echo " |" - count=0 - fi - done >> summary.md - - - name: PR comment with file - uses: thollander/actions-comment-pull-request@v2 - with: - filePath: breakage/summary.md +# Ref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests +name: Breakage + +# read-only repo token +# no access to secrets +on: + pull_request: + +jobs: + # Build dynamically the matrix on which the "break" job will run. + # The matrix contains the packages that depend on ${{ env.pkg }}. + # Job "setup_matrix" outputs variable "matrix", which is in turn + # the output of the "getmatrix" step. + # The contents of "matrix" is a JSON description of a matrix used + # in the next step. It has the form + # { + # "pkg": [ + # "PROPACK", + # "LLSModels", + # "FletcherPenaltySolver" + # ] + # } + setup_matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.getmatrix.outputs.matrix }} + env: + pkg: ${{ github.event.repository.name }} + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: 1 + arch: x64 + - id: getmatrix + run: | + julia -e 'using Pkg; Pkg.Registry.add(RegistrySpec(url = "https://github.com/JuliaRegistries/General.git"))' + julia --project=.breakage -e 'using Pkg; Pkg.update(); Pkg.instantiate()' + pkgs=$(julia --project=.breakage .breakage/get_jso_users.jl ${{ env.pkg }}) + vs='["latest", "stable"]' + # Check if pkgs is empty, and set it to a JSON array if necessary + if [[ -z "$pkgs" || "$pkgs" == "String[]" ]]; then + echo "No packages found; exiting successfully." + exit 0 + fi + vs='["latest", "stable"]' + matrix=$(jq -cn --argjson deps "$pkgs" --argjson vers "$vs" '{pkg: $deps, pkgversion: $vers}') # don't escape quotes like many posts suggest + echo "matrix=$matrix" >> "$GITHUB_OUTPUT" + + break: + needs: setup_matrix + if: needs.setup_matrix.result == 'success' && needs.setup_matrix.outputs.matrix != '' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.setup_matrix.outputs.matrix) }} + + steps: + - uses: actions/checkout@v4 + + # Install Julia + - uses: julia-actions/setup-julia@v2 + with: + version: 1 + arch: x64 + - 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 }}- + - uses: julia-actions/julia-buildpkg@v1 + + # Breakage test + - name: 'Breakage of ${{ matrix.pkg }}, ${{ matrix.pkgversion }} version' + env: + PKG: ${{ matrix.pkg }} + VERSION: ${{ matrix.pkgversion }} + run: | + set -v + mkdir -p ./breakage + git clone https://github.com/JuliaSmoothOptimizers/$PKG.jl.git + cd $PKG.jl + if [ $VERSION == "stable" ]; then + TAG=$(git tag -l "v*" --sort=-creatordate | head -n1) + if [ -z "$TAG" ]; then + TAG="no_tag" + else + git checkout $TAG + fi + else + TAG=$VERSION + fi + export TAG + julia -e 'using Pkg; + PKG, TAG, VERSION = ENV["PKG"], ENV["TAG"], ENV["VERSION"] + joburl = joinpath(ENV["GITHUB_SERVER_URL"], ENV["GITHUB_REPOSITORY"], "actions/runs", ENV["GITHUB_RUN_ID"]) + open("../breakage/breakage-$PKG-$VERSION", "w") do io + try + TAG == "no_tag" && error("No tag for $VERSION") + pkg"activate ."; + pkg"instantiate"; + pkg"dev ../"; + if TAG == "latest" + global TAG = chomp(read(`git rev-parse --short HEAD`, String)) + end + pkg"build"; + pkg"test"; + + print(io, "[![](https://img.shields.io/badge/$TAG-Pass-green)]($joburl)"); + catch e + @error e; + print(io, "[![](https://img.shields.io/badge/$TAG-Fail-red)]($joburl)"); + end; + end' + + - uses: actions/upload-artifact@v4 + with: + name: breakage-${{ matrix.pkg }}-${{ matrix.pkgversion }} + path: breakage/breakage-* + + upload: + needs: break + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + path: breakage + pattern: breakage-* + merge-multiple: true + + - run: ls -R + - run: | + cd breakage + echo "| Package name | latest | stable |" > summary.md + echo "|--|--|--|" >> summary.md + count=0 + for file in breakage-* + do + if [ $count == "0" ]; then + name=$(echo $file | cut -f2 -d-) + echo -n "| $name | " + else + echo -n "| " + fi + cat $file + if [ $count == "0" ]; then + echo -n " " + count=1 + else + echo " |" + count=0 + fi + done >> summary.md + + - name: PR comment with file + uses: thollander/actions-comment-pull-request@v2 + with: + filePath: breakage/summary.md diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index a26db5b..210e56f 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -1,19 +1,51 @@ +# CompatHelper v3.5.0 name: CompatHelper on: schedule: - - cron: '00 00 * * *' + - cron: 0 0 * * * # Every day at 00:00 UTC + 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@v2 with: - version: 1.6 - - 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: Use Julia cache + uses: julia-actions/cache@v2 + - 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()' + COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} + # COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} diff --git a/.github/workflows/Docs.yml b/.github/workflows/Docs.yml new file mode 100644 index 0000000..8185edd --- /dev/null +++ b/.github/workflows/Docs.yml @@ -0,0 +1,57 @@ +name: Docs + +on: + push: + branches: + - main + paths: + - "docs/**" + - "src/**" + - "*.toml" + tags: ["*"] + pull_request: + branches: + - main + paths: + - "docs/**" + - "src/**" + - "*.toml" + types: [opened, synchronize, reopened] + +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/') }} + +jobs: + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: "1" + - name: Use Julia cache + uses: julia-actions/cache@v2 + - name: Instantiate environment with development version of the package + run: | + julia --project=docs -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' + - name: Run doctest + run: | + julia --project=docs -e ' + using Documenter: DocMeta, doctest + using SolverCore + DocMeta.setdocmeta!(SolverCore, :DocTestSetup, :(using SolverCore); recursive=true) + doctest(SolverCore)' + - name: Generate and deploy documentation + run: julia --project=docs docs/make.jl + env: + JULIA_PKG_SERVER: "" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + GKSwstype: "100" # https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988 diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index be0b865..5575279 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -1,23 +1,23 @@ -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 +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/Lint.yml b/.github/workflows/Lint.yml new file mode 100644 index 0000000..fa36235 --- /dev/null +++ b/.github/workflows/Lint.yml @@ -0,0 +1,62 @@ +name: Lint + +on: + push: + branches: + - main + tags: ["*"] + pull_request: + +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/') }} + +jobs: + lint: + name: Linting + runs-on: ubuntu-latest + steps: + - name: Clone + uses: actions/checkout@v4 + - name: Setup Julia + uses: julia-actions/setup-julia@v2 + with: + version: "1" + - name: Use Julia cache + uses: julia-actions/cache@v2 + - name: Build package (required for ExplicitImports) + uses: julia-actions/julia-buildpkg@v1 + - name: Install Julia packages + run: julia -e 'using Pkg; pkg"add ExplicitImports, JuliaFormatter"' + - name: Hack for setup-python cache # https://github.com/actions/setup-python/issues/807 + run: touch requirements.txt + - name: Setup Python + uses: actions/setup-python@v5 + with: + cache: "pip" + python-version: "3.11" + - name: Hack for setup-python cache # https://github.com/actions/setup-python/issues/807 + run: rm requirements.txt + - name: Cache pre-commit + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }} + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit + run: SKIP=no-commit-to-branch pre-commit run -a + link-checker: + name: Link checker + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v2 + with: + fail: true + args: --config '.lychee.toml' . diff --git a/.github/workflows/PreCommitUpdate.yml b/.github/workflows/PreCommitUpdate.yml new file mode 100644 index 0000000..e5318c5 --- /dev/null +++ b/.github/workflows/PreCommitUpdate.yml @@ -0,0 +1,40 @@ +name: pre-commit Update + +on: + schedule: + - cron: "0 7 1/7 * *" # At 7:00 every 7 days + workflow_dispatch: + +jobs: + pre-commit-update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Hack for setup-python cache # https://github.com/actions/setup-python/issues/807 + run: touch requirements.txt + - name: Setup Python + uses: actions/setup-python@v5 + with: + cache: pip + python-version: "3.11" + - name: Hack for setup-python cache # https://github.com/actions/setup-python/issues/807 + run: rm requirements.txt + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit's autoupdate + run: | + # ignore exit code + pre-commit autoupdate || true + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v7 + with: + commit-message: "chore: :robot: pre-commit update" + title: "[AUTO] pre-commit update" + branch: auto-pre-commit-update + delete-branch: true + labels: chore + - name: Check outputs + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" diff --git a/.github/workflows/ReusableTest.yml b/.github/workflows/ReusableTest.yml new file mode 100644 index 0000000..12431f2 --- /dev/null +++ b/.github/workflows/ReusableTest.yml @@ -0,0 +1,52 @@ +name: Reusable test + +on: + workflow_call: + inputs: + version: + required: false + type: string + default: "1" + os: + required: false + type: string + default: ubuntu-latest + arch: + required: false + type: string + default: x64 + allow_failure: + required: false + type: boolean + default: false + run_codecov: + required: false + type: boolean + default: false + secrets: + codecov_token: + required: true + +jobs: + test: + name: Julia ${{ inputs.version }} - ${{ inputs.os }} - ${{ inputs.arch }} - ${{ github.event_name }} + runs-on: ${{ inputs.os }} + continue-on-error: ${{ inputs.allow_failure }} + + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ inputs.version }} + arch: ${{ inputs.arch }} + - name: Use Julia cache + uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + if: ${{ inputs.run_codecov }} + - uses: codecov/codecov-action@v4 + if: ${{ inputs.run_codecov }} + with: + file: lcov.info + token: ${{ secrets.codecov_token }} diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index 083baf9..dab9b0b 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -1,15 +1,37 @@ -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 }} +name: TagBot + +on: + issue_comment: + types: + - created + workflow_dispatch: + inputs: + lookback: + type: number + default: 3 + +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read + +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 }} + # Edit the following line to reflect the actual name of the GitHub Secret containing your private key + ssh: ${{ secrets.DOCUMENTER_KEY }} + # ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }} diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml new file mode 100644 index 0000000..2de6737 --- /dev/null +++ b/.github/workflows/Test.yml @@ -0,0 +1,46 @@ +name: Test + +on: + push: + branches: + - main + tags: ["*"] + workflow_dispatch: + +jobs: + test: + uses: ./.github/workflows/ReusableTest.yml + with: + os: ${{ matrix.os }} + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + allow_failure: ${{ matrix.allow_failure }} + run_codecov: ${{ matrix.version == '1' && matrix.os == 'ubuntu-latest' }} + secrets: + codecov_token: ${{ secrets.CODECOV_TOKEN }} + strategy: + fail-fast: false + matrix: + version: + - "lts" + - "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 diff --git a/.github/workflows/TestOnPRs.yml b/.github/workflows/TestOnPRs.yml new file mode 100644 index 0000000..19a1f5a --- /dev/null +++ b/.github/workflows/TestOnPRs.yml @@ -0,0 +1,29 @@ +name: Test on PRs + +on: + pull_request: + branches: + - main + paths: + - "src/**" + - "test/**" + - "*.toml" + types: [opened, synchronize, reopened] + +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/') }} + +jobs: + test: + uses: ./.github/workflows/ReusableTest.yml + with: + os: ubuntu-latest + version: "1" + arch: x64 + allow_failure: false + run_codecov: true + secrets: + codecov_token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 409e0d1..33308cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,54 +1,54 @@ -name: CI -on: - push: - branches: - - main - pull_request: - types: [opened, synchronize, reopened] -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 - steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 - with: - version: ${{ matrix.version }} - arch: ${{ matrix.arch }} - - uses: actions/cache@v1 - 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 }}- - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 - - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v1 - with: - file: lcov.info +name: CI +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] +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 + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: actions/cache@v1 + 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 }}- + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v1 + with: + file: lcov.info diff --git a/.github/workflows/format_pr.yml b/.github/workflows/format_pr.yml index c8f5308..30c056e 100644 --- a/.github/workflows/format_pr.yml +++ b/.github/workflows/format_pr.yml @@ -29,4 +29,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/.gitignore b/.gitignore index 2cd4ac3..4d3d00e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,12 @@ -docs/build -docs/Manifest.toml +*.jl.*.cov +*.jl.cov +*.jl.mem +*.rej +.DS_Store +.benchmarkci +Manifest.toml +benchmark/*.json +coverage +docs/build/ +env +node_modules diff --git a/.lychee.toml b/.lychee.toml new file mode 100644 index 0000000..371dfb1 --- /dev/null +++ b/.lychee.toml @@ -0,0 +1,12 @@ +exclude = [ + "@ref", + "@cite", + "^https://github.com/.*/releases/tag/v.*$", + "^https://doi.org/FIXME$", + "^https://JuliaSmoothOptimizers.github.io/SolverCore.jl/stable$", + "zenodo.org/badge/DOI/FIXME$" +] + +exclude_path = [ + "docs/build" +] diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..8bf958a --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,13 @@ +{ + "MD007": { + "indent": 2, + "start_indented": false + }, + "MD013": { + "line_length": 1000, + "tables": false + }, + "MD033": false, + "MD041": false, + "default": true +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..4bbcb1f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,53 @@ +repos: + - repo: local + hooks: + # Prevent committing .rej files + - id: forbidden-files + name: forbidden files + entry: found Copier update rejection files; review them and remove them + language: fail + files: "\\.rej$" + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-json + - id: check-toml + - id: check-yaml + - id: end-of-file-fixer + - id: file-contents-sorter + files: .JuliaFormatter.toml + args: [--unique] + - id: mixed-line-ending + args: [--fix=lf] + - id: no-commit-to-branch + - id: pretty-format-json + args: [--autofix, --indent=2] + - id: trailing-whitespace + - id: check-merge-conflict + args: [--assume-in-merge] + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.43.0 + hooks: + - id: markdownlint-fix + - repo: https://github.com/citation-file-format/cffconvert + rev: 054bda51dbe278b3e86f27c890e3f3ac877d616c + hooks: + - id: validate-cff + - repo: https://github.com/google/yamlfmt + rev: v0.16.0 + hooks: + - id: yamlfmt + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint + - repo: https://github.com/ericphanson/ExplicitImports.jl + rev: v1.10.1 + hooks: + - id: explicit-imports + name: ExplicitImports checks + args: [--print, --checklist, exclude_all_qualified_access_are_public] + - repo: https://github.com/domluna/JuliaFormatter.jl + rev: v2.0.0 + hooks: + - id: julia-formatter diff --git a/.yamlfmt.yml b/.yamlfmt.yml new file mode 100644 index 0000000..6f5fab3 --- /dev/null +++ b/.yamlfmt.yml @@ -0,0 +1,7 @@ +# https://github.com/google/yamlfmt/blob/main/docs/config-file.md +formatter: + type: basic + retain_line_breaks_single: true + indent: 2 +line_ending: lf # matching other hooks settings +exclude: ['.copier-answers.yml'] diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..31bcb02 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,2 @@ +rules: + indentation: {spaces: 2} diff --git a/.zenodo.json b/.zenodo.json index 04d07ec..20ff3d5 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,34 +1,34 @@ { - "description": "Core Definitions for Developing Nonlinear Optimization Solvers", - "title": "SolverCore.jl", - "upload_type": "software", - "license": "MPL-2.0", + "access_right": "open", + "contributors": [ + { + "name": "Alexis Montoison", + "type": "Researcher" + }, + { + "name": "Jean-Pierre Dussault", + "type": "Researcher" + } + ], "creators": [ { - "affiliation": "École Polytechnique/GERAD - Montréal", + "affiliation": "\u00c9cole Polytechnique/GERAD - Montr\u00e9al", "name": "Dominique Orban" }, { - "affiliation": "Federal University of Paraná - UFPR", + "affiliation": "Federal University of Paran\u00e1 - UFPR", "name": "Abel Soares Siqueira" } ], - "access_right": "open", + "description": "Core Definitions for Developing Nonlinear Optimization Solvers", + "license": "MPL-2.0", "related_identifiers": [ { - "scheme": "url", "identifier": "https://github.com/JuliaSmoothOptimizers/SolverCore.jl/releases/latest", - "relation": "isSupplementTo" + "relation": "isSupplementTo", + "scheme": "url" } ], - "contributors": [ - { - "name": "Alexis Montoison", - "type": "Researcher" - }, - { - "name": "Jean-Pierre Dussault", - "type": "Researcher" - } - ] + "title": "SolverCore.jl", + "upload_type": "software" } diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..e9da99b --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,133 @@ + +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official email address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement: +`tangi.migot@gmail.com`. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a612ad9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/LICENSE.md b/LICENSE.md index 7d088ed..d94ea14 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -4,376 +4,388 @@ SolverCore.jl is licensed under the [MPL version 2.0](https://www.mozilla.org/MP ## License - Mozilla Public License Version 2.0 - ================================== +Mozilla Public License Version 2.0 + ================================== - 1. Definitions - -------------- + 1. Definitions - 1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. + -------------- - 1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. + 1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. - 1.3. "Contribution" - means Covered Software of a particular Contributor. + 1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. - 1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. + 1.3. "Contribution" + means Covered Software of a particular Contributor. - 1.5. "Incompatible With Secondary Licenses" - means + 1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or + 1.5. "Incompatible With Secondary Licenses" + means - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or - 1.6. "Executable Form" - means any form of the work other than Source Code Form. + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. - 1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. + 1.6. "Executable Form" + means any form of the work other than Source Code Form. - 1.8. "License" - means this document. + 1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. - 1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. + 1.8. "License" + means this document. - 1.10. "Modifications" - means any of the following: + 1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or + 1.10. "Modifications" + means any of the following: - (b) any new file in Source Code Form that contains any Covered - Software. + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or - 1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. + (b) any new file in Source Code Form that contains any Covered + Software. - 1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. + 1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. - 1.13. "Source Code Form" - means the form of the work preferred for making modifications. + 1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. - 1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. + 1.13. "Source Code Form" + means the form of the work preferred for making modifications. - 2. License Grants and Conditions - -------------------------------- + 1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. - 2.1. Grants + 2. License Grants and Conditions - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: + -------------------------------- - (a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and + 2.1. Grants - (b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. + Each Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: - 2.2. Effective Date + (a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. + (b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. - 2.3. Limitations on Grant Scope + 2.2. Effective Date - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - (a) for any code that a Contributor has removed from Covered Software; - or - - (b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - (c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - - 2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - - 2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights - to grant the rights to its Contributions conveyed by this License. - - 2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - - 2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted - in Section 2.1. - - 3. Responsibilities - ------------------- - - 3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - - 3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - (a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - - (b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - - 3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - - 3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, - or limitations of liability) contained within the Source Code Form of - the Covered Software, except that You may alter any license notices to - the extent required to remedy known factual inaccuracies. - - 3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - - 4. Inability to Comply Due to Statute or Regulation - --------------------------------------------------- - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Software due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description must - be placed in a text file included with all distributions of the Covered - Software under this License. Except to the extent prohibited by statute - or regulation, such description must be sufficiently detailed for a - recipient of ordinary skill to be able to understand it. - - 5. Termination - -------------- - - 5.1. The rights granted under this License will terminate automatically - if You fail to comply with any of its terms. However, if You become - compliant, then the rights granted under this License from a particular - Contributor are reinstated (a) provisionally, unless and until such - Contributor explicitly and finally terminates Your grants, and (b) on an - ongoing basis, if such Contributor fails to notify You of the - non-compliance by some reasonable means prior to 60 days after You have - come back into compliance. Moreover, Your grants from a particular - Contributor are reinstated on an ongoing basis if such Contributor - notifies You of the non-compliance by some reasonable means, this is the - first time You have received notice of non-compliance with this License - from such Contributor, and You become compliant prior to 30 days after - Your receipt of the notice. - - 5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - - 5.3. In the event of termination under Sections 5.1 or 5.2 above, all - end user license agreements (excluding distributors and resellers) which - have been validly granted by You or Your distributors under this License - prior to termination shall survive termination. - - ************************************************************************ - * * - * 6. Disclaimer of Warranty * - * ------------------------- * - * * - * Covered Software is provided under this License on an "as is" * - * basis, without warranty of any kind, either expressed, implied, or * - * statutory, including, without limitation, warranties that the * - * Covered Software is free of defects, merchantable, fit for a * - * particular purpose or non-infringing. The entire risk as to the * - * quality and performance of the Covered Software is with You. * - * Should any Covered Software prove defective in any respect, You * - * (not any Contributor) assume the cost of any necessary servicing, * - * repair, or correction. This disclaimer of warranty constitutes an * - * essential part of this License. No use of any Covered Software is * - * authorized under this License except under this disclaimer. * - * * - ************************************************************************ - - ************************************************************************ - * * - * 7. Limitation of Liability * - * -------------------------- * - * * - * Under no circumstances and under no legal theory, whether tort * - * (including negligence), contract, or otherwise, shall any * - * Contributor, or anyone who distributes Covered Software as * - * permitted above, be liable to You for any direct, indirect, * - * special, incidental, or consequential damages of any character * - * including, without limitation, damages for lost profits, loss of * - * goodwill, work stoppage, computer failure or malfunction, or any * - * and all other commercial damages or losses, even if such party * - * shall have been informed of the possibility of such damages. This * - * limitation of liability shall not apply to liability for death or * - * personal injury resulting from such party's negligence to the * - * extent applicable law prohibits such limitation. Some * - * jurisdictions do not allow the exclusion or limitation of * - * incidental or consequential damages, so this exclusion and * - * limitation may not apply to You. * - * * - ************************************************************************ - - 8. Litigation - ------------- - - Any litigation relating to this License may be brought only in the - courts of a jurisdiction where the defendant maintains its principal - place of business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. - Nothing in this Section shall prevent a party's ability to bring - cross-claims or counter-claims. - - 9. Miscellaneous - ---------------- - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides - that the language of a contract shall be construed against the drafter - shall not be used to construe this License against a Contributor. - - 10. Versions of the License - --------------------------- - - 10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - - 10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - - 10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - - 10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses - - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - - Exhibit A - Source Code Form License Notice - ------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - - If it is not possible or desirable to put the notice in a particular - file, then You may include the notice in a location (such as a LICENSE - file in a relevant directory) where a recipient would be likely to look - for such a notice. - - You may add additional accurate notices of copyright ownership. - - Exhibit B - "Incompatible With Secondary Licenses" Notice - --------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. + The licenses granted in Section 2.1 with respect to any Contribution + become effective for each Contribution on the date the Contributor first + distributes such Contribution. + + 2.3. Limitations on Grant Scope + + The licenses granted in this Section 2 are the only rights granted under + this License. No additional rights or licenses will be implied from the + distribution or licensing of Covered Software under this License. + Notwithstanding Section 2.1(b) above, no patent license is granted by a + Contributor: + + (a) for any code that a Contributor has removed from Covered Software; + or + + (b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + + (c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + + This License does not grant any rights in the trademarks, service marks, + or logos of any Contributor (except as may be necessary to comply with + the notice requirements in Section 3.4). + + 2.4. Subsequent Licenses + + No Contributor makes additional grants as a result of Your choice to + distribute the Covered Software under a subsequent version of this + License (see Section 10.2) or under the terms of a Secondary License (if + permitted under the terms of Section 3.3). + + 2.5. Representation + + Each Contributor represents that the Contributor believes its + Contributions are its original creation(s) or it has sufficient rights + to grant the rights to its Contributions conveyed by this License. + + 2.6. Fair Use + + This License is not intended to limit any rights You have under + applicable copyright doctrines of fair use, fair dealing, or other + equivalents. + + 2.7. Conditions + + Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted + in Section 2.1. + + 3. Responsibilities + + ------------------- + + 3.1. Distribution of Source Form + + All distribution of Covered Software in Source Code Form, including any + Modifications that You create or to which You contribute, must be under + the terms of this License. You must inform recipients that the Source + Code Form of the Covered Software is governed by the terms of this + License, and how they can obtain a copy of this License. You may not + attempt to alter or restrict the recipients' rights in the Source Code + Form. + + 3.2. Distribution of Executable Form + + If You distribute Covered Software in Executable Form then: + + (a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + + (b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + + 3.3. Distribution of a Larger Work + + You may create and distribute a Larger Work under terms of Your choice, + provided that You also comply with the requirements of this License for + the Covered Software. If the Larger Work is a combination of Covered + Software with a work governed by one or more Secondary Licenses, and the + Covered Software is not Incompatible With Secondary Licenses, this + License permits You to additionally distribute such Covered Software + under the terms of such Secondary License(s), so that the recipient of + the Larger Work may, at their option, further distribute the Covered + Software under the terms of either this License or such Secondary + License(s). + + 3.4. Notices + + You may not remove or alter the substance of any license notices + (including copyright notices, patent notices, disclaimers of warranty, + or limitations of liability) contained within the Source Code Form of + the Covered Software, except that You may alter any license notices to + the extent required to remedy known factual inaccuracies. + + 3.5. Application of Additional Terms + + You may choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of Covered + Software. However, You may do so only on Your own behalf, and not on + behalf of any Contributor. You must make it absolutely clear that any + such warranty, support, indemnity, or liability obligation is offered by + You alone, and You hereby agree to indemnify every Contributor for any + liability incurred by such Contributor as a result of warranty, support, + indemnity or liability terms You offer. You may include additional + disclaimers of warranty and limitations of liability specific to any + jurisdiction. + + 4. Inability to Comply Due to Statute or Regulation + + --------------------------------------------------- + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Software due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description must + be placed in a text file included with all distributions of the Covered + Software under this License. Except to the extent prohibited by statute + or regulation, such description must be sufficiently detailed for a + recipient of ordinary skill to be able to understand it. + + 5. Termination + + -------------- + + 5.1. The rights granted under this License will terminate automatically + if You fail to comply with any of its terms. However, if You become + compliant, then the rights granted under this License from a particular + Contributor are reinstated (a) provisionally, unless and until such + Contributor explicitly and finally terminates Your grants, and (b) on an + ongoing basis, if such Contributor fails to notify You of the + non-compliance by some reasonable means prior to 60 days after You have + come back into compliance. Moreover, Your grants from a particular + Contributor are reinstated on an ongoing basis if such Contributor + notifies You of the non-compliance by some reasonable means, this is the + first time You have received notice of non-compliance with this License + from such Contributor, and You become compliant prior to 30 days after + Your receipt of the notice. + + 5.2. If You initiate litigation against any entity by asserting a patent + infringement claim (excluding declaratory judgment actions, + counter-claims, and cross-claims) alleging that a Contributor Version + directly or indirectly infringes any patent, then the rights granted to + You by any and all Contributors for the Covered Software under Section + 2.1 of this License shall terminate. + + 5.3. In the event of termination under Sections 5.1 or 5.2 above, all + end user license agreements (excluding distributors and resellers) which + have been validly granted by You or Your distributors under this License + prior to termination shall survive termination. + + ************************************************************************ + +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * + + ************************************************************************ + + ************************************************************************ + +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * + + ************************************************************************ + + 8. Litigation + + ------------- + + Any litigation relating to this License may be brought only in the + courts of a jurisdiction where the defendant maintains its principal + place of business and such litigation shall be governed by laws of that + jurisdiction, without reference to its conflict-of-law provisions. + Nothing in this Section shall prevent a party's ability to bring + cross-claims or counter-claims. + + 9. Miscellaneous + + ---------------- + + This License represents the complete agreement concerning the subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. Any law or regulation which provides + that the language of a contract shall be construed against the drafter + shall not be used to construe this License against a Contributor. + + 10. Versions of the License + + --------------------------- + + 10.1. New Versions + + Mozilla Foundation is the license steward. Except as provided in Section + 10.3, no one other than the license steward has the right to modify or + publish new versions of this License. Each version will be given a + distinguishing version number. + + 10.2. Effect of New Versions + + You may distribute the Covered Software under the terms of the version + of the License under which You originally received the Covered Software, + or under the terms of any subsequent version published by the license + steward. + + 10.3. Modified Versions + + If you create software not governed by this License, and you want to + create a new license for such software, you may create and use a + modified version of this License if you rename the license and remove + any references to the name of the license steward (except to note that + such modified license differs from this License). + + 10.4. Distributing Source Code Form that is Incompatible With Secondary + Licenses + + If You choose to distribute Source Code Form that is Incompatible With + Secondary Licenses under the terms of this version of the License, the + notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice + ------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at . + + If it is not possible or desirable to put the notice in a particular + file, then You may include the notice in a location (such as a LICENSE + file in a relevant directory) where a recipient would be likely to look + for such a notice. + + You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice + --------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/README.md b/README.md index ecbd576..a316ca3 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,41 @@ # SolverCore +[![Stable Documentation](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaSmoothOptimizers.github.io/SolverCore.jl/stable) +[![In development documentation](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaSmoothOptimizers.github.io/SolverCore.jl/dev) +[![Build Status](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/workflows/Test/badge.svg)](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/actions) +[![Test workflow status](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/actions/workflows/Test.yml/badge.svg?branch=main)](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/actions/workflows/Test.yml?query=branch%3Amain) +[![Lint workflow Status](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/actions/workflows/Lint.yml/badge.svg?branch=main)](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/actions/workflows/Lint.yml?query=branch%3Amain) +[![Docs workflow Status](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/actions/workflows/Docs.yml/badge.svg?branch=main)](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/actions/workflows/Docs.yml?query=branch%3Amain) +[![Coverage](https://codecov.io/gh/JuliaSmoothOptimizers/SolverCore.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JuliaSmoothOptimizers/SolverCore.jl) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4758376.svg)](https://doi.org/10.5281/zenodo.4758376) -![CI](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/workflows/CI/badge.svg?branch=main) -[![Build Status](https://api.cirrus-ci.com/github/JuliaSmoothOptimizers/SolverCore.jl.svg)](https://cirrus-ci.com/github/JuliaSmoothOptimizers/SolverCore.jl) -[![Stable](https://img.shields.io/badge/docs-stable-3f51b5.svg)](https://JuliaSmoothOptimizers.github.io/SolverCore.jl/stable) -[![Dev](https://img.shields.io/badge/docs-dev-3f51b5.svg)](https://JuliaSmoothOptimizers.github.io/SolverCore.jl/dev) -[![codecov](https://codecov.io/gh/JuliaSmoothOptimizers/SolverCore.jl/branch/main/graph/badge.svg?token=KEKgV7oF2t)](https://codecov.io/gh/JuliaSmoothOptimizers/SolverCore.jl) +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) +[![All Contributors](https://img.shields.io/github/all-contributors/JuliaSmoothOptimizers/SolverCore.jl?labelColor=5e1ec7&color=c0ffee&style=flat-square)](#contributors) +[![BestieTemplate](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/JuliaBesties/BestieTemplate.jl/main/docs/src/assets/badge.json)](https://github.com/JuliaBesties/BestieTemplate.jl) -Core package to build novel optimization algorithms in Julia. +Core package to build novel algorithms in Julia. -Please cite this repository if you use SolverCore.jl in your work: see [`CITATION.cff`](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/blob/main/CITATION.cff). +## How to Cite -# Installation +If you use SolverCore.jl in your work, please cite using the reference given in [CITATION.cff](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/blob/main/CITATION.cff). -``` -add SolverCore -``` - -# Bug reports and discussions +## Contributing If you think you found a bug, feel free to open an [issue](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/issues). Focused suggestions and requests can also be opened as issues. Before opening a pull request, start an issue or a discussion on the topic, please. If you want to ask a question not suited for a bug report, feel free to start a discussion [here](https://github.com/JuliaSmoothOptimizers/Organization/discussions). This forum is for general discussion about this repository and the [JuliaSmoothOptimizers](https://github.com/JuliaSmoothOptimizers) organization, so questions about any of our packages are welcome. + +If you want to make contributions of any kind, please first that a look into our [contributing guide directly on GitHub](docs/src/90-contributing.md) or the [contributing page on the website](https://JuliaSmoothOptimizers.github.io/SolverCore.jl/dev/90-contributing/) + +--- + +### Contributors + + + + + + + + + diff --git a/docs/make.jl b/docs/make.jl index 52dd77e..ed656b1 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,23 +1,21 @@ -using Documenter, SolverCore +using SolverCore +using Documenter -makedocs( +DocMeta.setdocmeta!(SolverCore, :DocTestSetup, :(using SolverCore); recursive = true) + +const page_rename = Dict("developer.md" => "Developer docs") # Without the numbers +const numbered_pages = [ + file for + file in readdir(joinpath(@__DIR__, "src")) if file != "index.md" && splitext(file)[2] == ".md" +] + +makedocs(; modules = [SolverCore], - doctest = true, - linkcheck = true, - format = Documenter.HTML( - assets = ["assets/style.css"], - prettyurls = get(ENV, "CI", nothing) == "true", - ), + authors = "Tangi Migot , Abel Soares Siqueira , Dominique Orban ", + repo = "https://github.com/JuliaSmoothOptimizers/SolverCore.jl/blob/{commit}{path}#{line}", sitename = "SolverCore.jl", - pages = [ - "Home" => "index.md", - "JSO-compliant solvers" => "jso-compliant.md", - "Reference" => "reference.md", - ], + format = Documenter.HTML(; canonical = "https://JuliaSmoothOptimizers.github.io/SolverCore.jl"), + pages = ["index.md"; numbered_pages], ) -deploydocs( - repo = "github.com/JuliaSmoothOptimizers/SolverCore.jl.git", - push_preview = true, - devbranch = "main", -) +deploydocs(; repo = "github.com/JuliaSmoothOptimizers/SolverCore.jl") diff --git a/docs/src/jso-compliant.md b/docs/src/1-jso-compliant.md similarity index 100% rename from docs/src/jso-compliant.md rename to docs/src/1-jso-compliant.md diff --git a/docs/src/90-contributing.md b/docs/src/90-contributing.md new file mode 100644 index 0000000..38616b2 --- /dev/null +++ b/docs/src/90-contributing.md @@ -0,0 +1,25 @@ +# [Contributing guidelines](@id contributing) + +First of all, thanks for the interest! + +We welcome all kinds of contribution, including, but not limited to code, documentation, examples, configuration, issue creating, etc. + +Be polite and respectful, and follow the code of conduct. + +## Bug reports and discussions + +If you think you found a bug, feel free to open an [issue](https://github.com/JuliaSmoothOptimizers/SolverCore.jl/issues). +Focused suggestions and requests can also be opened as issues. +Before opening a pull request, start an issue or a discussion on the topic, please. + +## Working on an issue + +If you found an issue that interests you, comment on that issue what your plans are. +If the solution to the issue is clear, you can immediately create a pull request (see below). +Otherwise, say what your proposed solution is and wait for a discussion around it. + +!!! tip + Feel free to ping us after a few days if there are no responses. + +If your solution involves code (or something that requires running the package locally), check the [developer documentation](91-developer.md). +Otherwise, you can use the GitHub interface directly to create your pull request. diff --git a/docs/src/91-developer.md b/docs/src/91-developer.md new file mode 100644 index 0000000..537ca5a --- /dev/null +++ b/docs/src/91-developer.md @@ -0,0 +1,163 @@ +# [Developer documentation](@id dev_docs) + +!!! note "Contributing guidelines" + If you haven't, please read the [Contributing guidelines](90-contributing.md) first. + +If you want to make contributions to this package that involves code, then this guide is for you. + +## First time clone + +!!! tip "If you have writing rights" + If you have writing rights, you don't have to fork. Instead, simply clone and skip ahead. Whenever **upstream** is mentioned, use **origin** instead. + +If this is the first time you work with this repository, follow the instructions below to clone the repository. + +1. Fork this repo +2. Clone your repo (this will create a `git remote` called `origin`) +3. Add this repo as a remote: + + ```bash + git remote add upstream https://github.com/JuliaSmoothOptimizers/SolverCore.jl + ``` + +This will ensure that you have two remotes in your git: `origin` and `upstream`. +You will create branches and push to `origin`, and you will fetch and update your local `main` branch from `upstream`. + +## Linting and formatting + +Install a plugin on your editor to use [EditorConfig](https://editorconfig.org). +This will ensure that your editor is configured with important formatting settings. + +We use [https://pre-commit.com](https://pre-commit.com) to run the linters and formatters. +In particular, the Julia code is formatted using [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl), so please install it globally first: + +```julia-repl +julia> # Press ] +pkg> activate +pkg> add JuliaFormatter +``` + +To install `pre-commit`, we recommend using [pipx](https://pipx.pypa.io) as follows: + +```bash +# Install pipx following the link +pipx install pre-commit +``` + +With `pre-commit` installed, activate it as a pre-commit hook: + +```bash +pre-commit install +``` + +To run the linting and formatting manually, enter the command below: + +```bash +pre-commit run -a +``` + +**Now, you can only commit if all the pre-commit tests pass**. + +## Testing + +As with most Julia packages, you can just open Julia in the repository folder, activate the environment, and run `test`: + +```julia-repl +julia> # press ] +pkg> activate . +pkg> test +``` + +## Working on a new issue + +We try to keep a linear history in this repo, so it is important to keep your branches up-to-date. + +1. Fetch from the remote and fast-forward your local main + + ```bash + git fetch upstream + git switch main + git merge --ff-only upstream/main + ``` + +2. Branch from `main` to address the issue (see below for naming) + + ```bash + git switch -c 42-add-answer-universe + ``` + +3. Push the new local branch to your personal remote repository + + ```bash + git push -u origin 42-add-answer-universe + ``` + +4. Create a pull request to merge your remote branch into the org main. + +### Branch naming + +- If there is an associated issue, add the issue number. +- If there is no associated issue, **and the changes are small**, add a prefix such as "typo", "hotfix", "small-refactor", according to the type of update. +- If the changes are not small and there is no associated issue, then create the issue first, so we can properly discuss the changes. +- Use dash separated imperative wording related to the issue (e.g., `14-add-tests`, `15-fix-model`, `16-remove-obsolete-files`). + +### Commit message + +- Use imperative or present tense, for instance: *Add feature* or *Fix bug*. +- Have informative titles. +- When necessary, add a body with details. +- If there are breaking changes, add the information to the commit message. + +### Before creating a pull request + +!!! tip "Atomic git commits" + Try to create "atomic git commits" (recommended reading: [The Utopic Git History](https://blog.esciencecenter.nl/the-utopic-git-history-d44b81c09593)). + +- Make sure the tests pass. +- Make sure the pre-commit tests pass. +- Fetch any `main` updates from upstream and rebase your branch, if necessary: + + ```bash + git fetch upstream + git rebase upstream/main BRANCH_NAME + ``` + +- Then you can open a pull request and work with the reviewer to address any issues. + +## Building and viewing the documentation locally + +Following the latest suggestions, we recommend using `LiveServer` to build the documentation. +Here is how you do it: + +1. Run `julia --project=docs` to open Julia in the environment of the docs. +1. If this is the first time building the docs + 1. Press `]` to enter `pkg` mode + 1. Run `pkg> dev .` to use the development version of your package + 1. Press backspace to leave `pkg` mode +1. Run `julia> using LiveServer` +1. Run `julia> servedocs()` + +## Making a new release + +To create a new release, you can follow these simple steps: + +- Create a branch `release-x.y.z` +- Update `version` in `Project.toml` +- Update the `CHANGELOG.md`: + - Rename the section "Unreleased" to "[x.y.z] - yyyy-mm-dd" (i.e., version under brackets, dash, and date in ISO format) + - Add a new section on top of it named "Unreleased" + - Add a new link in the bottom for version "x.y.z" + - Change the "[unreleased]" link to use the latest version - end of line, `vx.y.z ... HEAD`. +- Create a commit "Release vx.y.z", push, create a PR, wait for it to pass, merge the PR. +- Go back to main screen and click on the latest commit (link: ) +- At the bottom, write `@JuliaRegistrator register` + +After that, you only need to wait and verify: + +- Wait for the bot to comment (should take < 1m) with a link to a PR to the registry +- Follow the link and wait for a comment on the auto-merge +- The comment should said all is well and auto-merge should occur shortly +- After the merge happens, TagBot will trigger and create a new GitHub tag. Check on +- After the release is create, a "docs" GitHub action will start for the tag. +- After it passes, a deploy action will run. +- After that runs, the [stable docs](https://JuliaSmoothOptimizers.github.io/SolverCore.jl/stable) should be updated. Check them and look for the version number. diff --git a/docs/src/95-reference.md b/docs/src/95-reference.md new file mode 100644 index 0000000..36b3ecc --- /dev/null +++ b/docs/src/95-reference.md @@ -0,0 +1,17 @@ +# [Reference](@id reference) + +## Contents + +```@contents +Pages = ["95-reference.md"] +``` + +## Index + +```@index +Pages = ["95-reference.md"] +``` + +```@autodocs +Modules = [SolverCore] +``` diff --git a/docs/src/index.md b/docs/src/index.md index 3f547d2..fc76025 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,3 +1,22 @@ -# [SolverCore.jl documentation](@id Home) +```@meta +CurrentModule = SolverCore +``` -Core package to build novel optimization algorithms in Julia. +# SolverCore + +Documentation for [SolverCore](https://github.com/JuliaSmoothOptimizers/SolverCore.jl). + +Core package to build novel algorithms in Julia. + +## Contributors + +```@raw html + + + + + + + + +``` diff --git a/docs/src/reference.md b/docs/src/reference.md index 2dfbe3d..e2bd009 100644 --- a/docs/src/reference.md +++ b/docs/src/reference.md @@ -1,17 +1,27 @@ # Reference + ​ + ## Contents + ​ + ```@contents Pages = ["reference.md"] ``` + ​ + ## Index + ​ + ```@index Pages = ["reference.md"] ``` + ​ + ```@autodocs Modules = [SolverCore] -``` \ No newline at end of file +``` diff --git a/src/stats.jl b/src/stats.jl index 3b05bd6..451dc6d 100644 --- a/src/stats.jl +++ b/src/stats.jl @@ -216,7 +216,7 @@ end Reset the internal flags of `stats` to `false` to Indicate that the contents should not be trusted. -If an `AbstractNLPModel` is also provided, +If an `AbstractNLPModel` is also provided, the pre-allocated vectors are adjusted to the problem size. """ function NLPModels.reset!(stats::GenericExecutionStats) diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..fa10378 --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,6 @@ +[deps] +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" +NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6" +NLPModelsTest = "7998695d-6960-4d3a-85c4-e1bceb8cd856" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/runtests.jl b/test/runtests.jl index 141d676..c86245c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,27 +1,25 @@ -# This package using SolverCore - +using Test # Auxiliary packages using NLPModels, NLPModelsTest - # stdlib -using LinearAlgebra, Logging, Test +using LinearAlgebra, Logging + +#= +Don't add your tests to runtests.jl. Instead, create files named -if VERSION ≥ v"1.6" - @testset "Test allocations of solver specific" begin - nlp = BROWNDEN() - stats = GenericExecutionStats(nlp) # stats = GenericExecutionStats(nlp, solver_specific = Dict{Symbol, Bool}()) - function fake_solver(stats) - set_solver_specific!(stats, :test, true) - return stats + test-title-for-my-test.jl + +The file will be automatically included inside a `@testset` with title "Title For My Test". +=# +for (root, dirs, files) in walkdir(@__DIR__) + for file in files + if isnothing(match(r"^test-.*\.jl$", file)) + continue + end + title = titlecase(replace(splitext(file[6:end])[1], "-" => " ")) + @testset "$title" begin + include(file) end - @allocated fake_solver(stats) - a = @allocated fake_solver(stats) - @test a == 0 end end - -include("test_logging.jl") -include("test_stats.jl") -include("test_callback.jl") -include("test_restart.jl") diff --git a/test/test-allocs.jl b/test/test-allocs.jl new file mode 100644 index 0000000..aecf4e6 --- /dev/null +++ b/test/test-allocs.jl @@ -0,0 +1,13 @@ +if VERSION ≥ v"1.6" + @testset "Test allocations of solver specific" begin + nlp = BROWNDEN() + stats = GenericExecutionStats(nlp) # stats = GenericExecutionStats(nlp, solver_specific = Dict{Symbol, Bool}()) + function fake_solver(stats) + set_solver_specific!(stats, :test, true) + return stats + end + @allocated fake_solver(stats) + a = @allocated fake_solver(stats) + @test a == 0 + end +end diff --git a/test/test_callback.jl b/test/test-callback.jl similarity index 100% rename from test/test_callback.jl rename to test/test-callback.jl diff --git a/test/test_logging.jl b/test/test-logging.jl similarity index 100% rename from test/test_logging.jl rename to test/test-logging.jl diff --git a/test/test_restart.jl b/test/test-restart.jl similarity index 100% rename from test/test_restart.jl rename to test/test-restart.jl diff --git a/test/test_stats.jl b/test/test-stats.jl similarity index 100% rename from test/test_stats.jl rename to test/test-stats.jl diff --git a/test/teststats.out b/test/teststats.out new file mode 100644 index 0000000..903b6e7 --- /dev/null +++ b/test/teststats.out @@ -0,0 +1,30 @@ +Generic Execution stats + status: first-order stationary + objective value: 1.0 + primal feasibility: 0.0 + dual feasibility: 1.0e-12 + solution: [1.0 1.0] + multipliers: [1.0e-323] + iterations: 10 + elapsed time: Inf + solver specific: + empty_vec: ∅ + dot: 25 + axpy: 20 + ray: [-1.0 -0.5 -0.3333333333333333 -0.25 ⋯ -0.01] + matvec: 10 +Generic Execution stats + status: first-order stationary + objective value: 1.0 + primal feasibility: 0.0 + dual feasibility: 1.0e-12 + solution: [1.0, 1.0] + multipliers: [1.0e-323] + iterations: 10 + elapsed time: Inf + solver specific: + empty_vec: Any[] + dot: 25 + axpy: 20 + ray: [-1.0, -0.5, -0.3333333333333333, -0.25, -0.2, -0.16666666666666666, -0.14285714285714285, -0.125, -0.1111111111111111, -0.1, -0.09090909090909091, -0.08333333333333333, -0.07692307692307693, -0.07142857142857142, -0.06666666666666667, -0.0625, -0.058823529411764705, -0.05555555555555555, -0.05263157894736842, -0.05, -0.047619047619047616, -0.045454545454545456, -0.043478260869565216, -0.041666666666666664, -0.04, -0.038461538461538464, -0.037037037037037035, -0.03571428571428571, -0.034482758620689655, -0.03333333333333333, -0.03225806451612903, -0.03125, -0.030303030303030304, -0.029411764705882353, -0.02857142857142857, -0.027777777777777776, -0.02702702702702703, -0.02631578947368421, -0.02564102564102564, -0.025, -0.024390243902439025, -0.023809523809523808, -0.023255813953488372, -0.022727272727272728, -0.022222222222222223, -0.021739130434782608, -0.02127659574468085, -0.020833333333333332, -0.02040816326530612, -0.02, -0.0196078431372549, -0.019230769230769232, -0.018867924528301886, -0.018518518518518517, -0.01818181818181818, -0.017857142857142856, -0.017543859649122806, -0.017241379310344827, -0.01694915254237288, -0.016666666666666666, -0.01639344262295082, -0.016129032258064516, -0.015873015873015872, -0.015625, -0.015384615384615385, -0.015151515151515152, -0.014925373134328358, -0.014705882352941176, -0.014492753623188406, -0.014285714285714285, -0.014084507042253521, -0.013888888888888888, -0.0136986301369863, -0.013513513513513514, -0.013333333333333334, -0.013157894736842105, -0.012987012987012988, -0.01282051282051282, -0.012658227848101266, -0.0125, -0.012345679012345678, -0.012195121951219513, -0.012048192771084338, -0.011904761904761904, -0.011764705882352941, -0.011627906976744186, -0.011494252873563218, -0.011363636363636364, -0.011235955056179775, -0.011111111111111112, -0.01098901098901099, -0.010869565217391304, -0.010752688172043012, -0.010638297872340425, -0.010526315789473684, -0.010416666666666666, -0.010309278350515464, -0.01020408163265306, -0.010101010101010102, -0.01] + matvec: 10 From 5ac7b22f263c08165c414da5f106ff18757c5eff Mon Sep 17 00:00:00 2001 From: tmigot Date: Fri, 28 Mar 2025 08:01:34 -0400 Subject: [PATCH 2/6] up --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33308cd..6977623 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v1 + - uses: actions/cache@v4 env: cache-name: cache-artifacts with: From 32b9234fd4da88de2f629bf15483b1aa10c01e11 Mon Sep 17 00:00:00 2001 From: tmigot Date: Fri, 28 Mar 2025 08:05:12 -0400 Subject: [PATCH 3/6] up doc --- docs/src/reference.md | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 docs/src/reference.md diff --git a/docs/src/reference.md b/docs/src/reference.md deleted file mode 100644 index e2bd009..0000000 --- a/docs/src/reference.md +++ /dev/null @@ -1,27 +0,0 @@ -# Reference - -​ - -## Contents - -​ - -```@contents -Pages = ["reference.md"] -``` - -​ - -## Index - -​ - -```@index -Pages = ["reference.md"] -``` - -​ - -```@autodocs -Modules = [SolverCore] -``` From 2bdc502521892db236390f8e65ed590dfdf418cf Mon Sep 17 00:00:00 2001 From: tmigot Date: Fri, 28 Mar 2025 08:27:37 -0400 Subject: [PATCH 4/6] fix linter --- .pre-commit-config.yaml | 2 +- LICENSE.md | 391 ---------------------------------------- src/SolverCore.jl | 22 ++- src/dummy_solver.jl | 2 +- 4 files changed, 19 insertions(+), 398 deletions(-) delete mode 100644 LICENSE.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4bbcb1f..8b2e24c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,7 +46,7 @@ repos: hooks: - id: explicit-imports name: ExplicitImports checks - args: [--print, --checklist, exclude_all_qualified_access_are_public] + args: [--print, --checklist, "exclude_all_qualified_accesses_are_public"] - repo: https://github.com/domluna/JuliaFormatter.jl rev: v2.0.0 hooks: diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index d94ea14..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,391 +0,0 @@ -Copyright (c) 2015-present: Tangi Migot and Dominique Orban and Abel Soares Siqueira - -SolverCore.jl is licensed under the [MPL version 2.0](https://www.mozilla.org/MPL/2.0/). - -## License - -Mozilla Public License Version 2.0 - ================================== - - 1. Definitions - - -------------- - - 1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - - 1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - - 1.3. "Contribution" - means Covered Software of a particular Contributor. - - 1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - - 1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - - 1.6. "Executable Form" - means any form of the work other than Source Code Form. - - 1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - - 1.8. "License" - means this document. - - 1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - - 1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - - 1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - - 1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - - 1.13. "Source Code Form" - means the form of the work preferred for making modifications. - - 1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - - 2. License Grants and Conditions - - -------------------------------- - - 2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - - (b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - - 2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. - - 2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - (a) for any code that a Contributor has removed from Covered Software; - or - - (b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - (c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - - 2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - - 2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights - to grant the rights to its Contributions conveyed by this License. - - 2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - - 2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted - in Section 2.1. - - 3. Responsibilities - - ------------------- - - 3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - - 3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - (a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - - (b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - - 3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - - 3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, - or limitations of liability) contained within the Source Code Form of - the Covered Software, except that You may alter any license notices to - the extent required to remedy known factual inaccuracies. - - 3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - - 4. Inability to Comply Due to Statute or Regulation - - --------------------------------------------------- - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Software due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description must - be placed in a text file included with all distributions of the Covered - Software under this License. Except to the extent prohibited by statute - or regulation, such description must be sufficiently detailed for a - recipient of ordinary skill to be able to understand it. - - 5. Termination - - -------------- - - 5.1. The rights granted under this License will terminate automatically - if You fail to comply with any of its terms. However, if You become - compliant, then the rights granted under this License from a particular - Contributor are reinstated (a) provisionally, unless and until such - Contributor explicitly and finally terminates Your grants, and (b) on an - ongoing basis, if such Contributor fails to notify You of the - non-compliance by some reasonable means prior to 60 days after You have - come back into compliance. Moreover, Your grants from a particular - Contributor are reinstated on an ongoing basis if such Contributor - notifies You of the non-compliance by some reasonable means, this is the - first time You have received notice of non-compliance with this License - from such Contributor, and You become compliant prior to 30 days after - Your receipt of the notice. - - 5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - - 5.3. In the event of termination under Sections 5.1 or 5.2 above, all - end user license agreements (excluding distributors and resellers) which - have been validly granted by You or Your distributors under this License - prior to termination shall survive termination. - - ************************************************************************ - -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * - - ************************************************************************ - - ************************************************************************ - -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * - - ************************************************************************ - - 8. Litigation - - ------------- - - Any litigation relating to this License may be brought only in the - courts of a jurisdiction where the defendant maintains its principal - place of business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. - Nothing in this Section shall prevent a party's ability to bring - cross-claims or counter-claims. - - 9. Miscellaneous - - ---------------- - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides - that the language of a contract shall be construed against the drafter - shall not be used to construe this License against a Contributor. - - 10. Versions of the License - - --------------------------- - - 10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - - 10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - - 10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - - 10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses - - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - ------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at . - - If it is not possible or desirable to put the notice in a particular - file, then You may include the notice in a location (such as a LICENSE - file in a relevant directory) where a recipient would be likely to look - for such a notice. - - You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice - --------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. diff --git a/src/SolverCore.jl b/src/SolverCore.jl index 0f4b15d..bd90c56 100644 --- a/src/SolverCore.jl +++ b/src/SolverCore.jl @@ -1,10 +1,22 @@ module SolverCore -# stdlib -using LinearAlgebra, Printf - -# our packages -using NLPModels +using LinearAlgebra: LinearAlgebra, Symmetric, factorize, ldiv!, mul!, norm, qr +using NLPModels: + NLPModels, + AbstractNLPModel, + AbstractNLSModel, + cons!, + grad!, + has_bounds, + hess_coord!, + jac_coord!, + neval_cons, + neval_obj, + neval_residual, + obj, + reset!, + unconstrained +using Printf: Printf, @printf, @sprintf include("logger.jl") include("stats.jl") diff --git a/src/dummy_solver.jl b/src/dummy_solver.jl index 76a0d9d..90aefcd 100644 --- a/src/dummy_solver.jl +++ b/src/dummy_solver.jl @@ -36,7 +36,7 @@ function dummy_solver( solve!(solver, nlp, stats, args...; kwargs...) end -function SolverCore.solve!( +function solve!( solver::DummySolver{S}, nlp::AbstractNLPModel{T, S}, stats::GenericExecutionStats; From bbd6e95ff87cc6a1e5e93e036fd16cac9e98ebd3 Mon Sep 17 00:00:00 2001 From: tmigot Date: Fri, 28 Mar 2025 09:20:31 -0400 Subject: [PATCH 5/6] apply JSOBestie --- .breakage/Project.toml | 6 +- .cirrus.yml | 13 +- .copier-answers.jso.yml | 3 +- .github/workflows/Breakage.yml | 366 ++++++++++++++++++--------------- 4 files changed, 207 insertions(+), 181 deletions(-) diff --git a/.breakage/Project.toml b/.breakage/Project.toml index 7f17b55..a65fa1c 100644 --- a/.breakage/Project.toml +++ b/.breakage/Project.toml @@ -1,3 +1,3 @@ -[deps] -GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26" -PkgDeps = "839e9fc8-855b-5b3c-a3b7-2833d3dd1f59" +[deps] +GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26" +PkgDeps = "839e9fc8-855b-5b3c-a3b7-2833d3dd1f59" diff --git a/.cirrus.yml b/.cirrus.yml index ae90520..81e9ef3 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -2,21 +2,10 @@ task: matrix: - name: FreeBSD freebsd_instance: - image_family: freebsd-13-2 + image_family: freebsd-13-3 env: matrix: - - JULIA_VERSION: 1.6 - JULIA_VERSION: 1 - - name: musl Linux - container: - image: alpine:3.14 - env: - - JULIA_VERSION: 1 - - name: MacOS M1 - macos_instance: - image: ghcr.io/cirruslabs/macos-monterey-base:latest - env: - - JULIA_VERSION: 1 install_script: | URL="https://raw.githubusercontent.com/ararslan/CirrusCI.jl/master/bin/install.sh" set -x diff --git a/.copier-answers.jso.yml b/.copier-answers.jso.yml index 61ad646..74457b0 100644 --- a/.copier-answers.jso.yml +++ b/.copier-answers.jso.yml @@ -2,7 +2,8 @@ PackageName: "SolverCore" PackageOwner: "JuliaSmoothOptimizers" PackageUUID: "ff4d7338-4cf1-434d-91df-b86cb86fb843" _src_path: "https://github.com/JuliaSmoothOptimizers/JSOBestieTemplate.jl" -_commit: "v0.13.0" +_commit: "7bcc7d0a2905be7ca9d1dd6519e8df59ae89605c" AddBreakage: true AddBenchmark: false AddBenchmarkCI: true +AddCirrusCI: true diff --git a/.github/workflows/Breakage.yml b/.github/workflows/Breakage.yml index 484ff19..3883812 100644 --- a/.github/workflows/Breakage.yml +++ b/.github/workflows/Breakage.yml @@ -1,165 +1,201 @@ -# Ref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests -name: Breakage - -# read-only repo token -# no access to secrets -on: - pull_request: - -jobs: - # Build dynamically the matrix on which the "break" job will run. - # The matrix contains the packages that depend on ${{ env.pkg }}. - # Job "setup_matrix" outputs variable "matrix", which is in turn - # the output of the "getmatrix" step. - # The contents of "matrix" is a JSON description of a matrix used - # in the next step. It has the form - # { - # "pkg": [ - # "PROPACK", - # "LLSModels", - # "FletcherPenaltySolver" - # ] - # } - setup_matrix: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.getmatrix.outputs.matrix }} - env: - pkg: ${{ github.event.repository.name }} - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: 1 - arch: x64 - - id: getmatrix - run: | - julia -e 'using Pkg; Pkg.Registry.add(RegistrySpec(url = "https://github.com/JuliaRegistries/General.git"))' - julia --project=.breakage -e 'using Pkg; Pkg.update(); Pkg.instantiate()' - pkgs=$(julia --project=.breakage .breakage/get_jso_users.jl ${{ env.pkg }}) - vs='["latest", "stable"]' - # Check if pkgs is empty, and set it to a JSON array if necessary - if [[ -z "$pkgs" || "$pkgs" == "String[]" ]]; then - echo "No packages found; exiting successfully." - exit 0 - fi - vs='["latest", "stable"]' - matrix=$(jq -cn --argjson deps "$pkgs" --argjson vers "$vs" '{pkg: $deps, pkgversion: $vers}') # don't escape quotes like many posts suggest - echo "matrix=$matrix" >> "$GITHUB_OUTPUT" - - break: - needs: setup_matrix - if: needs.setup_matrix.result == 'success' && needs.setup_matrix.outputs.matrix != '' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{ fromJSON(needs.setup_matrix.outputs.matrix) }} - - steps: - - uses: actions/checkout@v4 - - # Install Julia - - uses: julia-actions/setup-julia@v2 - with: - version: 1 - arch: x64 - - 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 }}- - - uses: julia-actions/julia-buildpkg@v1 - - # Breakage test - - name: 'Breakage of ${{ matrix.pkg }}, ${{ matrix.pkgversion }} version' - env: - PKG: ${{ matrix.pkg }} - VERSION: ${{ matrix.pkgversion }} - run: | - set -v - mkdir -p ./breakage - git clone https://github.com/JuliaSmoothOptimizers/$PKG.jl.git - cd $PKG.jl - if [ $VERSION == "stable" ]; then - TAG=$(git tag -l "v*" --sort=-creatordate | head -n1) - if [ -z "$TAG" ]; then - TAG="no_tag" - else - git checkout $TAG - fi - else - TAG=$VERSION - fi - export TAG - julia -e 'using Pkg; - PKG, TAG, VERSION = ENV["PKG"], ENV["TAG"], ENV["VERSION"] - joburl = joinpath(ENV["GITHUB_SERVER_URL"], ENV["GITHUB_REPOSITORY"], "actions/runs", ENV["GITHUB_RUN_ID"]) - open("../breakage/breakage-$PKG-$VERSION", "w") do io - try - TAG == "no_tag" && error("No tag for $VERSION") - pkg"activate ."; - pkg"instantiate"; - pkg"dev ../"; - if TAG == "latest" - global TAG = chomp(read(`git rev-parse --short HEAD`, String)) - end - pkg"build"; - pkg"test"; - - print(io, "[![](https://img.shields.io/badge/$TAG-Pass-green)]($joburl)"); - catch e - @error e; - print(io, "[![](https://img.shields.io/badge/$TAG-Fail-red)]($joburl)"); - end; - end' - - - uses: actions/upload-artifact@v4 - with: - name: breakage-${{ matrix.pkg }}-${{ matrix.pkgversion }} - path: breakage/breakage-* - - upload: - needs: break - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/download-artifact@v4 - with: - path: breakage - pattern: breakage-* - merge-multiple: true - - - run: ls -R - - run: | - cd breakage - echo "| Package name | latest | stable |" > summary.md - echo "|--|--|--|" >> summary.md - count=0 - for file in breakage-* - do - if [ $count == "0" ]; then - name=$(echo $file | cut -f2 -d-) - echo -n "| $name | " - else - echo -n "| " - fi - cat $file - if [ $count == "0" ]; then - echo -n " " - count=1 - else - echo " |" - count=0 - fi - done >> summary.md - - - name: PR comment with file - uses: thollander/actions-comment-pull-request@v2 - with: - filePath: breakage/summary.md +# Ref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests +name: Breakage + +# read-only repo token +# no access to secrets +on: + pull_request: + +jobs: + # Build dynamically the matrix on which the "break" job will run. + # The matrix contains the packages that depend on ${{ env.pkg }}. + # Job "setup_matrix" outputs variable "matrix", which is in turn + # the output of the "getmatrix" step. + # The contents of "matrix" is a JSON description of a matrix used + # in the next step. It has the form + # { + # "pkg": [ + # "PROPACK", + # "LLSModels", + # "FletcherPenaltySolver" + # ] + # } + setup_matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.getmatrix.outputs.matrix }} + env: + pkg: ${{ github.event.repository.name }} + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: 1 + arch: x64 + - id: getmatrix + run: | + julia -e 'using Pkg; Pkg.Registry.add(RegistrySpec(url = "https://github.com/JuliaRegistries/General.git"))' + julia --project=.breakage -e 'using Pkg; Pkg.update(); Pkg.instantiate()' + pkgs=$(julia --project=.breakage .breakage/get_jso_users.jl ${{ env.pkg }}) + vs='["latest", "stable"]' + # Check if pkgs is empty, and set it to a JSON array if necessary + if [[ -z "$pkgs" || "$pkgs" == "String[]" ]]; then + echo "No packages found; exiting successfully." + exit 0 + fi + vs='["latest", "stable"]' + matrix=$(jq -cn --argjson deps "$pkgs" --argjson vers "$vs" '{pkg: $deps, pkgversion: $vers}') # don't escape quotes like many posts suggest + echo "matrix=$matrix" >> "$GITHUB_OUTPUT" + + break: + needs: setup_matrix + if: needs.setup_matrix.result == 'success' && needs.setup_matrix.outputs.matrix != '' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.setup_matrix.outputs.matrix) }} + + steps: + - uses: actions/checkout@v4 + + # Install Julia + - uses: julia-actions/setup-julia@v2 + with: + version: 1 + arch: x64 + - 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 }}- + - uses: julia-actions/julia-buildpkg@v1 + + # Breakage test + - name: 'Breakage of ${{ matrix.pkg }}, ${{ matrix.pkgversion }} version' + env: + PKG: ${{ matrix.pkg }} + VERSION: ${{ matrix.pkgversion }} + run: | + set -v + mkdir -p ./breakage + git clone https://github.com/JuliaSmoothOptimizers/$PKG.jl.git + cd $PKG.jl + if [ $VERSION == "stable" ]; then + TAG=$(git tag -l "v*" --sort=-creatordate | head -n1) + if [ -z "$TAG" ]; then + TAG="no_tag" + else + git checkout $TAG + fi + else + TAG=$VERSION + fi + export TAG + julia -e 'using Pkg; + PKG, TAG, VERSION = ENV["PKG"], ENV["TAG"], ENV["VERSION"] + joburl = joinpath(ENV["GITHUB_SERVER_URL"], ENV["GITHUB_REPOSITORY"], "actions/runs", ENV["GITHUB_RUN_ID"]) + open("../breakage/breakage-$PKG-$VERSION", "w") do io + try + TAG == "no_tag" && error("No tag for $VERSION") + pkg"activate ."; + pkg"instantiate"; + pkg"dev ../"; + if TAG == "latest" + global TAG = chomp(read(`git rev-parse --short HEAD`, String)) + end + pkg"build"; + pkg"test"; + + print(io, "[![](https://img.shields.io/badge/$TAG-Pass-green)]($joburl)"); + catch e + @error e; + print(io, "[![](https://img.shields.io/badge/$TAG-Fail-red)]($joburl)"); + end; + end' + + - uses: actions/upload-artifact@v4 + with: + name: breakage-${{ matrix.pkg }}-${{ matrix.pkgversion }} + path: breakage/breakage-* + + upload: + needs: break + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + path: breakage + pattern: breakage-* + merge-multiple: true + + - run: ls -R + - run: | + cd breakage + echo "| Package name | latest | stable |" > summary.md + echo "|--|--|--|" >> summary.md + count=0 + for file in breakage-* + do + if [ $count == "0" ]; then + name=$(echo $file | cut -f2 -d-) + echo -n "| $name | " + else + echo -n "| " + fi + cat $file + if [ $count == "0" ]; then + echo -n " " + count=1 + else + echo " |" + count=0 + fi + done >> summary.md + + - name: PR comment with file + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + // Import file content from summary.md + const fs = require('fs') + const filePath = 'breakage/summary.md' + const msg = fs.readFileSync(filePath, 'utf8') + + // Get the current PR number from context + const prNumber = context.payload.pull_request.number + + // Fetch existing comments on the PR + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber + }) + + // Find a previous comment by the bot to update + const botComment = comments.find(comment => comment.user.id === 41898282) + + if (botComment) { + // Update the existing comment + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: botComment.id, + body: msg + }) + } else { + // Create a new comment + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: msg + }) + } From 48d7b7c82efe70d393a92fe91fc46e84f7aadb9b Mon Sep 17 00:00:00 2001 From: tmigot Date: Fri, 28 Mar 2025 09:41:58 -0400 Subject: [PATCH 6/6] precommit --- .breakage/Project.toml | 6 +- .github/workflows/Breakage.yml | 402 ++++++++++++++++----------------- 2 files changed, 204 insertions(+), 204 deletions(-) diff --git a/.breakage/Project.toml b/.breakage/Project.toml index a65fa1c..7f17b55 100644 --- a/.breakage/Project.toml +++ b/.breakage/Project.toml @@ -1,3 +1,3 @@ -[deps] -GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26" -PkgDeps = "839e9fc8-855b-5b3c-a3b7-2833d3dd1f59" +[deps] +GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26" +PkgDeps = "839e9fc8-855b-5b3c-a3b7-2833d3dd1f59" diff --git a/.github/workflows/Breakage.yml b/.github/workflows/Breakage.yml index 3883812..c808198 100644 --- a/.github/workflows/Breakage.yml +++ b/.github/workflows/Breakage.yml @@ -1,201 +1,201 @@ -# Ref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests -name: Breakage - -# read-only repo token -# no access to secrets -on: - pull_request: - -jobs: - # Build dynamically the matrix on which the "break" job will run. - # The matrix contains the packages that depend on ${{ env.pkg }}. - # Job "setup_matrix" outputs variable "matrix", which is in turn - # the output of the "getmatrix" step. - # The contents of "matrix" is a JSON description of a matrix used - # in the next step. It has the form - # { - # "pkg": [ - # "PROPACK", - # "LLSModels", - # "FletcherPenaltySolver" - # ] - # } - setup_matrix: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.getmatrix.outputs.matrix }} - env: - pkg: ${{ github.event.repository.name }} - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: 1 - arch: x64 - - id: getmatrix - run: | - julia -e 'using Pkg; Pkg.Registry.add(RegistrySpec(url = "https://github.com/JuliaRegistries/General.git"))' - julia --project=.breakage -e 'using Pkg; Pkg.update(); Pkg.instantiate()' - pkgs=$(julia --project=.breakage .breakage/get_jso_users.jl ${{ env.pkg }}) - vs='["latest", "stable"]' - # Check if pkgs is empty, and set it to a JSON array if necessary - if [[ -z "$pkgs" || "$pkgs" == "String[]" ]]; then - echo "No packages found; exiting successfully." - exit 0 - fi - vs='["latest", "stable"]' - matrix=$(jq -cn --argjson deps "$pkgs" --argjson vers "$vs" '{pkg: $deps, pkgversion: $vers}') # don't escape quotes like many posts suggest - echo "matrix=$matrix" >> "$GITHUB_OUTPUT" - - break: - needs: setup_matrix - if: needs.setup_matrix.result == 'success' && needs.setup_matrix.outputs.matrix != '' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: ${{ fromJSON(needs.setup_matrix.outputs.matrix) }} - - steps: - - uses: actions/checkout@v4 - - # Install Julia - - uses: julia-actions/setup-julia@v2 - with: - version: 1 - arch: x64 - - 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 }}- - - uses: julia-actions/julia-buildpkg@v1 - - # Breakage test - - name: 'Breakage of ${{ matrix.pkg }}, ${{ matrix.pkgversion }} version' - env: - PKG: ${{ matrix.pkg }} - VERSION: ${{ matrix.pkgversion }} - run: | - set -v - mkdir -p ./breakage - git clone https://github.com/JuliaSmoothOptimizers/$PKG.jl.git - cd $PKG.jl - if [ $VERSION == "stable" ]; then - TAG=$(git tag -l "v*" --sort=-creatordate | head -n1) - if [ -z "$TAG" ]; then - TAG="no_tag" - else - git checkout $TAG - fi - else - TAG=$VERSION - fi - export TAG - julia -e 'using Pkg; - PKG, TAG, VERSION = ENV["PKG"], ENV["TAG"], ENV["VERSION"] - joburl = joinpath(ENV["GITHUB_SERVER_URL"], ENV["GITHUB_REPOSITORY"], "actions/runs", ENV["GITHUB_RUN_ID"]) - open("../breakage/breakage-$PKG-$VERSION", "w") do io - try - TAG == "no_tag" && error("No tag for $VERSION") - pkg"activate ."; - pkg"instantiate"; - pkg"dev ../"; - if TAG == "latest" - global TAG = chomp(read(`git rev-parse --short HEAD`, String)) - end - pkg"build"; - pkg"test"; - - print(io, "[![](https://img.shields.io/badge/$TAG-Pass-green)]($joburl)"); - catch e - @error e; - print(io, "[![](https://img.shields.io/badge/$TAG-Fail-red)]($joburl)"); - end; - end' - - - uses: actions/upload-artifact@v4 - with: - name: breakage-${{ matrix.pkg }}-${{ matrix.pkgversion }} - path: breakage/breakage-* - - upload: - needs: break - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/download-artifact@v4 - with: - path: breakage - pattern: breakage-* - merge-multiple: true - - - run: ls -R - - run: | - cd breakage - echo "| Package name | latest | stable |" > summary.md - echo "|--|--|--|" >> summary.md - count=0 - for file in breakage-* - do - if [ $count == "0" ]; then - name=$(echo $file | cut -f2 -d-) - echo -n "| $name | " - else - echo -n "| " - fi - cat $file - if [ $count == "0" ]; then - echo -n " " - count=1 - else - echo " |" - count=0 - fi - done >> summary.md - - - name: PR comment with file - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - // Import file content from summary.md - const fs = require('fs') - const filePath = 'breakage/summary.md' - const msg = fs.readFileSync(filePath, 'utf8') - - // Get the current PR number from context - const prNumber = context.payload.pull_request.number - - // Fetch existing comments on the PR - const { data: comments } = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: prNumber - }) - - // Find a previous comment by the bot to update - const botComment = comments.find(comment => comment.user.id === 41898282) - - if (botComment) { - // Update the existing comment - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: botComment.id, - body: msg - }) - } else { - // Create a new comment - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: prNumber, - body: msg - }) - } +# Ref: https://securitylab.github.com/research/github-actions-preventing-pwn-requests +name: Breakage + +# read-only repo token +# no access to secrets +on: + pull_request: + +jobs: + # Build dynamically the matrix on which the "break" job will run. + # The matrix contains the packages that depend on ${{ env.pkg }}. + # Job "setup_matrix" outputs variable "matrix", which is in turn + # the output of the "getmatrix" step. + # The contents of "matrix" is a JSON description of a matrix used + # in the next step. It has the form + # { + # "pkg": [ + # "PROPACK", + # "LLSModels", + # "FletcherPenaltySolver" + # ] + # } + setup_matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.getmatrix.outputs.matrix }} + env: + pkg: ${{ github.event.repository.name }} + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: 1 + arch: x64 + - id: getmatrix + run: | + julia -e 'using Pkg; Pkg.Registry.add(RegistrySpec(url = "https://github.com/JuliaRegistries/General.git"))' + julia --project=.breakage -e 'using Pkg; Pkg.update(); Pkg.instantiate()' + pkgs=$(julia --project=.breakage .breakage/get_jso_users.jl ${{ env.pkg }}) + vs='["latest", "stable"]' + # Check if pkgs is empty, and set it to a JSON array if necessary + if [[ -z "$pkgs" || "$pkgs" == "String[]" ]]; then + echo "No packages found; exiting successfully." + exit 0 + fi + vs='["latest", "stable"]' + matrix=$(jq -cn --argjson deps "$pkgs" --argjson vers "$vs" '{pkg: $deps, pkgversion: $vers}') # don't escape quotes like many posts suggest + echo "matrix=$matrix" >> "$GITHUB_OUTPUT" + + break: + needs: setup_matrix + if: needs.setup_matrix.result == 'success' && needs.setup_matrix.outputs.matrix != '' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.setup_matrix.outputs.matrix) }} + + steps: + - uses: actions/checkout@v4 + + # Install Julia + - uses: julia-actions/setup-julia@v2 + with: + version: 1 + arch: x64 + - 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 }}- + - uses: julia-actions/julia-buildpkg@v1 + + # Breakage test + - name: 'Breakage of ${{ matrix.pkg }}, ${{ matrix.pkgversion }} version' + env: + PKG: ${{ matrix.pkg }} + VERSION: ${{ matrix.pkgversion }} + run: | + set -v + mkdir -p ./breakage + git clone https://github.com/JuliaSmoothOptimizers/$PKG.jl.git + cd $PKG.jl + if [ $VERSION == "stable" ]; then + TAG=$(git tag -l "v*" --sort=-creatordate | head -n1) + if [ -z "$TAG" ]; then + TAG="no_tag" + else + git checkout $TAG + fi + else + TAG=$VERSION + fi + export TAG + julia -e 'using Pkg; + PKG, TAG, VERSION = ENV["PKG"], ENV["TAG"], ENV["VERSION"] + joburl = joinpath(ENV["GITHUB_SERVER_URL"], ENV["GITHUB_REPOSITORY"], "actions/runs", ENV["GITHUB_RUN_ID"]) + open("../breakage/breakage-$PKG-$VERSION", "w") do io + try + TAG == "no_tag" && error("No tag for $VERSION") + pkg"activate ."; + pkg"instantiate"; + pkg"dev ../"; + if TAG == "latest" + global TAG = chomp(read(`git rev-parse --short HEAD`, String)) + end + pkg"build"; + pkg"test"; + + print(io, "[![](https://img.shields.io/badge/$TAG-Pass-green)]($joburl)"); + catch e + @error e; + print(io, "[![](https://img.shields.io/badge/$TAG-Fail-red)]($joburl)"); + end; + end' + + - uses: actions/upload-artifact@v4 + with: + name: breakage-${{ matrix.pkg }}-${{ matrix.pkgversion }} + path: breakage/breakage-* + + upload: + needs: break + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + path: breakage + pattern: breakage-* + merge-multiple: true + + - run: ls -R + - run: | + cd breakage + echo "| Package name | latest | stable |" > summary.md + echo "|--|--|--|" >> summary.md + count=0 + for file in breakage-* + do + if [ $count == "0" ]; then + name=$(echo $file | cut -f2 -d-) + echo -n "| $name | " + else + echo -n "| " + fi + cat $file + if [ $count == "0" ]; then + echo -n " " + count=1 + else + echo " |" + count=0 + fi + done >> summary.md + + - name: PR comment with file + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + // Import file content from summary.md + const fs = require('fs') + const filePath = 'breakage/summary.md' + const msg = fs.readFileSync(filePath, 'utf8') + + // Get the current PR number from context + const prNumber = context.payload.pull_request.number + + // Fetch existing comments on the PR + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber + }) + + // Find a previous comment by the bot to update + const botComment = comments.find(comment => comment.user.id === 41898282) + + if (botComment) { + // Update the existing comment + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: botComment.id, + body: msg + }) + } else { + // Create a new comment + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: msg + }) + }