-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
import the CI machinery, split into files to allow nicer docs
- Loading branch information
Showing
15 changed files
with
655 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: CompatHelper | ||
on: | ||
schedule: | ||
- cron: 0 0 * * * | ||
workflow_dispatch: | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
jobs: | ||
CompatHelper: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check if Julia is already available in the PATH | ||
id: julia_in_path | ||
run: which julia | ||
continue-on-error: true | ||
- name: Install Julia, but only if it is not already available in the PATH | ||
uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: '1' | ||
arch: ${{ runner.arch }} | ||
if: steps.julia_in_path.outcome != 'success' | ||
- name: "Add the General registry via Git" | ||
run: | | ||
import Pkg | ||
ENV["JULIA_PKG_SERVER"] = "" | ||
Pkg.Registry.add("General") | ||
shell: julia --color=yes {0} | ||
- name: "Install CompatHelper" | ||
run: | | ||
import Pkg | ||
name = "CompatHelper" | ||
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" | ||
version = "3" | ||
Pkg.add(; name, uuid, version) | ||
shell: julia --color=yes {0} | ||
- name: "Run CompatHelper" | ||
run: | | ||
import CompatHelper | ||
CompatHelper.main() | ||
shell: julia --color=yes {0} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: TagBot | ||
on: | ||
issue_comment: | ||
types: | ||
- created | ||
workflow_dispatch: | ||
jobs: | ||
TagBot: | ||
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: JuliaRegistries/TagBot@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
ssh: ${{ secrets.DOCUMENTER_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: | ||
- '1' # This is always the latest stable release in the 1.X series | ||
- '1.6' # LTS | ||
- 'nightly' | ||
os: | ||
- ubuntu-latest | ||
- macOS-latest | ||
- windows-latest | ||
arch: | ||
- x64 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- 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@latest | ||
- run: | | ||
git config --global user.name Tester | ||
git config --global user.email [email protected] | ||
- uses: julia-actions/julia-runtest@latest | ||
continue-on-error: ${{ matrix.version == 'nightly' }} | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
- uses: codecov/codecov-action@v1 | ||
with: | ||
file: lcov.info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
# ref: https://juliadocs.github.io/Documenter.jl/stable/man/hosting/#GitHub-Actions-1 | ||
name: Documentation | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
tags: '*' | ||
release: | ||
types: [published, created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: julia-actions/setup-julia@latest | ||
- name: Install dependencies | ||
run: julia --color=yes --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' | ||
- name: Build and deploy | ||
env: | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key | ||
run: julia --color=yes --project=docs/ docs/make.jl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
on: | ||
pull_request: | ||
issue_comment: | ||
types: [created] | ||
|
||
name: Formatting | ||
|
||
jobs: | ||
formatting: | ||
if: github.event_name == 'pull_request' || (github.event_name == 'issue_comment' && github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'OWNER' || github.event.issue.user.id == github.event.comment.user.id) && startsWith(github.event.comment.body, '/format') ) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone the repository | ||
uses: actions/checkout@v3 | ||
- name: Checkout the pull request code # this checks out the actual branch so that one can commit into it | ||
if: github.event_name == 'issue_comment' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh pr checkout ${{ github.event.issue.number }} | ||
- name: Install JuliaFormatter and format | ||
run: | | ||
julia --color=yes -e 'import Pkg; Pkg.add("JuliaFormatter")' | ||
julia --color=yes -e 'using JuliaFormatter; format(".")' | ||
- name: Remove trailing whitespace | ||
run: | | ||
find -name '*.jl' -or -name '*.md' -or -name '*.toml' -or -name '*.yml' | while read filename ; do | ||
# remove any trailing spaces | ||
sed --in-place -e 's/\s*$//' "$filename" | ||
# add a final newline if missing | ||
if [[ -s "$filename" && $(tail -c 1 "$filename" |wc -l) -eq 0 ]] ; then | ||
echo >> "$filename" | ||
fi | ||
# squash superfluous final newlines | ||
sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' "$filename" | ||
done | ||
- name: Fail on formatting problems | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
if git diff --exit-code --quiet | ||
then echo "Looks OK" | ||
else echo "Formatting fixes required!"; git diff -p ; exit 1 | ||
fi | ||
- name: Commit fixes | ||
if: github.event_name == 'issue_comment' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
if [ `git status -s | wc -l` -ne 0 ] ; then | ||
git config --local user.name "$GITHUB_ACTOR" | ||
git config --local user.email "[email protected]" | ||
git commit -a -m "automatic formatting" -m "triggered by @$GITHUB_ACTOR on PR #${{ github.event.issue.number }}" | ||
if git push | ||
then gh pr comment ${{ github.event.issue.number }} --body \ | ||
":heavy_check_mark: Auto-formatting triggered by [this comment](${{ github.event.comment.html_url }}) succeeded, commited as `git rev-parse HEAD`" | ||
else gh pr comment ${{ github.event.issue.number }} --body \ | ||
":x: Auto-formatting triggered by [this comment](${{ github.event.comment.html_url }}) failed, perhaps someone pushed to the PR in the meantime?" | ||
fi | ||
else | ||
gh pr comment ${{ github.event.issue.number }} --body \ | ||
":sunny: Auto-formatting triggered by [this comment](${{ github.event.comment.html_url }}) succeeded, but the code was already formatted correctly." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/docs/build/ | ||
/Manifest.toml | ||
|
||
*.cov | ||
.*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[deps] | ||
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Documenter, Literate, ConstraintTrees | ||
|
||
examples = | ||
sort(filter(x -> endswith(x, ".jl"), readdir(joinpath(@__DIR__, "src"), join = true))) | ||
|
||
for example in examples | ||
Literate.markdown( | ||
example, | ||
joinpath(@__DIR__, "src"), | ||
repo_root_url = "https://github.com/COBREXA/ConstraintTrees.jl/blob/master", | ||
) | ||
end | ||
|
||
example_mds = first.(splitext.(basename.(examples))) .* ".md" | ||
|
||
makedocs( | ||
modules = [ConstraintTrees], | ||
clean = false, | ||
format = Documenter.HTML( | ||
ansicolor = true, | ||
canonical = "https://cobrexa.github.io/ConstraintTrees.jl/stable/", | ||
), | ||
sitename = "ConstraintTrees.jl", | ||
linkcheck = false, | ||
pages = ["README" => "index.md"; example_mds; "Reference" => "reference.md"], | ||
strict = [:missing_docs, :cross_references, :example_block], | ||
) | ||
|
||
deploydocs( | ||
repo = "github.com/COBREXA/ConstraintTrees.jl.git", | ||
target = "build", | ||
branch = "gh-pages", | ||
push_preview = false, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# ConstraintTrees.jl | ||
|
||
```@autodocs | ||
Modules = [ConstraintTrees] | ||
Pages = ["ConstraintTrees.jl"] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
# Reference | ||
|
||
## Values (linear combinations of variables) | ||
|
||
```@autodocs | ||
Modules = [ConstraintTrees] | ||
Pages = ["value.jl"] | ||
``` | ||
|
||
## Constraints | ||
|
||
```@autodocs | ||
Modules = [ConstraintTrees] | ||
Pages = ["constraint.jl"] | ||
``` | ||
|
||
## Constraint trees | ||
|
||
```@autodocs | ||
Modules = [ConstraintTrees] | ||
Pages = ["constraint_tree.jl"] | ||
``` | ||
|
||
## Solution trees | ||
|
||
```@autodocs | ||
Modules = [ConstraintTrees] | ||
Pages = ["solution.jl"] | ||
``` |
Oops, something went wrong.