Skip to content

Commit 00bc73a

Browse files
authored
Package setup (#2)
1 parent 99d7c04 commit 00bc73a

40 files changed

+718
-132
lines changed

.JuliaFormatter.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options
12
style = "blue"
23
indent = 2

.github/ISSUE_TEMPLATE/BUG_REPORT.md

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
name: SparseArraysBase.jl bug report
3+
about: Create a bug report to help us improve SparseArraysBase.jl
4+
title: "[BUG] YOUR SHORT DESCRIPTION OF THE BUG HERE"
5+
labels: ["bug"]
6+
assignees: ''
7+
8+
---
9+
10+
**Description of bug**
11+
12+
Please give a brief description of the bug or unexpected behavior here.
13+
14+
**Minimal code demonstrating the bug or unexpected behavior**
15+
16+
If applicable, provide a minimal code that can be run to demonstrate the bug or unexpected behavior.
17+
18+
If you are unable to construct a minimal code that demonstrates the bug or unexpected behavior, provide detailed steps for how to reproduce the behavior you are seeing.
19+
20+
<details><summary>Minimal runnable code</summary><p>
21+
22+
```julia
23+
[YOUR MINIMAL RUNNABLE CODE HERE]
24+
```
25+
26+
</p></details>
27+
28+
29+
**Expected output or behavior**
30+
31+
Describe what you expected to happen.
32+
33+
If you provided a minimal code that can be run to demonstrate the bug or unexpected behavior, describe what you expected the output would be.
34+
35+
36+
**Actual output or behavior**
37+
38+
Describe what actually happened.
39+
40+
If you provided a minimal code that demonstrates the bug or unexpected behavior, provide the output you get from that code. If the code leads to an error or warning, include the full error or warning below.
41+
42+
<details><summary>Output of minimal runnable code</summary><p>
43+
44+
```julia
45+
[OUTPUT OF YOUR MINIMAL RUNNABLE CODE HERE]
46+
```
47+
48+
</p></details>
49+
50+
51+
**Version information**
52+
53+
- Output from `versioninfo()`:
54+
```julia
55+
julia> versioninfo()
56+
[YOUR OUTPUT HERE]
57+
```
58+
- Output from `using Pkg; Pkg.status("SparseArraysBase")`:
59+
```julia
60+
julia> using Pkg; Pkg.status("SparseArraysBase")
61+
[YOUR OUTPUT HERE]
62+
```
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: SparseArraysBase.jl feature request
3+
about: Suggest an idea for SparseArraysBase.jl
4+
title: "[ENHANCEMENT] YOUR SHORT DESCRIPTION OF THE FEATURE REQUEST HERE"
5+
labels: ["enhancement"]
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
12+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
13+
14+
**Describe the solution you'd like**
15+
16+
A clear and concise description of what you want to happen.
17+
18+
**Describe alternatives you've considered**
19+
20+
A clear and concise description of any alternative solutions or features you've considered.
21+
22+
**Additional context**
23+
24+
Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Description
2+
3+
Please include a summary of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies that are required for this change.
4+
5+
Fixes #(issue)
6+
7+
If practical and applicable, please include a minimal demonstration of the previous behavior and new behavior below.
8+
9+
<details><summary>Minimal demonstration of previous behavior</summary><p>
10+
11+
```julia
12+
[YOUR MINIMAL DEMONSTRATION OF PREVIOUS BEHAVIOR]
13+
```
14+
15+
</p></details>
16+
17+
<details><summary>Minimal demonstration of new behavior</summary><p>
18+
19+
```julia
20+
[YOUR MINIMAL DEMONSTRATION OF NEW BEHAVIOR]
21+
```
22+
23+
</p></details>
24+
25+
# How Has This Been Tested?
26+
27+
Please add tests that verify your changes to a file in the `test` directory.
28+
29+
Please give a summary of the tests that you added to verify your changes.
30+
31+
- [ ] Test A
32+
- [ ] Test B
33+
34+
# Checklist:
35+
36+
- [ ] My code follows the style guidelines of this project. Please run `using JuliaFormatter; format(".")` in the base directory of the repository (`~/.julia/dev/SparseArraysBase`) to format your code according to our style guidelines.
37+
- [ ] I have performed a self-review of my own code.
38+
- [ ] I have commented my code, particularly in hard-to-understand areas.
39+
- [ ] I have added tests that verify the behavior of the changes I made.
40+
- [ ] I have made corresponding changes to the documentation.
41+
- [ ] My changes generate no new warnings.
42+
- [ ] Any dependent changes have been merged and published in downstream modules.

.github/dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/" # Location of package manifests
6+
schedule:
7+
interval: "weekly"

.github/workflows/CI.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags: ['*']
7+
pull_request:
8+
workflow_dispatch:
9+
concurrency:
10+
# Skip intermediate builds: always.
11+
# Cancel intermediate builds: only if it is a pull request build.
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
14+
jobs:
15+
test:
16+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
17+
runs-on: ${{ matrix.os }}
18+
timeout-minutes: 60
19+
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
20+
actions: write
21+
contents: read
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
version:
26+
# - 'lts' # TODO: Reenable once dependencies are registered.
27+
- '1'
28+
os:
29+
- ubuntu-latest
30+
- macOS-latest
31+
- windows-latest
32+
arch:
33+
- x64
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: julia-actions/setup-julia@v2
37+
with:
38+
version: ${{ matrix.version }}
39+
arch: ${{ matrix.arch }}
40+
- uses: julia-actions/cache@v2
41+
- uses: julia-actions/julia-buildpkg@v1
42+
- uses: julia-actions/julia-runtest@v1
43+
- uses: julia-actions/julia-processcoverage@v1
44+
- uses: codecov/codecov-action@v5
45+
with:
46+
files: lcov.info
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
fail_ci_if_error: false
49+
docs:
50+
name: Documentation
51+
runs-on: ubuntu-latest
52+
permissions:
53+
actions: write # needed to allow julia-actions/cache to proactively delete old caches that it has created
54+
contents: write
55+
statuses: write
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: julia-actions/setup-julia@v2
59+
with:
60+
version: '1'
61+
- uses: julia-actions/cache@v2
62+
- name: Configure doc environment
63+
shell: julia --project=docs --color=yes {0}
64+
run: |
65+
using Pkg
66+
Pkg.develop(PackageSpec(path=pwd()))
67+
Pkg.instantiate()
68+
- uses: julia-actions/julia-buildpkg@v1
69+
- uses: julia-actions/julia-docdeploy@v1
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
73+
- name: Run doctests
74+
shell: julia --project=docs --color=yes {0}
75+
run: |
76+
using Documenter: DocMeta, doctest
77+
using SparseArraysBase
78+
DocMeta.setdocmeta!(SparseArraysBase, :DocTestSetup, :(using SparseArraysBase); recursive=true)
79+
doctest(SparseArraysBase)

.github/workflows/CompatHelper.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CompatHelper
2+
on:
3+
schedule:
4+
- cron: 0 0 * * *
5+
workflow_dispatch:
6+
jobs:
7+
CompatHelper:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Pkg.add("CompatHelper")
11+
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
12+
- name: CompatHelper.main()
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
16+
run: julia -e 'using CompatHelper; CompatHelper.main()'

.github/workflows/FormatCheck.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Format check
2+
on:
3+
push:
4+
branches: [main]
5+
tags: [v*]
6+
pull_request:
7+
8+
jobs:
9+
format:
10+
name: "Format Check"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: julia-actions/setup-julia@v2
15+
with:
16+
version: 1
17+
- name: Install JuliaFormatter and format
18+
run: |
19+
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
20+
julia -e 'using JuliaFormatter; format(".", verbose=true)'
21+
- name: Check format
22+
run: |
23+
julia -e '
24+
out = Cmd(`git diff --name-only`) |> read |> String
25+
if out == ""
26+
exit(0)
27+
else
28+
@error "The following files have not been formatted:"
29+
write(stdout, out)
30+
out_diff = Cmd(`git diff`) |> read |> String
31+
@error "Diff:"
32+
write(stdout, out_diff)
33+
exit(1)
34+
@error ""
35+
end'

.github/workflows/LiterateCheck.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Literate check
2+
on:
3+
push:
4+
branches: [main]
5+
tags: [v*]
6+
pull_request:
7+
8+
jobs:
9+
literate:
10+
name: "Literate Check"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: julia-actions/setup-julia@v2
15+
with:
16+
version: 1
17+
- name: Install Literate and generate docs
18+
run: |
19+
julia -e '
20+
using Pkg
21+
# TODO: Delete once they are registered.
22+
Pkg.add(url="https://github.com/ITensor/BroadcastMapConversion.jl")
23+
Pkg.add(url="https://github.com/ITensor/NestedPermutedDimsArrays.jl")
24+
Pkg.add(url="https://github.com/ITensor/TypeParameterAccessors.jl")
25+
Pkg.develop(PackageSpec(path=pwd()))
26+
Pkg.instantiate()
27+
Pkg.add(PackageSpec(name="Literate"))'
28+
julia -e 'include("docs/make_readme.jl")'
29+
- name: Check if docs need to be updated
30+
run: |
31+
julia -e '
32+
out = Cmd(`git diff --name-only`) |> read |> String
33+
if out == ""
34+
exit(0)
35+
else
36+
@error "The docs are outdated, rerun Literate to regenerate them."
37+
write(stdout, out)
38+
out_diff = Cmd(`git diff`) |> read |> String
39+
@error "Diff:"
40+
write(stdout, out_diff)
41+
exit(1)
42+
@error ""
43+
end'

.github/workflows/Register.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Register Package
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: Version to register or component to bump
7+
required: true
8+
jobs:
9+
register:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: julia-actions/RegisterAction@latest
15+
with:
16+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/TagBot.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: TagBot
2+
on:
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
7+
inputs:
8+
lookback:
9+
default: "3"
10+
permissions:
11+
actions: read
12+
checks: read
13+
contents: write
14+
deployments: read
15+
issues: read
16+
discussions: read
17+
packages: read
18+
pages: read
19+
pull-requests: read
20+
repository-projects: read
21+
security-events: read
22+
statuses: read
23+
jobs:
24+
TagBot:
25+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: JuliaRegistries/TagBot@v1
29+
with:
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
ssh: ${{ secrets.DOCUMENTER_KEY }}

.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*.jl.*.cov
2+
*.jl.cov
3+
*.jl.mem
4+
*.o
5+
*.swp
6+
.DS_Store
7+
.benchmarkci
8+
.tmp
9+
.vscode/
10+
Manifest.toml
11+
benchmark/*.json
12+
docs/Manifest.toml
13+
docs/build/
14+
docs/src/index.md

.pre-commit-config.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: check-merge-conflict
6+
- id: check-toml
7+
- id: check-yaml
8+
- id: end-of-file-fixer
9+
exclude_types: [markdown] # incompatible with Literate.jl
10+
- repo: https://github.com/qiaojunfeng/pre-commit-julia-format
11+
rev: v0.2.0
12+
hooks:
13+
- id: julia-format

0 commit comments

Comments
 (0)