Skip to content

Commit

Permalink
Package setup (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman authored Nov 26, 2024
1 parent 99d7c04 commit 00bc73a
Show file tree
Hide file tree
Showing 40 changed files with 718 additions and 132 deletions.
1 change: 1 addition & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options
style = "blue"
indent = 2
62 changes: 62 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: SparseArraysBase.jl bug report
about: Create a bug report to help us improve SparseArraysBase.jl
title: "[BUG] YOUR SHORT DESCRIPTION OF THE BUG HERE"
labels: ["bug"]
assignees: ''

---

**Description of bug**

Please give a brief description of the bug or unexpected behavior here.

**Minimal code demonstrating the bug or unexpected behavior**

If applicable, provide a minimal code that can be run to demonstrate the bug or unexpected behavior.

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.

<details><summary>Minimal runnable code</summary><p>

```julia
[YOUR MINIMAL RUNNABLE CODE HERE]
```

</p></details>


**Expected output or behavior**

Describe what you expected to happen.

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.


**Actual output or behavior**

Describe what actually happened.

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.

<details><summary>Output of minimal runnable code</summary><p>

```julia
[OUTPUT OF YOUR MINIMAL RUNNABLE CODE HERE]
```

</p></details>


**Version information**

- Output from `versioninfo()`:
```julia
julia> versioninfo()
[YOUR OUTPUT HERE]
```
- Output from `using Pkg; Pkg.status("SparseArraysBase")`:
```julia
julia> using Pkg; Pkg.status("SparseArraysBase")
[YOUR OUTPUT HERE]
```
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: SparseArraysBase.jl feature request
about: Suggest an idea for SparseArraysBase.jl
title: "[ENHANCEMENT] YOUR SHORT DESCRIPTION OF THE FEATURE REQUEST HERE"
labels: ["enhancement"]
assignees: ''

---

**Is your feature request related to a problem? Please describe.**

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**

A clear and concise description of what you want to happen.

**Describe alternatives you've considered**

A clear and concise description of any alternative solutions or features you've considered.

**Additional context**

Add any other context or screenshots about the feature request here.
42 changes: 42 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Description

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.

Fixes #(issue)

If practical and applicable, please include a minimal demonstration of the previous behavior and new behavior below.

<details><summary>Minimal demonstration of previous behavior</summary><p>

```julia
[YOUR MINIMAL DEMONSTRATION OF PREVIOUS BEHAVIOR]
```

</p></details>

<details><summary>Minimal demonstration of new behavior</summary><p>

```julia
[YOUR MINIMAL DEMONSTRATION OF NEW BEHAVIOR]
```

</p></details>

# How Has This Been Tested?

Please add tests that verify your changes to a file in the `test` directory.

Please give a summary of the tests that you added to verify your changes.

- [ ] Test A
- [ ] Test B

# Checklist:

- [ ] 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.
- [ ] I have performed a self-review of my own code.
- [ ] I have commented my code, particularly in hard-to-understand areas.
- [ ] I have added tests that verify the behavior of the changes I made.
- [ ] I have made corresponding changes to the documentation.
- [ ] My changes generate no new warnings.
- [ ] Any dependent changes have been merged and published in downstream modules.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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"
79 changes: 79 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI
on:
push:
branches:
- main
tags: ['*']
pull_request:
workflow_dispatch:
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:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
strategy:
fail-fast: false
matrix:
version:
# - 'lts' # TODO: Reenable once dependencies are registered.
- '1'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v5
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
docs:
name: Documentation
runs-on: ubuntu-latest
permissions:
actions: write # needed to allow julia-actions/cache to proactively delete old caches that it has created
contents: write
statuses: write
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v2
- name: Configure doc environment
shell: julia --project=docs --color=yes {0}
run: |
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
- name: Run doctests
shell: julia --project=docs --color=yes {0}
run: |
using Documenter: DocMeta, doctest
using SparseArraysBase
DocMeta.setdocmeta!(SparseArraysBase, :DocTestSetup, :(using SparseArraysBase); recursive=true)
doctest(SparseArraysBase)
16 changes: 16 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CompatHelper
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
35 changes: 35 additions & 0 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Format check
on:
push:
branches: [main]
tags: [v*]
pull_request:

jobs:
format:
name: "Format Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: 1
- name: Install JuliaFormatter and format
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
julia -e 'using JuliaFormatter; format(".", verbose=true)'
- name: Check format
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "The following files have not been formatted:"
write(stdout, out)
out_diff = Cmd(`git diff`) |> read |> String
@error "Diff:"
write(stdout, out_diff)
exit(1)
@error ""
end'
43 changes: 43 additions & 0 deletions .github/workflows/LiterateCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Literate check
on:
push:
branches: [main]
tags: [v*]
pull_request:

jobs:
literate:
name: "Literate Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: 1
- name: Install Literate and generate docs
run: |
julia -e '
using Pkg
# TODO: Delete once they are registered.
Pkg.add(url="https://github.com/ITensor/BroadcastMapConversion.jl")
Pkg.add(url="https://github.com/ITensor/NestedPermutedDimsArrays.jl")
Pkg.add(url="https://github.com/ITensor/TypeParameterAccessors.jl")
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
Pkg.add(PackageSpec(name="Literate"))'
julia -e 'include("docs/make_readme.jl")'
- name: Check if docs need to be updated
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "The docs are outdated, rerun Literate to regenerate them."
write(stdout, out)
out_diff = Cmd(`git diff`) |> read |> String
@error "Diff:"
write(stdout, out_diff)
exit(1)
@error ""
end'
16 changes: 16 additions & 0 deletions .github/workflows/Register.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Register Package
on:
workflow_dispatch:
inputs:
version:
description: Version to register or component to bump
required: true
jobs:
register:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: julia-actions/RegisterAction@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: TagBot
on:
issue_comment:
types:
- created
workflow_dispatch:
inputs:
lookback:
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 }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*.jl.*.cov
*.jl.cov
*.jl.mem
*.o
*.swp
.DS_Store
.benchmarkci
.tmp
.vscode/
Manifest.toml
benchmark/*.json
docs/Manifest.toml
docs/build/
docs/src/index.md
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
exclude_types: [markdown] # incompatible with Literate.jl
- repo: https://github.com/qiaojunfeng/pre-commit-julia-format
rev: v0.2.0
hooks:
- id: julia-format
Loading

0 comments on commit 00bc73a

Please sign in to comment.