From 69ec03e40b591aad1f284a50de70b5bf635ead28 Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sat, 21 Sep 2024 11:59:51 -0600 Subject: [PATCH 1/4] test: Removes String Error conformance This was causing @retroactive conformance warnings --- Tests/DataLoaderTests/DataLoaderAbuseTests.swift | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Tests/DataLoaderTests/DataLoaderAbuseTests.swift b/Tests/DataLoaderTests/DataLoaderAbuseTests.swift index 04203fe..f99e0e3 100644 --- a/Tests/DataLoaderTests/DataLoaderAbuseTests.swift +++ b/Tests/DataLoaderTests/DataLoaderAbuseTests.swift @@ -19,7 +19,10 @@ class DataLoaderAbuseTests: XCTestCase { let value = try identityLoader.load(key: 1, on: eventLoopGroup) - XCTAssertThrowsError(try value.wait(), "Did not return value for key: 1") + XCTAssertThrowsError( + try value.wait(), + "Did not return value for key: 1" + ) } func testBatchFuntionMustPromiseAnArrayOfCorrectLength() throws { @@ -53,7 +56,9 @@ class DataLoaderAbuseTests: XCTestCase { if key == 1 { results.append(DataLoaderFutureValue.success(key)) } else { - results.append(DataLoaderFutureValue.failure("Test error")) + results.append( + DataLoaderFutureValue.failure(DataLoaderError.typeError("Test error")) + ) } } @@ -83,7 +88,9 @@ class DataLoaderAbuseTests: XCTestCase { if key == 1 { results.append(DataLoaderFutureValue.success(key)) } else { - results.append(DataLoaderFutureValue.failure("Test error")) + results.append( + DataLoaderFutureValue.failure(DataLoaderError.typeError("Test error")) + ) } } @@ -98,5 +105,3 @@ class DataLoaderAbuseTests: XCTestCase { XCTAssertTrue(try value1.wait() == 1) } } - -extension String: Error {} From 7861c2421ed0cae0783e21be205590eed6b3910d Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sat, 21 Sep 2024 12:00:20 -0600 Subject: [PATCH 2/4] ci: Bumps CI to newer swift versions --- .github/workflows/test.yml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 148e958..a89aadb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,30 +33,14 @@ jobs: run: swift build - name: Run tests run: swift test - - # ubuntu-latest is ubuntu-22.04 currently. Swift versions older than 5.7 don't have builds for 22.04. https://www.swift.org/download/ - ubuntu-old: - name: Build ${{ matrix.swift }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04] - swift: ["5.4", "5.5", "5.6"] - steps: - - uses: swift-actions/setup-swift@v1 - with: - swift-version: ${{ matrix.swift }} - - uses: actions/checkout@v3 - - name: Test - run: swift test ubuntu-latest: name: Build ${{ matrix.swift }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest] - swift: ["5.7"] + os: [ubuntu-latest] + swift: ["5.8", "5.9", "5.10"] steps: - uses: swift-actions/setup-swift@v1 with: From f55785e3da2a7f6a39219109f4c9b23b05ecdfd9 Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sat, 21 Sep 2024 12:00:58 -0600 Subject: [PATCH 3/4] chore: gitignores vscode files --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7674fe7..29cc641 100644 --- a/.gitignore +++ b/.gitignore @@ -87,4 +87,7 @@ fastlane/test_output # After new code Injection tools there's a generated folder /iOSInjectionProject # https://github.com/johnno1962/injectionforxcode -iOSInjectionProject/ \ No newline at end of file +iOSInjectionProject/ + +# VS Code +.vscode/ From acb47717120ded5bcca2abf62702c5db45ba328b Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sat, 21 Sep 2024 12:07:16 -0600 Subject: [PATCH 4/4] ci: Copies Graphiti CI This brings in CI features like test coverage, newer swift versions, and more. --- .github/workflows/build.yml | 71 +++++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 51 -------------------------- 2 files changed, 71 insertions(+), 51 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0e5e3cd --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,71 @@ +name: Tests + +on: + push: + branches: [ main ] + paths-ignore: [ README.md ] + pull_request: + branches: [ main ] + paths-ignore: [ README.md ] + workflow_dispatch: + +jobs: + formatlint: + name: Format linting + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Pull formatting docker image + run: docker pull ghcr.io/nicklockwood/swiftformat:latest + - name: Run format linting + run: docker run --rm -v ${{ github.workspace }}:/repo ghcr.io/nicklockwood/swiftformat:latest /repo --lint + + macos: + name: Test on macOS + runs-on: macOS-latest + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + - uses: actions/checkout@v3 + - name: Build and test + run: swift test --parallel --enable-test-discovery + + linux: + name: Test on Linux + runs-on: ubuntu-latest + steps: + - uses: swift-actions/setup-swift@v2 + - uses: actions/checkout@v3 + - name: Test + run: swift test --parallel --enable-code-coverage + - name: Get test coverage html + run: | + llvm-cov show \ + $(swift build --show-bin-path)/DataLoaderPackageTests.xctest \ + --instr-profile $(swift build --show-bin-path)/codecov/default.profdata \ + --ignore-filename-regex="\.build|Tests" \ + --format html \ + --output-dir=.test-coverage + - name: Upload test coverage html + uses: actions/upload-artifact@v3 + with: + name: test-coverage-report + path: .test-coverage + + backcompat-ubuntu-22_04: + name: Test Swift ${{ matrix.swift }} on Ubuntu 22.04 + runs-on: ubuntu-22.04 + strategy: + matrix: + swift: ["5.7", "5.8", "5.9", "5.10"] + steps: + - uses: swift-actions/setup-swift@v2 + with: + swift-version: ${{ matrix.swift }} + - uses: actions/checkout@v3 + - name: Test + run: swift test --parallel \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index a89aadb..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Test - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] -jobs: - formatlint: - name: Format linting - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Pull formatting docker image - run: docker pull ghcr.io/nicklockwood/swiftformat:latest - - name: Run format linting - run: docker run --rm -v ${{ github.workspace }}:/repo ghcr.io/nicklockwood/swiftformat:latest /repo --lint - macos-build: - name: Build and test on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest] - steps: - - uses: actions/checkout@v2 - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: latest-stable - - name: Build - run: swift build - - name: Run tests - run: swift test - - ubuntu-latest: - name: Build ${{ matrix.swift }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - swift: ["5.8", "5.9", "5.10"] - steps: - - uses: swift-actions/setup-swift@v1 - with: - swift-version: ${{ matrix.swift }} - - uses: actions/checkout@v3 - - name: Test - run: swift test -