Skip to content

Commit

Permalink
Update to Swift 6 (#109)
Browse files Browse the repository at this point in the history
- Update package to Swift 6
- Remove all `EventLoopFuture`s in favor of async/await
- Update JWTKit to v5
- Update to Swift Testing
- Adopt `swift-format`
- Update CI

* Update Keycloak.swift

Co-authored-by: Paul Toffoloni <[email protected]>

* Update Dropbox.swift

Co-authored-by: Paul Toffoloni <[email protected]>

* Update Discord.swift

Co-authored-by: Paul Toffoloni <[email protected]>

* Update FederatedService.swift

Co-authored-by: Paul Toffoloni <[email protected]>

* Update FederatedServiceRouter.swift

Co-authored-by: Paul Toffoloni <[email protected]>

* Update FederatedServiceRouter.swift

Co-authored-by: Paul Toffoloni <[email protected]>

* Update Auth0.swift

Co-authored-by: Paul Toffoloni <[email protected]>

* Update Sources/ImperialShopify/ShopifyRouter.swift

Co-authored-by: Vamsi Madduluri <[email protected]>

---------

Co-authored-by: Paul Toffoloni <[email protected]>
Co-authored-by: Vamsi Madduluri <[email protected]>
  • Loading branch information
3 people authored Dec 13, 2024
1 parent e88cb7e commit b2c85c9
Show file tree
Hide file tree
Showing 113 changed files with 1,821 additions and 1,845 deletions.
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"),
]
],
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

0 comments on commit b2c85c9

Please sign in to comment.