Skip to content

Commit

Permalink
Merge pull request #20 from NeedleInAJayStack/chore/warnings
Browse files Browse the repository at this point in the history
Fixes @retroactive conformance warnings in tests
  • Loading branch information
NeedleInAJayStack authored Oct 15, 2024
2 parents 6717df8 + acb4771 commit c6129d9
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 73 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
67 changes: 0 additions & 67 deletions .github/workflows/test.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@ fastlane/test_output
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
iOSInjectionProject/

# VS Code
.vscode/
15 changes: 10 additions & 5 deletions Tests/DataLoaderTests/DataLoaderAbuseTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"))
)
}
}

Expand Down Expand Up @@ -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"))
)
}
}

Expand All @@ -98,5 +105,3 @@ class DataLoaderAbuseTests: XCTestCase {
XCTAssertTrue(try value1.wait() == 1)
}
}

extension String: Error {}

0 comments on commit c6129d9

Please sign in to comment.