-
Notifications
You must be signed in to change notification settings - Fork 49
Merge installation logic into swiftly as an init subcommand #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
9eb8c91
DRAFT: Merge installation logic into swiftly as an init subcommand
cmcgee1024 c272921
Design rework based on feedback, removing the swiftly-init accelerato…
cmcgee1024 2801b53
Add a note about the case when swiftly is copied during init
cmcgee1024 f2609dc
Separate the swiftly version changes from this PR
cmcgee1024 3af19ac
Provide more specific details about SWIFTLY_BIN_DIR, and moving the s…
cmcgee1024 eeb9d36
Update the design based on feedback
cmcgee1024 b64f4bd
Merge branch 'main' of github.com:cmcgee1024/swiftly into self-install
cmcgee1024 dd15324
DRAFT: Add init implementation and tests
cmcgee1024 1d3bb26
Fix formatting problems and remove problematic check in e2e install test
cmcgee1024 1cd01be
Output the shell and version in the e2e test
cmcgee1024 c8cb477
Force a hash recalculation in the e2e test
cmcgee1024 763b284
Provide more details of the failed URL when trying to install a toolc…
cmcgee1024 72b7025
Fix the URL assembly for Linux x86 toolchain downloads
cmcgee1024 a2a6d4b
Directly source the env script in e2e test rather than relying on the…
cmcgee1024 ef9ee05
Capture more information about what happens on Amazon Linux 2
cmcgee1024 7f9fb9e
Use type shell builtin to find which swift in bash for better resilie…
cmcgee1024 56672ec
Add init tests
cmcgee1024 6bf4ab9
Auto-detect the platform when running the tests
cmcgee1024 c4f87cb
Fix toolchain version source file name
cmcgee1024 4e0ed6e
Produce post installation instructions and add post install script file
cmcgee1024 11d112a
Add swiftly system prerequisite checks for ca-certificates on Linux
cmcgee1024 373be6a
Fallback to copy if move of swiftly binary fails
cmcgee1024 886865f
Fix error message for the error case in the system managed binary check
cmcgee1024 0aa21e0
Review feedback and fixes
cmcgee1024 7081738
Fix the tests
cmcgee1024 361bc2f
Review feedback
cmcgee1024 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import Foundation | ||
import SwiftlyCore | ||
import XCTest | ||
|
||
final class SwiftlyVersionTests: SwiftlyTests { | ||
func testSanity() throws { | ||
// GIVEN: a simple valid swiftly version string with major, minor, and patch | ||
let vs = "0.3.0" | ||
// WHEN: that version is parsed | ||
let ver = try! SwiftlyVersion(parsing: vs) | ||
// THEN: it succeeds and the major, minor, and patch parts match | ||
XCTAssertEqual(0, ver.major) | ||
XCTAssertEqual(3, ver.minor) | ||
XCTAssertEqual(0, ver.patch) | ||
XCTAssertEqual(nil, ver.suffix) | ||
|
||
// GIVEN: two different swiftly versions | ||
let vs040 = "0.4.0" | ||
let ver040 = try! SwiftlyVersion(parsing: vs040) | ||
// WHEN: the versions are compared | ||
let cmp = ver040 > ver | ||
// THEN: the comparison highlights the larger version | ||
XCTAssertTrue(cmp) | ||
} | ||
|
||
func testPreRelease() throws { | ||
// GIVEN: a swiftly version string with major, minor, patch, and suffix (pre-release) | ||
let preRelease = "0.4.0-dev" | ||
// WHEN: that version is parsed | ||
let preVer = try! SwiftlyVersion(parsing: preRelease) | ||
// THEN: it succeeds and the major, minor, patch, and suffix parts match | ||
XCTAssertEqual(0, preVer.major) | ||
XCTAssertEqual(4, preVer.minor) | ||
XCTAssertEqual(0, preVer.patch) | ||
XCTAssertEqual("dev", preVer.suffix) | ||
|
||
// GIVEN: a swiftly pre release version and the final release version | ||
let releaseVer = try! SwiftlyVersion(parsing: "0.4.0") | ||
// WHEN: the versions are compared | ||
let cmp = releaseVer > preVer | ||
// THEN: the released version is consider larger | ||
XCTAssertTrue(cmp) | ||
|
||
// GIVEN: a swiftly pre release version and the previous release | ||
let oldReleaseVer = try! SwiftlyVersion(parsing: "0.3.0") | ||
// WHEN: the versions are compared | ||
let cmpOldRelease = oldReleaseVer < preVer | ||
// THEN: the older version is considered smaller than the pre release | ||
XCTAssertTrue(cmpOldRelease) | ||
|
||
// GIVEN: two pre release versions that are identical except for their suffix | ||
let preVer2 = try! SwiftlyVersion(parsing: "0.4.0-pre") | ||
// WHEN: the versions are compared | ||
let cmpPreVers = preVer2 > preVer | ||
// THEN: the lexicographically larger one is considered larger | ||
XCTAssertTrue(cmpPreVers) | ||
|
||
// GIVEN: a pre-release version with dots in it | ||
let preReleaseDot = "1.5.0-alpha.1" | ||
// WHEN: that version is parsed | ||
let preVerDot = try! SwiftlyVersion(parsing: preReleaseDot) | ||
// THEN: it succeeds and the major, minor, patch, and suffix parts match | ||
XCTAssertEqual(1, preVerDot.major) | ||
XCTAssertEqual(5, preVerDot.minor) | ||
XCTAssertEqual(0, preVerDot.patch) | ||
XCTAssertEqual("alpha.1", preVerDot.suffix) | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.