diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2fb3343 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.build +.git \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a54e14d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,21 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + groups: + dependencies: + patterns: + - "*" + - package-ecosystem: "swift" + directory: "/" + schedule: + interval: "daily" + open-pull-requests-limit: 5 + allow: + - dependency-type: all + groups: + all-dependencies: + patterns: + - "*" diff --git a/.github/workflows/api-breakage.yml b/.github/workflows/api-breakage.yml new file mode 100644 index 0000000..9919108 --- /dev/null +++ b/.github/workflows/api-breakage.yml @@ -0,0 +1,22 @@ +name: API breaking changes + +on: + pull_request: + +jobs: + linux: + runs-on: ubuntu-latest + timeout-minutes: 15 + container: + image: swift:5.10 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + # https://github.com/actions/checkout/issues/766 + - name: Mark the workspace as safe + run: git config --global --add safe.directory ${GITHUB_WORKSPACE} + - name: API breaking changes + run: | + swift package diagnose-api-breaking-changes origin/${GITHUB_BASE_REF} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index c2eb9dd..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: CI - -on: - push: - branches: - - main - paths: - - "**.swift" - - "**.yml" - pull_request: - workflow_dispatch: - -jobs: - linux: - runs-on: ubuntu-latest - timeout-minutes: 15 - strategy: - matrix: - image: ["swift:5.10", "swiftlang/swift:nightly-6.0-jammy"] - - container: - image: ${{ matrix.image }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Test - run: | - swift test --enable-code-coverage - - name: Convert coverage files - run: | - llvm-cov export -format="lcov" \ - .build/debug/hummingbird-elementaryPackageTests.xctest \ - -ignore-filename-regex="\/Tests\/" \ - -ignore-filename-regex="\/Benchmarks\/" \ - -instr-profile .build/debug/codecov/default.profdata > info.lcov - - name: Upload to codecov.io - uses: codecov/codecov-action@v4 - with: - file: info.lcov diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8241615 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI + +on: + push: + branches: + - main + paths: + - '**.swift' + - '**.yml' + pull_request: + workflow_dispatch: + +jobs: + linux: + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + matrix: + image: ["swift:5.10", "swiftlang/swift:nightly-6.0-jammy"] + + container: + image: ${{ matrix.image }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Test + run: | + swift test --enable-code-coverage + - name: Convert coverage files + run: | + llvm-cov export -format="lcov" \ + .build/debug/hummingbird-elementaryPackageTests.xctest \ + -ignore-filename-regex="\/Tests\/" \ + -ignore-filename-regex="\/Benchmarks\/" \ + -instr-profile .build/debug/codecov/default.profdata > info.lcov + - name: Upload to codecov.io + uses: codecov/codecov-action@v4 + with: + file: info.lcov diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..1009911 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,21 @@ +name: Swift nightly build + +on: + workflow_dispatch: + +jobs: + linux: + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + matrix: + image: ['nightly-focal', 'nightly-jammy', 'nightly-amazonlinux2'] + + container: + image: swiftlang/swift:${{ matrix.image }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Test + run: | + swift test diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..f5b91e3 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,21 @@ +name: Validity Check + +on: + pull_request: + workflow_dispatch: + +jobs: + validate: + runs-on: macOS-latest + timeout-minutes: 15 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + - name: Install Dependencies + run: | + brew install mint + mint install NickLockwood/SwiftFormat@0.53.10 --no-link + - name: run script + run: ./scripts/validate.sh diff --git a/.gitignore b/.gitignore index f129058..45ca84c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,12 @@ .DS_Store -/.build +.build/ +.swiftpm/ +.vscode/ +.devcontainer/ /Packages +/*.xcodeproj xcuserdata/ -DerivedData/ -.swiftpm/configuration/registries.json -.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata -.netrc -Package.resolved \ No newline at end of file +Package.resolved +/public +/docs +.benchmarkBaselines \ No newline at end of file diff --git a/.hummingbird-community-template.yml b/.hummingbird-community-template.yml new file mode 100644 index 0000000..5845848 --- /dev/null +++ b/.hummingbird-community-template.yml @@ -0,0 +1,9 @@ +ci: + nightly: false + validate: + swiftformat: + version: 0.53.10 + enable_tests: true + linux: + images: ["swift:5.10", "swiftlang/swift:nightly-6.0-jammy"] + mac: false diff --git a/.swiftformat b/.swiftformat index 5407800..18bf5d9 100644 --- a/.swiftformat +++ b/.swiftformat @@ -1,5 +1,5 @@ # Minimum swiftformat version ---minversion 0.51.0 +--minversion 0.53.10 # Swift version --swiftversion 5.9 @@ -8,7 +8,7 @@ --exclude .build # rules ---disable redundantReturn, extensionAccessControl, typeSugar, conditionalAssignment +--disable redundantReturn, extensionAccessControl, typeSugar, conditionalAssignment, preferForLoop # format options --ifdef no-indent diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..8375921 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,54 @@ +# Code of Conduct + +All developers should feel welcome and encouraged to contribute to Hummingbird. Because of this we have adopted the code of conduct defined by [contributor-covenant.org](https://www.contributor-covenant.org). This document is used across many open source +communities, and we think it articulates our values well. The full text is copied below: + +## Contributor Code of Conduct v1.3 + +As contributors and maintainers of this project, and in the interest of +fostering an open and welcoming community, we pledge to respect all people who +contribute through reporting issues, posting feature requests, updating +documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free +experience for everyone, regardless of level of experience, gender, gender +identity and expression, sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, such as physical or electronic + addresses, without explicit permission +* Other unethical or unprofessional conduct + +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. + +By adopting this Code of Conduct, project maintainers commit themselves to +fairly and consistently applying these principles to every aspect of managing +this project. Project maintainers who do not follow or enforce the Code of +Conduct may be permanently removed from the project team. + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting a project maintainer at [INSERT EMAIL ADDRESS]. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. Maintainers are +obligated to maintain confidentiality with regard to the reporter of an +incident. + + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 1.3.0, available at https://www.contributor-covenant.org/version/1/3/0/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..7e1400d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,29 @@ +# Contributing + + +## Legal +By submitting a pull request, you represent that you have the right to license your contribution to the community, and agree by submitting the patch +that your contributions are licensed under the Apache 2.0 license (see [LICENSE](LICENSE)). + +## Contributor Conduct +All contributors are expected to adhere to the project's [Code of Conduct](CODE_OF_CONDUCT.md). + +## Submitting a bug or issue +Please ensure to include the following in your bug report +- A consise description of the issue, what happened and what you expected. +- Simple reproduction steps +- Version of the library you are using +- Contextual information (Swift version, OS etc) + +## Submitting a Pull Request + +Please ensure to include the following in your Pull Request +- A description of what you are trying to do. What the PR provides to the library, additional functionality, fixing a bug etc +- A description of the code changes +- Documentation on how these changes are being tested +- Additional tests to show your code working and to ensure future changes don't break your code. + +Please keep your PRs to a minimal number of changes. If a PR is large try to split it up into smaller PRs. Don't move code around unnecessarily it makes comparing old with new very hard. + +The main development branch of the repository is `main`. + diff --git a/scripts/validate.sh b/scripts/validate.sh new file mode 100755 index 0000000..6d90f85 --- /dev/null +++ b/scripts/validate.sh @@ -0,0 +1,39 @@ +#!/bin/bash +##===----------------------------------------------------------------------===## +## +## This source file is part of the SwiftNIO open source project +## +## Copyright (c) 2017-2019 Apple Inc. and the SwiftNIO project authors +## Licensed under Apache License v2.0 +## +## See LICENSE.txt for license information +## See CONTRIBUTORS.txt for the list of SwiftNIO project authors +## +## SPDX-License-Identifier: Apache-2.0 +## +##===----------------------------------------------------------------------===## + +SWIFT_FORMAT_VERSION=0.53.10 + +set -eu +here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +which swiftformat > /dev/null 2>&1 || (echo "swiftformat not installed. You can install it using 'brew install swiftformat'" ; exit -1) + +printf "=> Checking format... " +FIRST_OUT="$(git status --porcelain)" +if [[ -n "${CI-""}" ]]; then + printf "(using v$(mint run NickLockwood/SwiftFormat@"$SWIFT_FORMAT_VERSION" --version)) " + mint run NickLockwood/SwiftFormat@"$SWIFT_FORMAT_VERSION" . > /dev/null 2>&1 +else + printf "(using v$(swiftformat --version)) " + swiftformat . > /dev/null 2>&1 +fi +SECOND_OUT="$(git status --porcelain)" +if [[ "$FIRST_OUT" != "$SECOND_OUT" ]]; then + printf "\033[0;31mformatting issues!\033[0m\n" + git --no-pager diff + exit 1 +else + printf "\033[0;32mokay.\033[0m\n" +fi