Project template updates (#25)
* Project template updates * More changes * run swiftformat
This commit is contained in:
21
.github/dependabot.yml
vendored
Normal file
21
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
groups:
|
||||||
|
dependencies:
|
||||||
|
patterns:
|
||||||
|
- "*"
|
||||||
|
- package-ecosystem: "swift"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
open-pull-requests-limit: 6
|
||||||
|
allow:
|
||||||
|
- dependency-type: all
|
||||||
|
groups:
|
||||||
|
all-dependencies:
|
||||||
|
patterns:
|
||||||
|
- "*"
|
||||||
7
.github/workflows/api-breakage.yml
vendored
7
.github/workflows/api-breakage.yml
vendored
@@ -3,17 +3,16 @@ name: API breaking changes
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linux:
|
linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
container:
|
container:
|
||||||
image: swift:5.8
|
image: swift:5.9
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
# https://github.com/actions/checkout/issues/766
|
# https://github.com/actions/checkout/issues/766
|
||||||
|
|||||||
35
.github/workflows/ci.yml
vendored
35
.github/workflows/ci.yml
vendored
@@ -8,48 +8,21 @@ on:
|
|||||||
- '**.swift'
|
- '**.swift'
|
||||||
- '**.yml'
|
- '**.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- 2.x.x
|
|
||||||
paths:
|
|
||||||
- '**.swift'
|
|
||||||
- '**.yml'
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
macOS:
|
|
||||||
runs-on: macOS-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: SPM tests
|
|
||||||
run: swift test --enable-code-coverage
|
|
||||||
- name: Convert coverage files
|
|
||||||
run: |
|
|
||||||
xcrun llvm-cov export -format "lcov" \
|
|
||||||
.build/debug/hummingbird-mustachePackageTests.xctest/Contents/MacOs/hummingbird-mustachePackageTests \
|
|
||||||
-ignore-filename-regex="\/Tests\/" \
|
|
||||||
-ignore-filename-regex="\/Benchmarks\/" \
|
|
||||||
-instr-profile=.build/debug/codecov/default.profdata > info.lcov
|
|
||||||
- name: Upload to codecov.io
|
|
||||||
uses: codecov/codecov-action@v3
|
|
||||||
with:
|
|
||||||
file: info.lcov
|
|
||||||
linux:
|
linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
image:
|
image: ["swift:5.9", "swift:5.10", "swiftlang/swift:nightly-jammy"]
|
||||||
- 'swift:5.7'
|
|
||||||
- 'swift:5.8'
|
|
||||||
- 'swift:5.9'
|
|
||||||
- 'swiftlang/swift:nightly-5.10-jammy'
|
|
||||||
|
|
||||||
container:
|
container:
|
||||||
image: ${{ matrix.image }}
|
image: ${{ matrix.image }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
swift test --enable-code-coverage
|
swift test --enable-code-coverage
|
||||||
@@ -61,6 +34,6 @@ jobs:
|
|||||||
-ignore-filename-regex="\/Benchmarks\/" \
|
-ignore-filename-regex="\/Benchmarks\/" \
|
||||||
-instr-profile .build/debug/codecov/default.profdata > info.lcov
|
-instr-profile .build/debug/codecov/default.profdata > info.lcov
|
||||||
- name: Upload to codecov.io
|
- name: Upload to codecov.io
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v4
|
||||||
with:
|
with:
|
||||||
file: info.lcov
|
file: info.lcov
|
||||||
|
|||||||
14
.github/workflows/nightly.yml
vendored
14
.github/workflows/nightly.yml
vendored
@@ -1,20 +1,12 @@
|
|||||||
name: Swift nightly build
|
name: Swift nightly build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
|
||||||
- cron: '0 1 * * 1'
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
macOS:
|
|
||||||
runs-on: macOS-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: SPM tests
|
|
||||||
run: swift test
|
|
||||||
linux:
|
linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
image: ['nightly-focal', 'nightly-jammy', 'nightly-amazonlinux2']
|
image: ['nightly-focal', 'nightly-jammy', 'nightly-amazonlinux2']
|
||||||
@@ -23,7 +15,7 @@ jobs:
|
|||||||
image: swiftlang/swift:${{ matrix.image }}
|
image: swiftlang/swift:${{ matrix.image }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
swift test --enable-test-discovery
|
swift test
|
||||||
|
|||||||
6
.github/workflows/validate.yml
vendored
6
.github/workflows/validate.yml
vendored
@@ -2,16 +2,14 @@ name: Validity Check
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- 2.x.x
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate:
|
validate:
|
||||||
runs-on: macOS-latest
|
runs-on: macOS-latest
|
||||||
|
timeout-minutes: 15
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,3 +9,4 @@ xcuserdata/
|
|||||||
Package.resolved
|
Package.resolved
|
||||||
/public
|
/public
|
||||||
/docs
|
/docs
|
||||||
|
.benchmarkBaselines
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
# Minimum swiftformat version
|
# Minimum swiftformat version
|
||||||
--minversion 0.47.4
|
--minversion 0.51.0
|
||||||
|
|
||||||
# Swift version
|
# Swift version
|
||||||
--swiftversion 5.3
|
--swiftversion 5.9
|
||||||
|
|
||||||
# file options
|
# file options
|
||||||
--exclude .build
|
--exclude .build
|
||||||
|
|
||||||
# rules
|
# rules
|
||||||
--disable redundantReturn, extensionAccessControl
|
--disable redundantReturn, extensionAccessControl, typeSugar
|
||||||
|
|
||||||
# format options
|
# format options
|
||||||
--ifdef no-indent
|
--ifdef no-indent
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Legal
|
## Legal
|
||||||
By submitting a pull request, you represent that you have the right to license your contribution to the community, and agree by submitting the patch
|
By submitting a pull request, you represent that you have the right to license your contribution to the community, and agree by submitting the patch
|
||||||
that your contributions are licensed under the Apache 2.0 license (see [LICENSE](LICENSE.txt)).
|
that your contributions are licensed under the Apache 2.0 license (see [LICENSE](LICENSE)).
|
||||||
|
|
||||||
## Contributor Conduct
|
## Contributor Conduct
|
||||||
All contributors are expected to adhere to the project's [Code of Conduct](CODE_OF_CONDUCT.md).
|
All contributors are expected to adhere to the project's [Code of Conduct](CODE_OF_CONDUCT.md).
|
||||||
@@ -30,4 +30,4 @@ The main development branch of the repository is `main`.
|
|||||||
|
|
||||||
### Formatting
|
### Formatting
|
||||||
|
|
||||||
We use Nick Lockwood's SwiftFormat for formatting code. PRs will not be accepted if they haven't be formatted. The current version of SwiftFormat we are using is v0.48.17.
|
We use Nick Lockwood's SwiftFormat for formatting code. PRs will not be accepted if they haven't be formatted. The current version of SwiftFormat we are using is v0.51.15.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# ================================
|
# ================================
|
||||||
# Build image
|
# Build image
|
||||||
# ================================
|
# ================================
|
||||||
FROM swift:5.7 as build
|
FROM swift:5.9 as build
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
|
|||||||
@@ -63,21 +63,19 @@ struct HBMustacheContext {
|
|||||||
|
|
||||||
/// return context with indent and parameter information for invoking a partial
|
/// return context with indent and parameter information for invoking a partial
|
||||||
func withPartial(indented: String?, inheriting: [String: HBMustacheTemplate]?) -> HBMustacheContext {
|
func withPartial(indented: String?, inheriting: [String: HBMustacheTemplate]?) -> HBMustacheContext {
|
||||||
let indentation: String?
|
let indentation: String? = if let indented {
|
||||||
if let indented = indented {
|
(self.indentation ?? "") + indented
|
||||||
indentation = (self.indentation ?? "") + indented
|
|
||||||
} else {
|
} else {
|
||||||
indentation = self.indentation
|
self.indentation
|
||||||
}
|
}
|
||||||
let inherits: [String: HBMustacheTemplate]?
|
let inherits: [String: HBMustacheTemplate]? = if let inheriting {
|
||||||
if let inheriting = inheriting {
|
|
||||||
if let originalInherits = self.inherited {
|
if let originalInherits = self.inherited {
|
||||||
inherits = originalInherits.merging(inheriting) { value, _ in value }
|
originalInherits.merging(inheriting) { value, _ in value }
|
||||||
} else {
|
} else {
|
||||||
inherits = inheriting
|
inheriting
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inherits = self.inherited
|
self.inherited
|
||||||
}
|
}
|
||||||
return .init(
|
return .init(
|
||||||
stack: self.stack,
|
stack: self.stack,
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ extension HBMustacheTemplate {
|
|||||||
}
|
}
|
||||||
// if we want to run a transform and the current child can have transforms applied to it then
|
// if we want to run a transform and the current child can have transforms applied to it then
|
||||||
// run transform on the current child
|
// run transform on the current child
|
||||||
if let transform = transform {
|
if let transform {
|
||||||
if let runnable = child as? HBMustacheTransformable {
|
if let runnable = child as? HBMustacheTransformable {
|
||||||
return runnable.transform(transform)
|
return runnable.transform(transform)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import XCTest
|
|||||||
public struct AnyDecodable: Decodable {
|
public struct AnyDecodable: Decodable {
|
||||||
public let value: Any
|
public let value: Any
|
||||||
|
|
||||||
public init<T>(_ value: T) {
|
public init(_ value: some Any) {
|
||||||
self.value = value
|
self.value = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
##
|
##
|
||||||
##===----------------------------------------------------------------------===##
|
##===----------------------------------------------------------------------===##
|
||||||
|
|
||||||
SWIFT_FORMAT_VERSION=0.48.17
|
SWIFT_FORMAT_VERSION=0.51.15
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|||||||
Reference in New Issue
Block a user