Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb449ff412 | ||
|
|
14f03abaad | ||
|
|
ecbb3a60fe | ||
|
|
3af771f543 | ||
|
|
0b68e5c011 | ||
|
|
fec4ed25de | ||
|
|
6e78d9317e | ||
|
|
3035c45808 |
9
.github/workflows/checks.yml
vendored
9
.github/workflows/checks.yml
vendored
@@ -1,14 +1,13 @@
|
|||||||
name: Checks
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
paths:
|
paths:
|
||||||
- Sources/**
|
- '**/*.swift'
|
||||||
- Tests/**
|
- .github/workflows/checks.yml
|
||||||
jobs:
|
jobs:
|
||||||
macOS:
|
smoke:
|
||||||
runs-on: macos-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: swift --version
|
- run: swift --version
|
||||||
|
|||||||
92
.github/workflows/ci.yml
vendored
92
.github/workflows/ci.yml
vendored
@@ -1,10 +1,18 @@
|
|||||||
name: CI
|
name: CI
|
||||||
on: pull_request
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '**/*.swift'
|
||||||
|
- .github/workflows/ci.yml
|
||||||
|
schedule:
|
||||||
|
- cron: '3 3 * * 5' # 3:03 AM, every Friday
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.head_ref || 'push' }}
|
||||||
|
cancel-in-progress: true
|
||||||
jobs:
|
jobs:
|
||||||
smoke:
|
smoke:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: technote-space/auto-cancel-redundant-job@v1
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: swift test --generate-linuxmain
|
- run: swift test --generate-linuxmain
|
||||||
- run: git diff --exit-code
|
- run: git diff --exit-code
|
||||||
@@ -13,71 +21,61 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
destination:
|
platform:
|
||||||
- platform=iOS Simulator,OS=latest,name=iPhone 12
|
- iOS
|
||||||
- platform=tvOS Simulator,OS=latest,name=Apple TV
|
- tvOS
|
||||||
# - platform=watchOS Simulator,OS=latest,name=Apple Watch Series 5 - 40mm
|
- macOS
|
||||||
# ^^ coming with Xcode 12.5 which is not yet available on GHA
|
- watchOS
|
||||||
- platform=macOS
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: maxim-lobanov/setup-xcode@v1
|
- uses: mxcl/xcodebuild@v1
|
||||||
with:
|
with:
|
||||||
xcode-version: 12.4
|
platform: ${{ matrix.platform }}
|
||||||
- run: swift package generate-xcodeproj --enable-code-coverage
|
code-coverage: true
|
||||||
- uses: sersoft-gmbh/xcodebuild-action@v1
|
warnings-as-errors: true
|
||||||
with:
|
|
||||||
project: Path.swift.xcodeproj
|
|
||||||
scheme: Path.swift-Package
|
|
||||||
destination: ${{ matrix.destination }}
|
|
||||||
action: test
|
|
||||||
- uses: codecov/codecov-action@v1
|
- uses: codecov/codecov-action@v1
|
||||||
|
|
||||||
linux-swift-4:
|
linux-swift-4:
|
||||||
name: linux (4.2)
|
name: linux (${{ matrix.swift }})
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
swift: ['4.2', '5.0']
|
||||||
|
container:
|
||||||
|
image: swift:${{ matrix.swift }}
|
||||||
steps:
|
steps:
|
||||||
- uses: fwal/setup-swift@v1
|
|
||||||
with:
|
|
||||||
swift-version: 4.2
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: swift test --parallel
|
- run: useradd -ms /bin/bash mxcl
|
||||||
|
- run: chown -R mxcl .
|
||||||
|
- run: su mxcl -c 'swift test --parallel'
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
swift:
|
swift:
|
||||||
- '5.0'
|
|
||||||
- '5.1'
|
- '5.1'
|
||||||
- '5.2'
|
- '5.2'
|
||||||
- '5.3'
|
- '5.3'
|
||||||
|
- '5.4'
|
||||||
|
container:
|
||||||
|
image: swift:${{ matrix.swift }}
|
||||||
steps:
|
steps:
|
||||||
- uses: fwal/setup-swift@v1
|
|
||||||
with:
|
|
||||||
swift-version: ${{ matrix.swift }}
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: swift test --parallel --enable-code-coverage
|
- run: useradd -ms /bin/bash mxcl
|
||||||
- name: Generate Coverage Report
|
# ^^ we need to be a normal user and not root for the tests to be valid
|
||||||
|
- run: chown -R mxcl .
|
||||||
|
- run: su mxcl -c 'swift test --parallel --enable-code-coverage'
|
||||||
|
- name: Generate `.lcov`
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -qq update && sudo apt-get -qq install llvm-10
|
apt-get -qq update && apt-get -qq install curl
|
||||||
export b=$(swift build --show-bin-path) && llvm-cov-10 \
|
b=$(swift build --show-bin-path)
|
||||||
export -format lcov \
|
llvm-cov export \
|
||||||
-instr-profile=$b/codecov/default.profdata \
|
-format lcov \
|
||||||
--ignore-filename-regex='\.build/' \
|
-instr-profile="$b"/codecov/default.profdata \
|
||||||
$b/Path.swiftPackageTests.xctest \
|
--ignore-filename-regex='\.build|Tests' \
|
||||||
|
"$b"/*.xctest \
|
||||||
> info.lcov
|
> info.lcov
|
||||||
- uses: codecov/codecov-action@v1
|
- uses: codecov/codecov-action@v1
|
||||||
with:
|
with:
|
||||||
file: ./info.lcov
|
file: ./info.lcov
|
||||||
|
|
||||||
# code coverage fails with 5.4 for some reason
|
|
||||||
linux-swift-5-4:
|
|
||||||
name: linux (5.4)
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
steps:
|
|
||||||
- uses: fwal/setup-swift@v1
|
|
||||||
with:
|
|
||||||
swift-version: 5.4
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- run: swift test --parallel
|
|
||||||
|
|||||||
@@ -108,3 +108,13 @@ func defaultUrl(for searchPath: FileManager.SearchPathDirectory) -> DynamicPath
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if swift(>=5.5)
|
||||||
|
extension Pathish where Self == Path {
|
||||||
|
static var home: DynamicPath { Path.home }
|
||||||
|
static var root: DynamicPath { Path.root }
|
||||||
|
static var cwd: DynamicPath { Path.cwd }
|
||||||
|
static var documents: DynamicPath { Path.documents }
|
||||||
|
static var caches: DynamicPath { Path.caches }
|
||||||
|
static var applicationSupport: DynamicPath { Path.applicationSupport }
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import func Glibc.realpath
|
|||||||
let _realpath = Glibc.realpath
|
let _realpath = Glibc.realpath
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
public typealias PathStruct = Path
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A `Path` represents an absolute path on a filesystem.
|
A `Path` represents an absolute path on a filesystem.
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,20 @@ import func XCTest.XCTAssertEqual
|
|||||||
import Foundation
|
import Foundation
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
|
extension PathStruct {
|
||||||
|
var foo: Int { fatalError()}
|
||||||
|
}
|
||||||
|
|
||||||
class PathTests: XCTestCase {
|
class PathTests: XCTestCase {
|
||||||
|
func testNewStuff() {
|
||||||
|
#if swift(>=5.5)
|
||||||
|
func foo<P: Pathish>(_ path: P) {}
|
||||||
|
|
||||||
|
foo(.home)
|
||||||
|
foo(.root)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
func testConcatenation() {
|
func testConcatenation() {
|
||||||
XCTAssertEqual((Path.root/"bar").string, "/bar")
|
XCTAssertEqual((Path.root/"bar").string, "/bar")
|
||||||
XCTAssertEqual(Path.cwd.string, FileManager.default.currentDirectoryPath)
|
XCTAssertEqual(Path.cwd.string, FileManager.default.currentDirectoryPath)
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ extension PathTests {
|
|||||||
("testMktemp", testMktemp),
|
("testMktemp", testMktemp),
|
||||||
("testMoveInto", testMoveInto),
|
("testMoveInto", testMoveInto),
|
||||||
("testMoveTo", testMoveTo),
|
("testMoveTo", testMoveTo),
|
||||||
|
("testNewStuff", testNewStuff),
|
||||||
("testNoUndesiredSymlinkResolution", testNoUndesiredSymlinkResolution),
|
("testNoUndesiredSymlinkResolution", testNoUndesiredSymlinkResolution),
|
||||||
("testOptionalInitializer", testOptionalInitializer),
|
("testOptionalInitializer", testOptionalInitializer),
|
||||||
("testParent", testParent),
|
("testParent", testParent),
|
||||||
|
|||||||
Reference in New Issue
Block a user