diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..d02f05007 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,75 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or +advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic +address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a +professional setting + + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers 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, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at yoshuawuyts@gmail.com, or through +IRC. All complaints will be reviewed and investigated and will result in a +response that is deemed necessary and appropriate to the circumstances. The +project team is obligated to maintain confidentiality with regard to the +reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 000000000..96806b567 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,63 @@ +# Contributing +Contributions include code, documentation, answering user questions, running the +project's infrastructure, and advocating for all types of users. + +The project welcomes all contributions from anyone willing to work in good faith +with other contributors and the community. No contribution is too small and all +contributions are valued. + +This guide explains the process for contributing to the project's GitHub +Repository. + +- [Code of Conduct](#code-of-conduct) +- [Bad Actors](#bad-actors) +- [Developer Certificate of Origin](#developer-certificate-of-origin) + +## Code of Conduct +The project has a [Code of Conduct][./CODE_OF_CONDUCT.md] that *all* +contributors are expected to follow. This code describes the *minimum* behavior +expectations for all contributors. + +As a contributor, how you choose to act and interact towards your +fellow contributors, as well as to the community, will reflect back not only +on yourself but on the project as a whole. The Code of Conduct is designed and +intended, above all else, to help establish a culture within the project that +allows anyone and everyone who wants to contribute to feel safe doing so. + +Should any individual act in any way that is considered in violation of the +[Code of Conduct][./CODE_OF_CONDUCT.md], corrective actions will be taken. It is +possible, however, for any individual to *act* in such a manner that is not in +violation of the strict letter of the Code of Conduct guidelines while still +going completely against the spirit of what that Code is intended to accomplish. + +Open, diverse, and inclusive communities live and die on the basis of trust. +Contributors can disagree with one another so long as they trust that those +disagreements are in good faith and everyone is working towards a common +goal. + +## Bad Actors +All contributors to tacitly agree to abide by both the letter and +spirit of the [Code of Conduct][./CODE_OF_CONDUCT.md]. Failure, or +unwillingness, to do so will result in contributions being respectfully +declined. + +A *bad actor* is someone who repeatedly violates the *spirit* of the Code of +Conduct through consistent failure to self-regulate the way in which they +interact with other contributors in the project. In doing so, bad actors +alienate other contributors, discourage collaboration, and generally reflect +poorly on the project as a whole. + +Being a bad actor may be intentional or unintentional. Typically, unintentional +bad behavior can be easily corrected by being quick to apologize and correct +course *even if you are not entirely convinced you need to*. Giving other +contributors the benefit of the doubt and having a sincere willingness to admit +that you *might* be wrong is critical for any successful open collaboration. + +Don't be a bad actor. + +## Developer Certificate of Origin +All contributors must read and agree to the [Developer Certificate of +Origin (DCO)](../CERTIFICATE). + +The DCO allows us to accept contributions from people to the project, similarly +to how a license allows us to distribute our code. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..ba20edd01 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,9 @@ +## Summary +Explain what is going on. + +## Your Environment +| Software | Version(s) | +| ------------------ | ---------- | +| hypercore-protocol | +| Rustc | +| Operating System | diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..47ff45203 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,23 @@ +--- +name: Bug Report +about: Did something not work as expected? +--- + +# Bug Report +## Your Environment +| Software | Version(s) | +| ------------------ | ---------- | +| hypercore-protocol | +| Rustc | +| Operating System | + +## Expected Behavior +Tell us what should have happened. + +## Current Behavior +Tell us what happens instead of the expected behavior. If you are seeing an +error, please include the full error message and stack trace. + +## Code Sample +Please provide a code repository, gist, code snippet or sample files to +reproduce the issue. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..2f86a3022 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,43 @@ +--- +name: Feature Request +about: Want us to add something to hypercore-protocol? +--- + +# Feature Request +## Summary +One paragraph explanation of the feature. + +## Motivation +Why are we doing this? What use cases does it support? What is the expected +outcome? + +## Guide-level explanation +Explain the proposal as if it was already included in the project and you +were teaching it to another programmer. That generally means: + +- Introducing new named concepts. +- Explaining the feature largely in terms of examples. +- If applicable, provide sample error messages, deprecation warnings, or + migration guidance. + +## Reference-level explanation +This is the technical portion of the feature request. Explain the design in +sufficient detail that: + +- Its interaction with other features is clear. +- It is reasonably clear how the feature would be implemented. +- Corner cases are dissected by example. + +## Drawbacks +Why should we _not_ do this? + +## Rationale and alternatives +- Why is this design the best in the space of possible designs? +- What other designs have been considered and what is the rationale for not + choosing them? +- What is the impact of not doing this? + +## Unresolved Questions +What related issues do you consider out of scope for this feature that could be +addressed in the future independently of the solution that comes out of this +feature? diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 000000000..be188e665 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,18 @@ +--- +name: Question +about: Have any questions regarding how hypercore-protocol works? +--- + +# Question +## Your Environment +| Software | Version(s) | +| ------------------ | ---------- | +| hypercore-protocol | +| Rustc | +| Operating System | + +## Question +Provide your question here. + +## Context +How has this issue affected you? What are you trying to accomplish? diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..d82058846 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,21 @@ + + +**Choose one:** is this a 🐛 bug fix, a 🙋 feature, or a 🔦 documentation change? + + + +## Checklist + +- [ ] tests pass +- [ ] tests and/or benchmarks are included +- [ ] documentation is changed or added + +## Context + + +## Semver Changes + diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000..b8550d0fb --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,17 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +daysUntilStale: 90 +daysUntilClose: 7 +exemptLabels: + - pinned + - security +exemptProjects: false +exemptMilestones: false +staleLabel: wontfix +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +unmarkComment: false +closeComment: false +limitPerRun: 30 diff --git a/.github/workflows/cargo-build.yml b/.github/workflows/cargo-build.yml new file mode 100644 index 000000000..8e7c1ba61 --- /dev/null +++ b/.github/workflows/cargo-build.yml @@ -0,0 +1,87 @@ +name: cargo-build-matrix + +# Controls when the action will run. +on: + pull_request: + branches: + - '*' + - '*/*' + - '**' + - 'master' + - 'main' + push: + branches: + - '*' + - '*/*' + - '**' + - 'master' + - 'main' + + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + ubuntu-build_and_test: + strategy: + matrix: + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: styfle/cancel-workflow-action@0.11.0 + if: ${{ !env.ACT }} + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v3 + with: + fetch-depth: '0' + submodules: 'recursive' + set-safe-directory: 'true' + + - name: Restore build/ext + id: cache-ext-restore + uses: actions/cache/restore@v3 + if: ${{ !env.ACT }} + with: + path: | + ~/.cargo + key: ${{ runner.os }}-ext + - name: printenv + run: | + printenv + touch ~/GITHUB_TOKEN.txt + + - name: install rustup + run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source "$HOME/.cargo/env" + + - name: sudo apt-get install -y make + run: | + printenv && sudo apt-get update && \ + sudo apt-get install -y make #\ + #python3 \ + #make autoconf automake \ + #libtool gettext util-linux bash cmake clang + + - name: cargo-c + run: | + make cargo-c + + - name: cargo-b + run: | + make cargo-b + + - name: cargo-b-release + run: | + make cargo-b-release + + - name: Run tests + run: source "$HOME/.cargo/env" && cargo test --verbose + + - name: Save build/ext + id: cache-ext-save + uses: actions/cache/save@v3 + if: ${{ !env.ACT }} + with: + path: | + ~/.cargo + key: ${{ steps.cache-deps-restore.outputs.cache-primary-key }} + diff --git a/.github/workflows/ghcr.io.yml b/.github/workflows/ghcr.io.yml new file mode 100644 index 000000000..5f9df5c10 --- /dev/null +++ b/.github/workflows/ghcr.io.yml @@ -0,0 +1,45 @@ +name: publish to ghcr.io +##REF:https://github.com/docker/login-action + +env: + GNOSTR_COMMAND: 'gnostr-command' + +on: + push: + branches: + - master + - main + - v** + tags: + - v0.** + - v1.** + - v2.** + - v3.** + - v4.** + #branches-ignore: + # - 'releases/**-alpha' + #tags-ignore: + # - v999.** + workflow_dispatch: + +jobs: + push-store-image: + runs-on: ubuntu-latest + defaults: + run: + working-directory: '.' + steps: + - name: 'Checkout GitHub Action' + uses: actions/checkout@main + + - name: 'Login to GitHub Container Registry' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} + + - name: 'Build gnostr-command image' + run: | + docker build . --tag ghcr.io/gnostr-org/gnostr-legit:latest + docker push ghcr.io/gnostr-org/gnostr-legit:latest diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml new file mode 100644 index 000000000..482459b82 --- /dev/null +++ b/.github/workflows/jekyll-gh-pages.yml @@ -0,0 +1,51 @@ +# Sample workflow for building and deploying a Jekyll site to GitHub Pages +name: Deploy Jekyll with GitHub Pages dependencies preinstalled + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Pages + uses: actions/configure-pages@v3 + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: ./ + destination: ./_site + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2