Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- "*"
workflow_dispatch:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
mac:
name: macOS
strategy:
matrix:
xcode: ["16.4"]
config: ["debug", "release"]
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Run ${{ matrix.config }} tests
run: swift test -c ${{ matrix.config }}

linux:
name: Linux
strategy:
matrix:
swift:
- "6.2"
runs-on: ubuntu-latest
container: swift:${{ matrix.swift }}
steps:
- uses: actions/checkout@v4
- name: Build
run: swift test
25 changes: 25 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
branches:
- main

concurrency:
group: format-${{ github.ref }}
cancel-in-progress: true

jobs:
swift_format:
name: swift-format
runs-on: macos-15
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Select Xcode 16.4
run: sudo xcode-select -s /Applications/Xcode_16.4.app
- name: Format
run: make format
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Run swift-format
branch: "main"
21 changes: 0 additions & 21 deletions .github/workflows/swift.yml

This file was deleted.

9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test:
swift test

format:
find . \
-path '*/Documentation.docc' -prune -o \
-name '*.swift' \
-not -path '*/.*' -print0 \
| xargs -0 xcrun swift-format --ignore-unparsable-files --in-place
5 changes: 1 addition & 4 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.9
// swift-tools-version: 6.0

import PackageDescription

Expand All @@ -13,9 +13,6 @@ let package = Package(
targets: [
.target(
name: "GraphQLPagination",
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency"),
]
),
.testTarget(
name: "GraphQLPaginationTests",
Expand Down
8 changes: 5 additions & 3 deletions Sources/GraphQLPagination/Connection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ extension BasicConnection {
nodes: [Node],
pagination: any GraphPaginatable,
cursor: CursorType
) where Node: GraphCursorable {
) where Node: GraphCursorable & Sendable {
self.init(nodes: nodes, pagination: pagination.pagination, cursor: cursor)
}
/// Build a connection from nodes for any forward paginatable input.
public init(
nodes: [Node],
pagination: any GraphForwardPaginatable,
cursor: CursorType
) where Node: GraphCursorable {
) where Node: GraphCursorable & Sendable {
self.init(nodes: nodes, pagination: pagination.pagination, cursor: cursor)
}
/// Build a connection from nodes with optional pagination input.
public init(
nodes: [Node],
pagination: GraphPagination?,
cursor: CursorType
) where Node: GraphCursorable {
) where Node: GraphCursorable & Sendable {
let result = EdgeBuilder.build(
cursor: cursor,
nodes: nodes,
Expand All @@ -70,5 +70,7 @@ extension BasicConnection {

extension BasicConnection: Codable where Node: Codable {}
extension BasicConnection: Equatable where Node: Equatable {}
extension BasicConnection: Sendable where Node: Sendable {}
extension BasicEdge: Codable where Node: Codable {}
extension BasicEdge: Equatable where Node: Equatable {}
extension BasicEdge: Sendable where Node: Sendable {}