diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04469c8..e0ad3b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: swift-test-Linux: runs-on: ubuntu-latest container: - image: swift:5.10-jammy + image: swiftlang/swift@sha256:30154112a700a5a95fd1760716bd2040e8b735f54f081a4865823abdec67d17e # swiftlang/swift:nightly-6.0-jammy as of May 26 steps: - name: Get swift version run: swift --version @@ -41,7 +41,7 @@ jobs: end-to-end-test-Linux: runs-on: ubuntu-latest container: - image: swift:5.10-jammy + image: swiftlang/swift@sha256:30154112a700a5a95fd1760716bd2040e8b735f54f081a4865823abdec67d17e # swiftlang/swift:nightly-6.0-jammy as of May 26 steps: - name: Get swift version run: swift --version diff --git a/Tests/ValidatorTests/Fixtures/github-files-response-multiple-manifests.json b/Tests/ValidatorTests/Fixtures/github-files-response-multiple-manifests.json new file mode 100644 index 0000000..36d91d3 --- /dev/null +++ b/Tests/ValidatorTests/Fixtures/github-files-response-multiple-manifests.json @@ -0,0 +1,101 @@ +{ + "tree" : [ + { + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/024f01f8183865bd26e15a7828b0d3a33028d5c5", + "path" : ".gitignore", + "sha" : "024f01f8183865bd26e15a7828b0d3a33028d5c5", + "size" : 290, + "type" : "blob", + "mode" : "100644" + }, + { + "path" : ".swift-version", + "type" : "blob", + "mode" : "100644", + "sha" : "6b244dcd6960b101b0ab4d9e5162d39632dec80c", + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/6b244dcd6960b101b0ab4d9e5162d39632dec80c", + "size" : 6 + }, + { + "type" : "blob", + "path" : ".travis.yml", + "mode" : "100644", + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/70e2b4cdfc5b7e26d7f55d97833f96aeb7d5c481", + "size" : 1697, + "sha" : "70e2b4cdfc5b7e26d7f55d97833f96aeb7d5c481" + }, + { + "sha" : "a7af196875ec68b64f30963189392f71ab9ecf79", + "type" : "blob", + "mode" : "100644", + "size" : 1075, + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/a7af196875ec68b64f30963189392f71ab9ecf79", + "path" : "LICENSE" + }, + { + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/e0570d6a1e3f5b1b4bd213315d8f0966ca8f675f", + "path" : "Package.pins", + "mode" : "100644", + "type" : "blob", + "size" : 53, + "sha" : "e0570d6a1e3f5b1b4bd213315d8f0966ca8f675f" + }, + { + "path" : "Package.swift", + "mode" : "100644", + "size" : 825, + "type" : "blob", + "sha" : "63080bd3c929a37b0c8d0796b5d08e51794c18c2", + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/63080bd3c929a37b0c8d0796b5d08e51794c18c2" + }, + { + "type" : "blob", + "path" : "Package@swift-4.2.swift", + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/7bd26320357525801b4607dcf78bfeab4ece8508", + "sha" : "7bd26320357525801b4607dcf78bfeab4ece8508", + "size" : 1517, + "mode" : "100644" + }, + { + "path" : "Package@swift-4.swift", + "type" : "blob", + "sha" : "17d053009476faba4f7832d8fb0f408d6cf94ffa", + "mode" : "100644", + "size" : 1517, + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/17d053009476faba4f7832d8fb0f408d6cf94ffa" + }, + { + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/b263042f912ec32a770d2ba254bb6a8c2a49122a", + "path" : "Package@swift-6.swift", + "size" : 1517, + "type" : "blob", + "mode" : "100644", + "sha" : "b263042f912ec32a770d2ba254bb6a8c2a49122a" + }, + { + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/blobs\/4003b2930a1f8488067c543810d02e6fa2c7c949", + "type" : "blob", + "size" : 8861, + "mode" : "100644", + "path" : "README.md", + "sha" : "4003b2930a1f8488067c543810d02e6fa2c7c949" + }, + { + "mode" : "040000", + "sha" : "4134f985c3bf0d4fc7029a127fa5082f2a7755a3", + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/trees\/4134f985c3bf0d4fc7029a127fa5082f2a7755a3", + "type" : "tree", + "path" : "Sources" + }, + { + "type" : "tree", + "sha" : "02fff52637912ccbcbbbbf2aa469de994c8b3441", + "path" : "Tests", + "mode" : "040000", + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/trees\/02fff52637912ccbcbbbbf2aa469de994c8b3441" + } + ], + "sha" : "f9b4754017cfad4701f0838b2e507b442eaca70a", + "url" : "https:\/\/api.github.com\/repos\/IBM-Swift\/SwiftyJSON\/git\/trees\/f9b4754017cfad4701f0838b2e507b442eaca70a", + "truncated" : false +} diff --git a/Tests/ValidatorTests/PackageTests.swift b/Tests/ValidatorTests/PackageTests.swift index 8d0748c..b30d693 100644 --- a/Tests/ValidatorTests/PackageTests.swift +++ b/Tests/ValidatorTests/PackageTests.swift @@ -25,16 +25,16 @@ final class PackageTests: XCTestCase { func test_decode_multiple_manifests() async throws { // This tests package dump for a package with four versioned package manifest files. - // We use a captured response for the SwiftyJSON package which lists four manifest files - // and then save no data for three of them that shouldn't be used and mock in the - // SemanticVersion manifest files for the one that should be decoded. + // We use a captured response for a package which lists four manifest files. + // For three of them that shouldn't be used we send no data when they are fetched. + // We mock in the SemanticVersion manifest file for the one that should be decoded. // setup Current = .mock Current.fileManager = .live var manifestsFetched = 0 Current.fetch = { client, url in switch url.absoluteString { - case "https://raw.githubusercontent.com/org/1/main/Package@swift-5.swift": + case "https://raw.githubusercontent.com/org/1/main/Package@swift-6.swift": // Package.decode -> fetch manifestURL data manifestsFetched += 1 return client.eventLoopGroup.next().makeSucceededFuture( @@ -51,8 +51,7 @@ final class PackageTests: XCTestCase { case "https://api.github.com/repos/org/1/git/trees/main": // getManifestURLs -> Github.listRepositoryFilePaths -> Github.fetch return client.eventLoopGroup.next().makeSucceededFuture( - // github-files-response-SwiftyJSON has multiple manifest files - try! .fixture(for: "github-files-response-SwiftyJSON.json") + try! .fixture(for: "github-files-response-multiple-manifests.json") ) default: return client.eventLoopGroup.next().makeFailedFuture(