-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from YOCKOW/development
v3.2.0
- Loading branch information
Showing
8 changed files
with
238 additions
and
74 deletions.
There are no files selected for viewing
This file contains 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,60 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- '**' | ||
tags-ignore: | ||
- '**' | ||
paths: | ||
- '**/*.swift' | ||
- '.github/workflows/*.yml' | ||
pull_request: | ||
paths: | ||
- '**/*.swift' | ||
- '.github/workflows/*.yml' | ||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macOS-latest | ||
swift-compat-ver: | ||
- '5' | ||
# - '4.2' | ||
# - '4' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use a cache for ".build" directory. | ||
uses: actions/cache@v1 | ||
with: | ||
path: .build | ||
key: build-${{ github.workspace }}-${{ runner.os }}-${{ matrix.swift-compat-ver }}-${{ hashFiles('**/*.swift') }} | ||
restore-keys: | | ||
build-${{ github.workspace }}-${{ runner.os }}-${{ matrix.swift-compat-ver }}- | ||
build-${{ github.workspace }}-${{ runner.os }}- | ||
build-${{ github.workspace }}- | ||
- uses: YOCKOW/Action-setup-swift@master | ||
with: | ||
swift-version: '5.2.2' | ||
- name: Try to build products with debug mode. | ||
run: | | ||
swift build --configuration debug -Xswiftc -swift-version -Xswiftc ${{ matrix.swift-compat-ver }} | ||
if [ $? != 0 ]; then | ||
echo "Failed to build products with debug mode." | ||
rm -rf $(cd .build/debug && pwd -P) | ||
fi | ||
continue-on-error: true | ||
- name: Test with debug mode. | ||
run: swift test --configuration debug -Xswiftc -swift-version -Xswiftc ${{ matrix.swift-compat-ver }} | ||
- name: Try to build products with release mode. | ||
run: | | ||
swift build --configuration release -Xswiftc -enable-testing -Xswiftc -swift-version -Xswiftc ${{ matrix.swift-compat-ver }} | ||
if [ $? != 0 ]; then | ||
echo "Failed to build products with release mode." | ||
rm -rf $(cd .build/release && pwd -P) | ||
fi | ||
continue-on-error: true | ||
- name: Test with release mode. | ||
run: swift test --configuration release -Xswiftc -enable-testing -Xswiftc -swift-version -Xswiftc ${{ matrix.swift-compat-ver }} |
This file contains 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
.DS_Store | ||
|
||
.build/ | ||
.build | ||
build/ | ||
y-build/ | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains 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 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,45 @@ | ||
/* ************************************************************************************************* | ||
Date+TimeSpecification.swift | ||
© 2020 YOCKOW. | ||
Licensed under MIT License. | ||
See "LICENSE.txt" for more information. | ||
************************************************************************************************ */ | ||
|
||
import Foundation | ||
|
||
extension TimeSpecification { | ||
@inlinable | ||
public var timeIntervalValue: TimeInterval { | ||
return TimeInterval(self.doubleValue) | ||
} | ||
} | ||
|
||
extension Date { | ||
/// Creates a date value initialized relative to the current date and time | ||
/// by a given number of nanoseconds. | ||
@inlinable | ||
public init(timeIntervalSinceNow: TimeSpecification) { | ||
self.init(timeIntervalSinceNow: timeIntervalSinceNow.timeIntervalValue) | ||
} | ||
|
||
/// Creates a date value initialized relative to another given date | ||
/// by a given number of nanoseconds. | ||
@inlinable | ||
public init(timeInterval: TimeSpecification, since date: Date) { | ||
self.init(timeInterval: timeInterval.timeIntervalValue, since: date) | ||
} | ||
|
||
/// Creates a date value initialized relative to 00:00:00 UTC on 1 January 2001 | ||
/// by a given number of nanoseconds. | ||
@inlinable | ||
public init(timeIntervalSinceReferenceDate: TimeSpecification) { | ||
self.init(timeIntervalSinceReferenceDate: timeIntervalSinceReferenceDate.timeIntervalValue) | ||
} | ||
|
||
/// Creates a date value initialized relative to 00:00:00 UTC on 1 January 1970 | ||
/// by a given number of nanoseconds. | ||
@inlinable | ||
public init(timeIntervalSince1970: TimeSpecification) { | ||
self.init(timeIntervalSince1970: timeIntervalSince1970.timeIntervalValue) | ||
} | ||
} |
This file contains 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
Oops, something went wrong.