-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update from hummingbird-project-template 6c7f44e2f7e58f2d298a177e7342…
…1f244f41f90e (#2) Co-authored-by: adam-fowler <[email protected]>
- Loading branch information
1 parent
792db50
commit e4b34ab
Showing
5 changed files
with
188 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.build | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Verify Documentation | ||
|
||
on: | ||
pull_request: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-verifydocs | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
linux: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
container: | ||
image: swift:latest | ||
steps: | ||
- name: Install rsync 📚 | ||
run: | | ||
apt-get update && apt-get install -y rsync bc | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
path: "package" | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: "hummingbird-project/hummingbird-docs" | ||
fetch-depth: 0 | ||
path: "documentation" | ||
- name: Verify | ||
run: | | ||
cd documentation | ||
swift package edit ${GITHUB_REPOSITORY#*/} --path ../package | ||
./scripts/build-docc.sh -e | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# ================================ | ||
# Build image | ||
# ================================ | ||
FROM swift:6.0 as build | ||
|
||
WORKDIR /build | ||
|
||
# First just resolve dependencies. | ||
# This creates a cached layer that can be reused | ||
# as long as your Package.swift/Package.resolved | ||
# files do not change. | ||
COPY ./Package.* ./ | ||
RUN swift package resolve | ||
|
||
# Copy entire repo into container | ||
COPY . . | ||
|
||
RUN swift test --sanitize=thread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
#!/bin/bash | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the Hummingbird server framework project | ||
## | ||
## Copyright (c) 2021-2024 the Hummingbird authors | ||
## Licensed under Apache License v2.0 | ||
## | ||
## See LICENSE.txt for license information | ||
## See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors | ||
## | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
##===----------------------------------------------------------------------===## | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## 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) | ||
|
||
function replace_acceptable_years() { | ||
# this needs to replace all acceptable forms with 'YEARS' | ||
sed -e 's/20[12][0-9]-20[12][0-9]/YEARS/' -e 's/20[12][0-9]/YEARS/' -e '/^#!/ d' | ||
} | ||
|
||
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 | ||
exit | ||
printf "=> Checking license headers... " | ||
tmp=$(mktemp /tmp/.soto-core-sanity_XXXXXX) | ||
|
||
for language in swift-or-c; do | ||
declare -a matching_files | ||
declare -a exceptions | ||
expections=( ) | ||
matching_files=( -name '*' ) | ||
case "$language" in | ||
swift-or-c) | ||
exceptions=( -path '*Sources/INIParser/*' -o -path '*Sources/CSotoExpat/*' -o -path '*Benchmark/.build/*' -o -name Package.swift) | ||
matching_files=( -name '*.swift' -o -name '*.c' -o -name '*.h' ) | ||
cat > "$tmp" <<"EOF" | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the Hummingbird open source project | ||
// | ||
// Copyright (c) YEARS the Hummingbird authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of Hummingbird authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
EOF | ||
;; | ||
bash) | ||
matching_files=( -name '*.sh' ) | ||
cat > "$tmp" <<"EOF" | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the Hummingbird open source project | ||
## | ||
## Copyright (c) YEARS the Hummingbird authors | ||
## Licensed under Apache License v2.0 | ||
## | ||
## See LICENSE.txt for license information | ||
## See CONTRIBUTORS.txt for the list of Hummingbird authors | ||
## | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
##===----------------------------------------------------------------------===## | ||
EOF | ||
;; | ||
*) | ||
echo >&2 "ERROR: unknown language '$language'" | ||
;; | ||
esac | ||
|
||
lines_to_compare=$(cat "$tmp" | wc -l | tr -d " ") | ||
# need to read one more line as we remove the '#!' line | ||
lines_to_read=$(expr "$lines_to_compare" + 1) | ||
expected_sha=$(cat "$tmp" | shasum) | ||
|
||
( | ||
cd "$here/.." | ||
find . \ | ||
\( \! -path './.build/*' -a \ | ||
\( "${matching_files[@]}" \) -a \ | ||
\( \! \( "${exceptions[@]}" \) \) \) | while read line; do | ||
if [[ "$(cat "$line" | head -n $lines_to_read | replace_acceptable_years | head -n $lines_to_compare | shasum)" != "$expected_sha" ]]; then | ||
printf "\033[0;31mmissing headers in file '$line'!\033[0m\n" | ||
diff -u <(cat "$line" | head -n $lines_to_read | replace_acceptable_years | head -n $lines_to_compare) "$tmp" | ||
exit 1 | ||
fi | ||
done | ||
printf "\033[0;32mokay.\033[0m\n" | ||
) | ||
done | ||
|
||
rm "$tmp" |