Project template updates (#25)

* Project template updates

* More changes

* run swiftformat
This commit is contained in:
Adam Fowler
2024-03-08 12:04:49 +00:00
committed by GitHub
parent f5177888f9
commit f029081b61
13 changed files with 50 additions and 68 deletions

21
.github/dependabot.yml vendored Normal file
View 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:
- "*"

View File

@@ -3,17 +3,16 @@ name: API breaking changes
on:
pull_request:
branches:
- main
jobs:
linux:
runs-on: ubuntu-latest
timeout-minutes: 15
container:
image: swift:5.8
image: swift:5.9
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
# https://github.com/actions/checkout/issues/766

View File

@@ -8,48 +8,21 @@ on:
- '**.swift'
- '**.yml'
pull_request:
branches:
- main
- 2.x.x
paths:
- '**.swift'
- '**.yml'
workflow_dispatch:
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:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
image:
- 'swift:5.7'
- 'swift:5.8'
- 'swift:5.9'
- 'swiftlang/swift:nightly-5.10-jammy'
image: ["swift:5.9", "swift:5.10", "swiftlang/swift:nightly-jammy"]
container:
image: ${{ matrix.image }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Test
run: |
swift test --enable-code-coverage
@@ -61,6 +34,6 @@ jobs:
-ignore-filename-regex="\/Benchmarks\/" \
-instr-profile .build/debug/codecov/default.profdata > info.lcov
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: info.lcov

View File

@@ -1,20 +1,12 @@
name: Swift nightly build
on:
schedule:
- cron: '0 1 * * 1'
workflow_dispatch:
jobs:
macOS:
runs-on: macOS-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: SPM tests
run: swift test
linux:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
image: ['nightly-focal', 'nightly-jammy', 'nightly-amazonlinux2']
@@ -23,7 +15,7 @@ jobs:
image: swiftlang/swift:${{ matrix.image }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Test
run: |
swift test --enable-test-discovery
swift test

View File

@@ -2,16 +2,14 @@ name: Validity Check
on:
pull_request:
branches:
- main
- 2.x.x
jobs:
validate:
runs-on: macOS-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Dependencies

1
.gitignore vendored
View File

@@ -9,3 +9,4 @@ xcuserdata/
Package.resolved
/public
/docs
.benchmarkBaselines

View File

@@ -1,14 +1,14 @@
# Minimum swiftformat version
--minversion 0.47.4
--minversion 0.51.0
# Swift version
--swiftversion 5.3
--swiftversion 5.9
# file options
--exclude .build
# rules
--disable redundantReturn, extensionAccessControl
--disable redundantReturn, extensionAccessControl, typeSugar
# format options
--ifdef no-indent

View File

@@ -2,7 +2,7 @@
## 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
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
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
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.

View File

@@ -1,7 +1,7 @@
# ================================
# Build image
# ================================
FROM swift:5.7 as build
FROM swift:5.9 as build
WORKDIR /build

View File

@@ -63,21 +63,19 @@ struct HBMustacheContext {
/// return context with indent and parameter information for invoking a partial
func withPartial(indented: String?, inheriting: [String: HBMustacheTemplate]?) -> HBMustacheContext {
let indentation: String?
if let indented = indented {
indentation = (self.indentation ?? "") + indented
let indentation: String? = if let indented {
(self.indentation ?? "") + indented
} else {
indentation = self.indentation
self.indentation
}
let inherits: [String: HBMustacheTemplate]?
if let inheriting = inheriting {
let inherits: [String: HBMustacheTemplate]? = if let inheriting {
if let originalInherits = self.inherited {
inherits = originalInherits.merging(inheriting) { value, _ in value }
originalInherits.merging(inheriting) { value, _ in value }
} else {
inherits = inheriting
inheriting
}
} else {
inherits = self.inherited
self.inherited
}
return .init(
stack: self.stack,

View File

@@ -182,7 +182,7 @@ extension HBMustacheTemplate {
}
// if we want to run a transform and the current child can have transforms applied to it then
// run transform on the current child
if let transform = transform {
if let transform {
if let runnable = child as? HBMustacheTransformable {
return runnable.transform(transform)
}

View File

@@ -22,7 +22,7 @@ import XCTest
public struct AnyDecodable: Decodable {
public let value: Any
public init<T>(_ value: T) {
public init(_ value: some Any) {
self.value = value
}
}

View File

@@ -13,7 +13,7 @@
##
##===----------------------------------------------------------------------===##
SWIFT_FORMAT_VERSION=0.48.17
SWIFT_FORMAT_VERSION=0.51.15
set -eu
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"