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

Update to Swift 6 #109

Merged
merged 45 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
acf889c
Update to Swift 5.10
fpseverino Nov 10, 2024
0b90625
Update ImperialCore
fpseverino Nov 10, 2024
512cb80
Update Services
fpseverino Nov 10, 2024
7b86214
Remove old Microsoft service
fpseverino Nov 10, 2024
954b706
Update to Swift 6
fpseverino Nov 10, 2024
7efd4cb
Revert to macOS 13
fpseverino Nov 10, 2024
13bcee8
Update Keycloak.swift
fpseverino Nov 14, 2024
f3d5d1f
Update Dropbox.swift
fpseverino Nov 14, 2024
7126c1f
Update Discord.swift
fpseverino Nov 14, 2024
1daa432
Update FederatedService.swift
fpseverino Nov 14, 2024
406a65d
Update FederatedServiceRouter.swift
fpseverino Nov 14, 2024
967b3e5
Update FederatedServiceRouter.swift
fpseverino Nov 14, 2024
9933bc0
Update Auth0.swift
fpseverino Nov 14, 2024
7a85b7d
Conform all services
fpseverino Nov 14, 2024
4812c42
Remove `Optional+Imperial`
fpseverino Nov 14, 2024
2bb8422
Change existential return types to opaque (where possible)
fpseverino Nov 14, 2024
91abbb3
Remove `FullTypedThrows`
fpseverino Nov 14, 2024
45634e6
Remove superfluous `String` extension
fpseverino Nov 15, 2024
88553a3
Improve error types
fpseverino Nov 15, 2024
c824ad4
Introduce basic testing
fpseverino Nov 16, 2024
f3e2e60
Improve `OAuthService` sendability
fpseverino Nov 16, 2024
c9199fc
Add more basic tests
fpseverino Nov 16, 2024
9732bbf
Make a lot of stuff `Sendable`
fpseverino Nov 17, 2024
a11f7c8
Remove a lot of `Sendable` warnings
fpseverino Nov 17, 2024
d70b8ea
Make `ShopifyRouter` fully `Sendable`
fpseverino Nov 20, 2024
b368cee
Enable Swift 6 language mode
fpseverino Nov 20, 2024
f1fef48
Update to JWTKit v5
fpseverino Nov 20, 2024
c17faff
Add formatting and linting
fpseverino Nov 20, 2024
0d08b17
Update README and add `.spi.yml`
fpseverino Nov 20, 2024
7a59e31
Adjust formatting and update documentation
fpseverino Nov 22, 2024
cb9f630
Make error testing more type safe
fpseverino Nov 22, 2024
0ab3d8a
Update Sources/ImperialShopify/ShopifyRouter.swift
fpseverino Nov 22, 2024
cc43d63
Make all `FederatedService` `Sendable`
fpseverino Nov 22, 2024
87c761b
Refactor `Shopify` class to streamline token and router properties
fpseverino Nov 22, 2024
7d1550f
Remove `baseURL` where unnecessary
fpseverino Nov 22, 2024
27611f7
Add OAuth routes inside `withApp`
fpseverino Nov 22, 2024
cb6e3e5
Improve tests
fpseverino Nov 23, 2024
c6163c3
Make the linter happy
fpseverino Nov 23, 2024
2e9ef29
Update remaining services
fpseverino Dec 4, 2024
6bee2ff
Remove unnecessary `public`s
fpseverino Dec 4, 2024
83b6160
Update .spi.yml
fpseverino Dec 4, 2024
169c111
Make the linter happy
fpseverino Dec 4, 2024
e36ae31
Remove `FederatedCreatable` and `OAuthService`
fpseverino Dec 4, 2024
70f39d0
Change all `class`es to `struct`s
fpseverino Dec 4, 2024
4b3e1ba
Make a lot of `public` APIs `internal` or `package`
fpseverino Dec 6, 2024
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
44 changes: 44 additions & 0 deletions .env.testing
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
AUTH0_DOMAIN=test
AUTH0_CLIENT_ID=test
AUTH0_CLIENT_SECRET=test

DEVIANTART_CLIENT_ID=test
DEVIANTART_CLIENT_SECRET=test

DISCORD_CLIENT_ID=test
DISCORD_CLIENT_SECRET=test

DROPBOX_CLIENT_ID=test
DROPBOX_CLIENT_SECRET=test

FACEBOOK_CLIENT_ID=test
FACEBOOK_CLIENT_SECRET=test

GITHUB_CLIENT_ID=test
GITHUB_CLIENT_SECRET=test

GITLAB_CLIENT_ID=test
GITLAB_CLIENT_SECRET=test

GOOGLE_CLIENT_ID=test
GOOGLE_CLIENT_SECRET=test

GOOGLEJWT_CLIENT_EMAIL=test
GOOGLEJWT_CLIENT_SECRET=test

IMGUR_CLIENT_ID=test
IMGUR_CLIENT_SECRET=test

KEYCLOAK_CLIENT_ID=test
KEYCLOAK_CLIENT_SECRET=test
KEYCLOAK_ACCESS_TOKEN_URL=test
KEYCLOAK_AUTH_URL=test

MICROSOFT_CLIENT_ID=test
MICROSOFT_CLIENT_SECRET=test

MIXCLOUD_CLIENT_ID=test
MIXCLOUD_CLIENT_SECRET=test

SHOPIFY_CLIENT_ID=test
SHOPIFY_CLIENT_SECRET=test
58 changes: 12 additions & 46 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,15 @@
name: test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

pull_request: { types: [opened, reopened, synchronize, ready_for_review] }
push: { branches: [ main ] }

jobs:
macos:
strategy:
fail-fast: false
matrix:
xcode: [latest, latest-stable]
runs-on: macos-latest
steps:
- name: Select latest available Xcode
uses: maxim-lobanov/[email protected]
with: { 'xcode-version': '${{ matrix.xcode }}' }
- name: Check out code
uses: actions/checkout@v2
- name: Run tests with Thread Sanitizer
run: swift test --enable-test-discovery --sanitize=thread
linux:
strategy:
fail-fast: false
matrix:
swiftver:
- swift:5.2
- swift:5.3
swiftos:
- xenial
- bionic
- focal
- centos7
- centos8
- amazonlinux2
container: ${{ format('{0}-{1}', matrix.swiftver, matrix.swiftos) }}
runs-on: ubuntu-latest
steps:
- name: SPM is incompatible with CentOS 7
if: ${{ matrix.swiftos == 'centos7' }}
run: |
yum install -y make libcurl-devel
git clone https://github.com/git/git -bv2.28.0 --depth 1 && cd git
make prefix=/usr -j all install NO_OPENSSL=1 NO_EXPAT=1 NO_TCLTK=1 NO_GETTEXT=1 NO_PERL=1
- name: Check out code
uses: actions/checkout@v2
- name: Run tests with Thread Sanitizer
run: swift test --enable-test-discovery --sanitize=thread
unit-tests:
uses: vapor/ci/.github/workflows/run-unit-tests.yml@main
with:
with_linting: true
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
18 changes: 18 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 1
builder:
configs:
- documentation_targets:
- ImperialCore
- ImperialAuth0
- ImperialDeviantArt
- ImperialDiscord
- ImperialDropbox
- ImperialFacebook
- ImperialGitHub
- ImperialGitlab
- ImperialGoogle
- ImperialImgur
- ImperialKeycloak
- ImperialMicrosoft
- ImperialMixcloud
- ImperialShopify
70 changes: 70 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"fileScopedDeclarationPrivacy": {
"accessLevel": "private"
},
"indentation": {
"spaces": 4
},
"indentConditionalCompilationBlocks": true,
"indentSwitchCaseLabels": false,
"lineBreakAroundMultilineExpressionChainComponents": false,
"lineBreakBeforeControlFlowKeywords": false,
"lineBreakBeforeEachArgument": false,
"lineBreakBeforeEachGenericRequirement": false,
"lineLength": 140,
"maximumBlankLines": 1,
"multiElementCollectionTrailingCommas": true,
"noAssignmentInExpressions": {
"allowedFunctions": [
"XCTAssertNoThrow"
]
},
"prioritizeKeepingFunctionOutputTogether": false,
"respectsExistingLineBreaks": true,
"rules": {
"AllPublicDeclarationsHaveDocumentation": false,
"AlwaysUseLiteralForEmptyCollectionInit": false,
"AlwaysUseLowerCamelCase": true,
"AmbiguousTrailingClosureOverload": true,
"BeginDocumentationCommentWithOneLineSummary": false,
"DoNotUseSemicolons": true,
"DontRepeatTypeInStaticProperties": true,
"FileScopedDeclarationPrivacy": true,
"FullyIndirectEnum": true,
"GroupNumericLiterals": true,
"IdentifiersMustBeASCII": true,
"NeverForceUnwrap": false,
"NeverUseForceTry": false,
"NeverUseImplicitlyUnwrappedOptionals": false,
"NoAccessLevelOnExtensionDeclaration": true,
"NoAssignmentInExpressions": true,
"NoBlockComments": true,
"NoCasesWithOnlyFallthrough": true,
"NoEmptyTrailingClosureParentheses": true,
"NoLabelsInCasePatterns": true,
"NoLeadingUnderscores": false,
"NoParensAroundConditions": true,
"NoPlaygroundLiterals": true,
"NoVoidReturnOnFunctionSignature": true,
"OmitExplicitReturns": false,
"OneCasePerLine": true,
"OneVariableDeclarationPerLine": true,
"OnlyOneTrailingClosureArgument": true,
"OrderedImports": true,
"ReplaceForEachWithForLoop": true,
"ReturnVoidInsteadOfEmptyTuple": true,
"TypeNamesShouldBeCapitalized": true,
"UseEarlyExits": false,
"UseExplicitNilCheckInConditions": true,
"UseLetInEveryBoundCaseVariable": true,
"UseShorthandTypeNames": true,
"UseSingleLinePropertyGetter": true,
"UseSynthesizedInitializer": true,
"UseTripleSlashForDocumentationComments": true,
"UseWhereClausesInForLoops": false,
"ValidateDocumentationComments": false
},
"spacesAroundRangeFormationOperators": false,
"tabWidth": 8,
"version": 1
}
94 changes: 66 additions & 28 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,59 +1,97 @@
// swift-tools-version:5.2
// swift-tools-version:6.0
import PackageDescription

let package = Package(
name: "Imperial",
platforms: [
.macOS(.v10_15)
.macOS(.v13)
],
products: [
.library(name: "ImperialCore", targets: ["ImperialCore"]),
.library(name: "ImperialAuth0", targets: ["ImperialCore", "ImperialAuth0"]),
.library(name: "ImperialDeviantArt", targets: ["ImperialCore", "ImperialDeviantArt"]),
.library(name: "ImperialDiscord", targets: ["ImperialCore", "ImperialDiscord"]),
.library(name: "ImperialDropbox", targets: ["ImperialCore", "ImperialDropbox"]),
.library(name: "ImperialFacebook", targets: ["ImperialCore", "ImperialFacebook"]),
.library(name: "ImperialGitHub", targets: ["ImperialCore", "ImperialGitHub"]),
.library(name: "ImperialGitlab", targets: ["ImperialCore", "ImperialGitlab"]),
.library(name: "ImperialGoogle", targets: ["ImperialCore", "ImperialGoogle"]),
.library(name: "ImperialImgur", targets: ["ImperialCore", "ImperialImgur"]),
.library(name: "ImperialKeycloak", targets: ["ImperialCore", "ImperialKeycloak"]),
.library(name: "ImperialMicrosoft", targets: ["ImperialCore", "ImperialMicrosoft"]),
.library(name: "ImperialMixcloud", targets: ["ImperialCore", "ImperialMixcloud"]),
.library(name: "ImperialShopify", targets: ["ImperialCore", "ImperialShopify"]),
.library(name: "Imperial", targets: [
"ImperialCore",
"ImperialAuth0",
"ImperialDiscord",
"ImperialDropbox",
"ImperialFacebook",
"ImperialGitHub",
"ImperialGitlab",
"ImperialGoogle",
"ImperialKeycloak",
"ImperialMicrosoft",
"ImperialShopify"
]),
.library(
name: "Imperial",
targets: [
"ImperialCore",
"ImperialAuth0",
"ImperialDeviantArt",
"ImperialDiscord",
"ImperialDropbox",
"ImperialFacebook",
"ImperialGitHub",
"ImperialGitlab",
"ImperialGoogle",
"ImperialImgur",
"ImperialKeycloak",
"ImperialMicrosoft",
"ImperialMixcloud",
"ImperialShopify",
]),
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0"),
.package(url: "https://github.com/vapor/jwt-kit.git", from: "4.0.0")
.package(url: "https://github.com/vapor/jwt-kit.git", from: "5.0.0"),
],
targets: [
.target(
name: "ImperialCore",
dependencies: [
.product(name: "Vapor", package: "vapor"),
.product(name: "JWTKit", package: "jwt-kit"),
]
fpseverino marked this conversation as resolved.
Show resolved Hide resolved
],
swiftSettings: swiftSettings
),
.target(name: "ImperialAuth0", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.target(name: "ImperialDeviantArt", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.target(name: "ImperialDiscord", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.target(name: "ImperialDropbox", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.target(name: "ImperialFacebook", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.target(name: "ImperialGitHub", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.target(name: "ImperialGitlab", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.target(name: "ImperialGoogle", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.target(name: "ImperialImgur", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.target(name: "ImperialKeycloak", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.target(name: "ImperialMicrosoft", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.target(name: "ImperialMixcloud", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.target(name: "ImperialShopify", dependencies: ["ImperialCore"], swiftSettings: swiftSettings),
.testTarget(
name: "ImperialTests",
dependencies: [
.target(name: "ImperialCore"),
.target(name: "ImperialAuth0"),
.target(name: "ImperialDeviantArt"),
.target(name: "ImperialDiscord"),
.target(name: "ImperialDropbox"),
.target(name: "ImperialFacebook"),
.target(name: "ImperialGitHub"),
.target(name: "ImperialGitlab"),
.target(name: "ImperialGoogle"),
.target(name: "ImperialImgur"),
.target(name: "ImperialKeycloak"),
.target(name: "ImperialMicrosoft"),
.target(name: "ImperialMixcloud"),
.target(name: "ImperialShopify"),
.product(name: "XCTVapor", package: "vapor"),
],
swiftSettings: swiftSettings
),
.target(name: "ImperialAuth0", dependencies: ["ImperialCore"]),
.target(name: "ImperialDiscord", dependencies: ["ImperialCore"]),
.target(name: "ImperialDropbox", dependencies: ["ImperialCore"]),
.target(name: "ImperialFacebook", dependencies: ["ImperialCore"]),
.target(name: "ImperialGitHub", dependencies: ["ImperialCore"]),
.target(name: "ImperialGitlab", dependencies: ["ImperialCore"]),
.target(name: "ImperialGoogle", dependencies: ["ImperialCore"]),
.target(name: "ImperialKeycloak", dependencies: ["ImperialCore"]),
.target(name: "ImperialMicrosoft", dependencies: ["ImperialCore"]),
.target(name: "ImperialShopify", dependencies: ["ImperialCore"]),
.testTarget(name: "ImperialTests", dependencies: ["ImperialCore", "ImperialShopify"]),
]
)

var swiftSettings: [SwiftSetting] {
[
.enableUpcomingFeature("ExistentialAny")
]
}
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
# Imperial
<div align="center">
<img src="https://avatars.githubusercontent.com/u/26165732?s=200&v=4" width="100" height="100" alt="avatar" />
<h1>Imperial</h1>
<a href="https://swiftpackageindex.com/vapor-community/Imperial/documentation">
<img src="https://design.vapor.codes/images/readthedocs.svg" alt="Documentation">
</a>
<a href="https://discord.gg/vapor"><img src="https://design.vapor.codes/images/discordchat.svg" alt="Team Chat"></a>
<a href="LICENSE"><img src="https://design.vapor.codes/images/mitlicense.svg" alt="MIT License"></a>
<a href="https://github.com/vapor-community/Imperial/actions/workflows/test.yml">
<img src="https://img.shields.io/github/actions/workflow/status/vapor-community/Imperial/test.yml?event=push&style=plastic&logo=github&label=tests&logoColor=%23ccc" alt="Continuous Integration">
</a>
<a href="https://codecov.io/github/vapor-community/Imperial">
<img src="https://img.shields.io/codecov/c/github/vapor-community/Imperial?style=plastic&logo=codecov&label=codecov">
</a>
<a href="https://swift.org">
<img src="https://design.vapor.codes/images/swift60up.svg" alt="Swift 6.0+">
</a>
</div>
<br>

Imperial is a Federated Login service, allowing you to easily integrate your Vapor applications with OAuth providers to handle your apps authentication.

- [Usage Guides](https://github.com/vapor-community/Imperial/blob/master/docs)

## Attribution
Author(s): @calebkleveter, @rafiki270

## License

All code contained in the Imperial package is under the [MIT](https://github.com/vapor-community/Imperial/blob/master/LICENSE) license agreement.
24 changes: 0 additions & 24 deletions Sources/Imperial/Services/DeviantArt/DeviantArt.swift

This file was deleted.

Loading
Loading