Skip to content

Commit

Permalink
2.x.x setup updates (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler authored Feb 19, 2024
1 parent a3b4c72 commit 9974057
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 46 deletions.
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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: 6
allow:
- dependency-type: all
groups:
all-dependencies:
patterns:
- "*"
5 changes: 4 additions & 1 deletion .github/workflows/api-breakage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ name: API breaking changes

on:
pull_request:
branches:
- main

jobs:
linux:
runs-on: ubuntu-latest
timeout-minutes: 15
container:
image: swift:5.9
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
# https://github.com/actions/checkout/issues/766
Expand Down
25 changes: 3 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,24 @@ on:
branches:
- main
- 2.x.x
paths:
- '**.swift'
- '**.yml'
workflow_dispatch:

jobs:
# macOS:
# runs-on: macOS-13
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: SPM tests
# run: swift test --enable-code-coverage
# - name: Convert coverage files
# run: |
# xcrun llvm-cov export -format "lcov" \
# .build/debug/hummingbird-authPackageTests.xctest/Contents/MacOs/hummingbird-authPackageTests \
# -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@v3
# with:
# file: info.lcov
linux:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
image:
- 'swift:5.9'
- 'swiftlang/swift:nightly-5.10-jammy'
- 'swiftlang/swift:nightly-jammy'

container:
image: ${{ matrix.image }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Test
run: |
swift test --enable-code-coverage
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
name: Swift nightly build

on:
schedule:
- cron: '0 1 * * 1'
workflow_dispatch:

jobs:
macOS:
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: SPM tests
run: swift test
linux:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
image: ['nightly-focal', 'nightly-jammy', 'nightly-amazonlinux2']
Expand All @@ -23,7 +15,7 @@ jobs:
image: swiftlang/swift:${{ matrix.image }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Test
run: |
swift test --enable-test-discovery
6 changes: 4 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ on:
pull_request:
branches:
- main
- 2.x.x

jobs:
validate:
runs-on: macOS-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Dependencies
run: |
brew install mint
mint install NickLockwood/SwiftFormat@0.48.17 --no-link
mint install NickLockwood/SwiftFormat@0.51.15 --no-link
- name: run script
run: ./scripts/validate.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ xcuserdata/
Package.resolved
/public
/docs
.benchmarkBaselines
6 changes: 3 additions & 3 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Minimum swiftformat version
--minversion 0.47.4
--minversion 0.51.0

# Swift version
--swiftversion 5.3
--swiftversion 5.9

# file options
--exclude .build

# rules
--disable redundantReturn, extensionAccessControl
--disable redundantReturn, extensionAccessControl, typeSugar

# format options
--ifdef no-indent
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 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.txt)).
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).
Expand Down Expand Up @@ -30,4 +30,4 @@ The main development branch of the repository is `main`.

### Formatting

We use Nick Lockwood's SwiftFormat for formatting code. PRs will not be accepted if they haven't be formatted. The current version of SwiftFormat we are using is v0.48.17.
We use Nick Lockwood's SwiftFormat for formatting code. PRs will not be accepted if they haven't be formatted. The current version of SwiftFormat we are using is v0.51.15.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ================================
# Build image
# ================================
FROM swift:5.7 as build
FROM swift:5.9 as build

WORKDIR /build

Expand Down
4 changes: 2 additions & 2 deletions Sources/HummingbirdAuth/OTP/OTP.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extension OTP {
let label = label.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? label
let issuer = issuer?.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? issuer
var url = "otpauth://\(algorithmName)/\(label)?secret=\(base32)"
if let issuer = issuer {
if let issuer {
url += "&issuer=\(issuer)"
}
url += parameters
Expand Down Expand Up @@ -217,7 +217,7 @@ extension FixedWidthInteger {
}
}

extension Array where Element == UInt8 {
extension Array<UInt8> {
/// Construct Array of UInt8 by copying memory
init(_ bytes: UnsafeRawPointer, count: Int) {
self.init(unsafeUninitializedCapacity: count) { buffer, c in
Expand Down
4 changes: 2 additions & 2 deletions Sources/HummingbirdAuth/Sessions/SessionStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public struct HBSessionStorage: Sendable {
/// ```
/// If you know a session already exists it is preferable to use
/// ``HBSessionStorage/update(session:expiresIn:request:)``.
public func save<Session: Codable>(session: Session, expiresIn: Duration) async throws -> HBCookie {
public func save(session: some Codable, expiresIn: Duration) async throws -> HBCookie {
let sessionId = Self.createSessionId()
// prefix with "hbs."
try await self.storage.set(
Expand All @@ -68,7 +68,7 @@ public struct HBSessionStorage: Sendable {
/// update existing session
///
/// If session does not exist then a `sessionDoesNotExist` error will be thrown
public func update<Session: Codable>(session: Session, expiresIn: Duration, request: HBRequest) async throws {
public func update(session: some Codable, expiresIn: Duration, request: HBRequest) async throws {
guard let sessionId = self.getId(request: request) else {
throw Error.sessionDoesNotExist
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
##
##===----------------------------------------------------------------------===##

SWIFT_FORMAT_VERSION=0.48.17
SWIFT_FORMAT_VERSION=0.51.15

set -eu
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Expand Down

0 comments on commit 9974057

Please sign in to comment.