From f1c82f8b4e3d8f6b9b74fc69ceb7690e9b35f3ef Mon Sep 17 00:00:00 2001 From: Andrew Roan Date: Tue, 13 Feb 2024 15:02:23 -0600 Subject: [PATCH 1/4] Add CI workflow feature/initial-release --- .github/workflows/ci.yml | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..85a4574 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: ci + +on: + push: + branches: + - main + pull_request: + branches: + - '*' + workflow_dispatch: + +jobs: + lint: + runs-on: macos-13 + environment: default + steps: + - uses: actions/checkout@v3 + - name: SwiftFormat version + run: swiftformat --version + - name: Format lint + run: swiftformat --lint . + - name: SwiftLint version + run: swiftlint --version + - name: Lint + run: swiftlint lint --quiet + macos-test: + runs-on: macos-13 + environment: default + strategy: + matrix: + xcode: ['14.3.1', '15.2'] + # Swift: 5.8.1 , 5.9.2 + steps: + - uses: actions/checkout@v3 + - name: Select Xcode ${{ matrix.xcode }} + run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app + - name: Run Tests + run: swift test --enable-code-coverage --parallel + - name: Swift Coverage Report + run: xcrun llvm-cov export -format="lcov" .build/debug/secret-swiftPackageTests.xctest/Contents/MacOS/secret-swiftPackageTests -instr-profile .build/debug/codecov/default.profdata > coverage_report.lcov + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true # optional (default = false) + linux-test: + runs-on: ubuntu-latest + environment: default + + steps: + - uses: actions/checkout@v3 + - name: Run Tests + run: swift test --parallel From 5d65651c17f052425444250b10c4ae7ad978b16b Mon Sep 17 00:00:00 2001 From: Andrew Roan Date: Tue, 13 Feb 2024 15:12:09 -0600 Subject: [PATCH 2/4] Update action runners to macos-14 feature/initial-release --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85a4574..a2cfede 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: jobs: lint: - runs-on: macos-13 + runs-on: macos-14 environment: default steps: - uses: actions/checkout@v3 @@ -24,7 +24,7 @@ jobs: - name: Lint run: swiftlint lint --quiet macos-test: - runs-on: macos-13 + runs-on: macos-14 environment: default strategy: matrix: From b54893350ec950ae6b6d02d5ad48c6237a770b0e Mon Sep 17 00:00:00 2001 From: Andrew Roan Date: Tue, 13 Feb 2024 15:23:22 -0600 Subject: [PATCH 3/4] Try installing swiftlint from homebrew in lint job feature/initial-release --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2cfede..151f6ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,8 @@ jobs: run: swiftformat --version - name: Format lint run: swiftformat --lint . + - name: Install SwiftLint + run: brew install swiftlint - name: SwiftLint version run: swiftlint --version - name: Lint From 7f6862a7c24c517690bbbcb88eb1ecccb6ba0146 Mon Sep 17 00:00:00 2001 From: Andrew Roan Date: Tue, 13 Feb 2024 16:46:08 -0600 Subject: [PATCH 4/4] Add properyWrapper compliant initializers feature/initial-release --- Sources/Secret/Hashed.swift | 5 +++++ Sources/Secret/Redacted.swift | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Sources/Secret/Hashed.swift b/Sources/Secret/Hashed.swift index bf7dd40..8721999 100644 --- a/Sources/Secret/Hashed.swift +++ b/Sources/Secret/Hashed.swift @@ -18,6 +18,11 @@ public struct Hashed: Hashable where T: Hashable { /// Enabled by default, when encoding, replace the ``wrappedValue`` with its hash. public let obscureEncoding: Bool + public init(wrappedValue: T, obscureEncoding: Bool = true) { + self.wrappedValue = wrappedValue + self.obscureEncoding = obscureEncoding + } + public init(_ wrappedValue: T, obscureEncoding: Bool = true) { self.wrappedValue = wrappedValue self.obscureEncoding = obscureEncoding diff --git a/Sources/Secret/Redacted.swift b/Sources/Secret/Redacted.swift index a752582..368e2dc 100644 --- a/Sources/Secret/Redacted.swift +++ b/Sources/Secret/Redacted.swift @@ -18,6 +18,11 @@ public struct Redacted { /// Enabled by default, when encoding, replace the ``wrappedValue`` with "REDACTED". public let obscureEncoding: Bool + public init(wrappedValue: T, obscureEncoding: Bool = true) { + self.wrappedValue = wrappedValue + self.obscureEncoding = obscureEncoding + } + public init(_ wrappedValue: T, obscureEncoding: Bool = true) { self.wrappedValue = wrappedValue self.obscureEncoding = obscureEncoding