Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Setup #1

Merged
merged 11 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
101 changes: 101 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
name: CI
on:
workflow_dispatch:
push:
branches:
- main
tags: ["*"]
paths:
- "src/**"
- "test/**"
- "Project.toml"
- ".github/workflows/CI.yml"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "src/**"
- "test/**"
- "Project.toml"
- ".github/workflows/CI.yml"
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.runs-on }} - ${{ matrix.arch }} - ${{ matrix.threads}} threads
# Run on non-draft PRs
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
# These permissions are needed to:
# - Interact with GitHub's OIDC Token endpoint: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services#adding-permissions-settings
# - Delete old caches: https://github.com/julia-actions/cache#usage
permissions:
id-token: write
actions: write
contents: read
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
version:
- "MIN" # Earliest version of Julia that the package is compatible with
- "1" # Latest Julia release
runs-on:
- ubuntu-latest
arch:
- x64
threads:
- 1
env:
JULIA_NUM_THREADS: ${{ matrix.threads }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# - uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-region: us-east-2
# role-to-assume: arn:aws:iam::185776040155:role/weakkeyiddicts-ci
# role-duration-seconds: 43200
- name: Resolve Julia version
id: version_resolver
shell: julia --color=yes {0}
run: |
using Pkg.Types
version = "${{ matrix.version }}"
if version == "MIN"
p = read_project("Project.toml")
version = VersionNumber(first(sort(p.compat["julia"].val.ranges)).lower.t)
end
open(ENV["GITHUB_OUTPUT"], "a") do io
println(io, "version=$version")
end
- uses: julia-actions/setup-julia@v1
with:
version: ${{ steps.version_resolver.outputs.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/add-julia-registry@v1
with:
key: ${{ secrets.BEACONBUDDY_SSH_KEY }}
registry: beacon-biosignals/BeaconRegistry
- uses: julia-actions/julia-runtest@v1
with:
annotate: true
- uses: julia-actions/julia-processcoverage@v1
with:
directories: src/
- uses: codecov/codecov-action@v4
with:
files: lcov.info
flags: WeakKeyIdDicts
token: ${{ secrets.CODECOV_TOKEN }}
# - name: Percy Upload
# if: ${{ matrix.version == '1' }}
# uses: percy/exec-action@v0.3.1
# with:
# custom-command: "npx @percy/cli upload ./WeakKeyIdDicts.jl/test/test_images"
# env:
# PERCY_TOKEN: ${{ secrets.PERCY_TOKEN_WEAKKEYIDDICTS }}
39 changes: 39 additions & 0 deletions .github/workflows/DocPreviewCleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
# remove PR previews once they're merged
# <https://juliadocs.github.io/Documenter.jl/dev/man/hosting/#gh-pages-Branch>
name: Doc Preview Cleanup
on:
pull_request:
types: [closed]

# Ensure that only one "Doc Preview Cleanup" workflow is force pushing at a time
concurrency:
group: doc-preview-cleanup
cancel-in-progress: false

jobs:
doc-preview-cleanup:
runs-on: ubuntu-latest
permissions:
contents: write
env:
PR: ${{ github.event.number }}
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Delete preview and history + push changes
run: |
preview_dir="previews/PR${PR?}"
if [ -d "${preview_dir}" ]; then
# Delete preview directory created by this PR
git rm -rf "${preview_dir}"

# Commit the removed preview directories and truncate history
git config user.name "Documenter.jl"
git config user.email "documenter@juliadocs.github.io"
git commit -m "delete preview"
git branch gh-pages-new $(echo "squash history" | git commit-tree HEAD^{tree})
git push --force origin gh-pages-new:gh-pages
fi
68 changes: 68 additions & 0 deletions .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
name: Documenter
on:
workflow_dispatch:
push:
tags: ["*"]
branches:
- main
paths:
- "docs/**"
- "src/**"
- "Project.toml"
- ".github/workflows/Documenter.yml"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "docs/**"
- "src/**"
- "Project.toml"
- ".github/workflows/Documenter.yml"
- ".github/workflows/DocPreviewCleanup.yml"
jobs:
docs:
name: Build
# Run on non-draft PRs
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
# These permissions are needed to:
# - Deploying documentation: https://github.com/JuliaDocs/Documenter.jl/pull/2478
# - Delete old caches: https://github.com/julia-actions/cache#usage
permissions:
actions: write
contents: write
pull-requests: read
statuses: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: "1"
show-versioninfo: true
- uses: julia-actions/cache@v1
- uses: julia-actions/add-julia-registry@v1
with:
key: ${{ secrets.BEACONBUDDY_SSH_KEY }}
registry: beacon-biosignals/BeaconRegistry
- name: Install dependencies
shell: julia --project=docs --color=yes {0}
run: |
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
- name: Build docs
uses: julia-actions/julia-docdeploy@v1
with:
install-package: false # Avoid instantiating twice
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Preview URL
if: ${{ github.event_name == 'pull_request' }}
run: |
repo_owner="${repo%/*}" # e.g. JuliaLang
repo_name="${repo#*/}" # e.g. Example.jl
echo ":books: Documentation preview available at:" | tee -a "$GITHUB_STEP_SUMMARY"
echo "<https://${repo_owner}.github.io/${repo_name}/previews/PR${PR}>" | tee -a "$GITHUB_STEP_SUMMARY"
env:
repo: ${{ github.repository }} # e.g. JuliaLang/Example.jl
PR: ${{ github.event.number }}
48 changes: 48 additions & 0 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Format Check
on:
push:
branches:
- main
- /^release-.*$/
tags: ["*"]
paths:
- "**/*.jl"
- ".github/workflows/FormatCheck.yml"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "**/*.jl"
- ".github/workflows/FormatCheck.yml"
jobs:
format-check:
name: Julia
# These permissions are needed to:
# - Delete old caches: https://github.com/julia-actions/cache#usage
# - Post formatting suggestions: https://github.com/reviewdog/action-suggester#required-permissions
permissions:
actions: write
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: "1"
- uses: julia-actions/cache@v1
- name: Install JuliaFormatter
shell: julia --project=@format --color=yes {0}
run: |
using Pkg
Pkg.add(PackageSpec(; name="JuliaFormatter", version="1"))
- name: Check formatting
shell: julia --project=@format --color=yes {0}
run: |
using JuliaFormatter
format("."; verbose=true) || exit(1)
# Add formatting suggestions to non-draft PRs even if when "Check formatting" fails
- uses: reviewdog/action-suggester@v1
if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.draft == false }}
with:
tool_name: JuliaFormatter
19 changes: 19 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: TagBot
on:
issue_comment:
types:
- created
workflow_dispatch:
jobs:
TagBot:
if: ${{ github.event_name == 'workflow_dispatch' || github.actor == 'beacon-buddy' }}
runs-on: ubuntu-latest
steps:
- name: Tag WeakKeyIdDicts.jl
uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
registry: beacon-biosignals/BeaconRegistry
registry_ssh: ${{ secrets.BEACON_REGISTRY_RO_SSH_KEY }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Manifest.toml
32 changes: 32 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
MIT License

Copyright (c) 2021 Beacon Biosignals

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

The source implementation was originally copied from that found in `AbstractAlgebra.jl`
located here: https://github.com/Nemocas/AbstractAlgebra.jl
haberdashPI marked this conversation as resolved.
Show resolved Hide resolved

> Copyright (c) 2014-2016: William Hart, Tommy Hofmann, Claus Fieker, Fredrik Johansson.

> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

> Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
> Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 changes: 16 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name = "WeakKeyIdDicts"
uuid = "ecbed89c-9d59-4137-ae1f-d1084086d01c"
authors = ["Beacon Biosignals, Inc"]
version = "0.0.1"

[compat]
Aqua = "0.8"
julia = "1.6"
Test = "1.0"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "Test"]
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# WeakKeyIdDicts.jl
Julia hash table where the keys are weak references to objects by their object id.

[![docs](https://img.shields.io/badge/docs-dev-blue.svg)](https://beacon-biosignals.github.io/WeakKeyIdDicts.jl/dev)
[![docs](https://img.shields.io/badge/docs-stable-blue.svg)](https://beacon-biosignals.github.io/WeakKeyIdDicts.jl/stable)
[![CI](https://github.com/beacon-biosignals/WeakKeyIdDicts.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/beacon-biosignals/WeakKeyIdDicts.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![codecov](https://codecov.io/gh/beacon-biosignals/WeakKeyIdDicts.jl/branch/main/graph/badge.svg?token=TODO_CODECOVTOKEN&flag=WeakKeyIdDicts)](https://app.codecov.io/gh/beacon-biosignals/WeakKeyIdDicts.jl/tree/main)

TODO: Description of package.

### Delete this section after completing
- [ ] In this file:
- [ ] replace the new "TODO" with a short description of this package
- [ ] replace the `TODO_CODECOVTOKEN` in the above badge with this repo's [codecov token ("Graphing token")](https://app.codecov.io/gh/beacon-biosignals/WeakKeyIdDicts.jl/settings). Note that you may not be able to access this token until your CI has run once and pushed coverage to codecov. Make sure you are signed into codecov!
- [ ] In [top-level docstring of the package](src/WeakKeyIdDicts.jl), replace the "TODO" with a short description of this package (this will show up as a description in the docs)
- [ ] Need aws access for ci? In `github/workflows/CI.yml`, uncomment the "uses: aws-actions/configure-aws-credentials@v1" blurb and made sure the `role-to-assume` exists in infra
- [ ] Need Percy for CI? In `github/workflows/CI.yml`, uncomment the `Percy Upload` section, generate a new token for this package via the Percy UI, and add it to the top level repo as `PERCY_TOKEN_`
9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
comment: off
flag_management:
default_rules:
carryforward: true
individual_flags:
- name: WeakKeyIdDicts
paths:
- src/**
5 changes: 5 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

[compat]
Documenter = "1"
21 changes: 21 additions & 0 deletions docs/fix_doctests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# run this script in the `docs` project to fix the doctests if they are out of date
# carefully review the changes before committing!

# One needs to be careful because `fix=true` will edit the source to fix
# the doctests, and it's good to separate those changes so you can check
# they are correct (and be easily revertable if they do something wrong).

using Documenter, WeakKeyIdDicts

DocMeta.setdocmeta!(WeakKeyIdDicts, :DocTestSetup, :(using WeakKeyIdDicts);
recursive=true)
haberdashPI marked this conversation as resolved.
Show resolved Hide resolved

if get(ENV, "CI", "false") == "true" || success(`git diff --quiet`)
# Uncommment if a special aws configuration is required to run tests (as additionally set in CI)
# if ismissing(get(ENV, "AWS_PROFILE", missing))
# @warn """You may need to set `ENV["AWS_PROFILE"] = weakkeyiddicts-ci` in order to successfully run the doctests"""
# end
doctest(WeakKeyIdDicts; fix=true)
haberdashPI marked this conversation as resolved.
Show resolved Hide resolved
else
error("Git repo dirty; commit changes before fixing doctests.")
end
Loading
Loading