Skip to content

Commit

Permalink
Integrate with swift-http-types (#2)
Browse files Browse the repository at this point in the history
Signed-off-by: Henrik Panhans <[email protected]>
  • Loading branch information
henrik-dmg authored Mar 17, 2024
1 parent a0d0425 commit 6e1266a
Show file tree
Hide file tree
Showing 54 changed files with 1,366 additions and 795 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/documentation.yml

This file was deleted.

101 changes: 94 additions & 7 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code Testing
name: Swift

on:
push:
Expand All @@ -7,13 +7,100 @@ on:
branches: [main]

jobs:
build:
runs-on: macos-latest

test-swift:
name: Test Swift Code
runs-on: macos-14
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Configure Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Checkout Code
uses: actions/checkout@v4
- name: Cache SPM dependencies
uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Build
run: swift build -v
- name: Run tests
run: swift test -v
run: swift test --enable-code-coverage -v
- name: Convert coverage report
run: Scripts/convert-coverage-report --target HPNetworkPackageTests
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: henrik-dmg/HPNetwork

lint-code:
name: Lint Swift Code
runs-on: macos-14
steps:
- name: Configure Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Checkout Code
uses: actions/checkout@v4
- name: Cache SPM dependencies
uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Install SwiftLint
run: brew install swift-format peripheryapp/periphery/periphery
- name: Lint code
run: Scripts/lint-swift-code
- name: Scan for dead code
run: periphery scan --strict

deploy-pages:
name: Deploy Documentation to GitHub Pages
runs-on: macos-14
if: github.event_name != 'pull_request'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
needs:
- test-swift
steps:
- name: Configure Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Checkout Code
uses: actions/checkout@v4
- name: Cache SPM dependencies
uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Build DocC
run: |
swift package \
--allow-writing-to-directory "$RUNNER_TEMP/docs" \
generate-documentation \
--target HPNetwork \
--transform-for-static-hosting \
--hosting-base-path HPNetwork \
--output-path "$RUNNER_TEMP/docs"
- name: Fix Root Path
run: echo "<script>window.location.href += \"documentation/hpnetwork\"</script>" > "$RUNNER_TEMP/docs/index.html"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ runner.temp }}/docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
xcuserdata/
.swiftpm
icon-configuration.json
.vscode
.vscode
/coverage
1 change: 1 addition & 0 deletions .periphery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
retain_public: true
27 changes: 19 additions & 8 deletions .swift-format → .swift-format.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,59 @@
"indentSwitchCaseLabels": false,
"lineBreakAroundMultilineExpressionChainComponents": false,
"lineBreakBeforeControlFlowKeywords": false,
"lineBreakBeforeEachArgument": false,
"lineBreakBeforeEachArgument": true,
"lineBreakBeforeEachGenericRequirement": false,
"lineLength": 160,
"lineLength": 140,
"maximumBlankLines": 1,
"multiElementCollectionTrailingCommas": true,
"noAssignmentInExpressions": {
"allowedFunctions": ["XCTAssertNoThrow"]
},
"prioritizeKeepingFunctionOutputTogether": false,
"respectsExistingLineBreaks": true,
"rules": {
"AllPublicDeclarationsHaveDocumentation": false,
"AlwaysUseLiteralForEmptyCollectionInit": true,
"AlwaysUseLowerCamelCase": true,
"AmbiguousTrailingClosureOverload": true,
"BeginDocumentationCommentWithOneLineSummary": false,
"BeginDocumentationCommentWithOneLineSummary": true,
"DoNotUseSemicolons": true,
"DontRepeatTypeInStaticProperties": true,
"FileScopedDeclarationPrivacy": true,
"FullyIndirectEnum": true,
"GroupNumericLiterals": true,
"IdentifiersMustBeASCII": true,
"NeverForceUnwrap": false,
"NeverUseForceTry": false,
"NeverForceUnwrap": true,
"NeverUseForceTry": true,
"NeverUseImplicitlyUnwrappedOptionals": false,
"NoAccessLevelOnExtensionDeclaration": false,
"NoAccessLevelOnExtensionDeclaration": true,
"NoAssignmentInExpressions": true,
"NoBlockComments": true,
"NoCasesWithOnlyFallthrough": true,
"NoEmptyTrailingClosureParentheses": true,
"NoLabelsInCasePatterns": true,
"NoLeadingUnderscores": false,
"NoParensAroundConditions": true,
"NoPlaygroundLiterals": true,
"NoVoidReturnOnFunctionSignature": true,
"OmitExplicitReturns": true,
"OneCasePerLine": true,
"OneVariableDeclarationPerLine": true,
"OnlyOneTrailingClosureArgument": true,
"OrderedImports": true,
"ReplaceForEachWithForLoop": true,
"ReturnVoidInsteadOfEmptyTuple": true,
"TypeNamesShouldBeCapitalized": true,
"UseEarlyExits": false,
"UseLetInEveryBoundCaseVariable": true,
"UseShorthandTypeNames": true,
"UseSingleLinePropertyGetter": true,
"UseSynthesizedInitializer": true,
"UseTripleSlashForDocumentationComments": true,
"UseWhereClausesInForLoops": false,
"ValidateDocumentationComments": false
"UseWhereClausesInForLoops": true,
"ValidateDocumentationComments": true
},
"spacesAroundRangeFormationOperators": true,
"tabWidth": 4,
"version": 1
}
Binary file removed Assets/Banner.png
Binary file not shown.
Binary file removed Assets/Logo.png
Binary file not shown.
22 changes: 0 additions & 22 deletions HPNetwork.podspec

This file was deleted.

45 changes: 27 additions & 18 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "9f39744e025c7d377987f30b03770805dcb0bcd1",
"version" : "1.1.4"
"revision" : "fee6933f37fde9a5e12a1e4aeaa93fe60116ff2a",
"version" : "1.2.2"
}
},
{
"identity" : "swift-cmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-cmark.git",
"state" : {
"revision" : "29d9c97e6310b87c4799268eaa2fc76164b2dbd8",
"version" : "0.2.0"
}
},
{
Expand All @@ -15,16 +24,16 @@
"location" : "https://github.com/apple/swift-docc-plugin",
"state" : {
"branch" : "main",
"revision" : "e013865138b53db901825fe4c002c9ec827a4109"
"revision" : "26ac5758409154cc448d7ab82389c520fa8a8247"
}
},
{
"identity" : "swift-docc-symbolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-symbolkit",
"state" : {
"branch" : "main",
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34"
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
},
{
Expand All @@ -33,34 +42,34 @@
"location" : "https://github.com/apple/swift-format",
"state" : {
"branch" : "main",
"revision" : "e5875f32d37d0de760bd4ca3b988f42373866f96"
"revision" : "235667552abb69db75ba9c45bdff901b1626c71d"
}
},
{
"identity" : "swift-syntax",
"identity" : "swift-http-types",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"location" : "https://github.com/apple/swift-http-types.git",
"state" : {
"branch" : "main",
"revision" : "f9985dda45b883f750f2fc0d47ee10893572cc22"
"revision" : "12358d55a3824bd5fed310b999ea8cf83a9a1a65",
"version" : "1.0.3"
}
},
{
"identity" : "swift-system",
"identity" : "swift-markdown",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"location" : "https://github.com/apple/swift-markdown.git",
"state" : {
"revision" : "836bc4557b74fe6d2660218d56e3ce96aff76574",
"version" : "1.1.1"
"revision" : "68b2fed9fb12fb71ac81e537f08bed430b189e35",
"version" : "0.2.0"
}
},
{
"identity" : "swift-tools-support-core",
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-tools-support-core.git",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "284a41800b7c5565512ec6ae21ee818aac1f84ac",
"version" : "0.4.0"
"branch" : "main",
"revision" : "09119754db685e6762d70e670567f522bd8828dd"
}
}
],
Expand Down
Loading

0 comments on commit 6e1266a

Please sign in to comment.