Skip to content

Commit 12809c2

Browse files
authored
Merge pull request #1 from MFB-Technologies-Inc/feature/prepare-for-release
Feature/prepare for release
2 parents e94f38d + d2d6799 commit 12809c2

28 files changed

+1969
-64
lines changed

.devcontainer/devcontainer.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "swift-argument-encoding",
3+
"image": "swift:5.7",
4+
"features": {
5+
"ghcr.io/devcontainers/features/common-utils:2": {
6+
"installZsh": "false",
7+
"username": "vscode",
8+
"userUid": "1000",
9+
"userGid": "1000",
10+
"upgradePackages": "false"
11+
},
12+
"ghcr.io/devcontainers/features/git:1": {
13+
"version": "os-provided",
14+
"ppa": "false"
15+
}
16+
},
17+
"runArgs": [
18+
"--cap-add=SYS_PTRACE",
19+
"--security-opt",
20+
"seccomp=unconfined"
21+
],
22+
// Configure tool-specific properties.
23+
"customizations": {
24+
// Configure properties specific to VS Code.
25+
"vscode": {
26+
// Set *default* container specific settings.json values on container create.
27+
"settings": {
28+
"lldb.library": "/usr/lib/liblldb.so"
29+
},
30+
// Add the IDs of extensions you want installed when the container is created.
31+
"extensions": [
32+
"sswg.swift-lang"
33+
]
34+
}
35+
},
36+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
37+
// "forwardPorts": [],
38+
39+
// Use 'postCreateCommand' to run commands after the container is created.
40+
"postCreateCommand": "swift --version",
41+
42+
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
43+
"remoteUser": "vscode"
44+
}

.github/workflows/lint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- '*'
10+
workflow_dispatch:
11+
12+
jobs:
13+
library:
14+
runs-on: macos-12
15+
environment: default
16+
strategy:
17+
matrix:
18+
xcode: ['14.2']
19+
# Swift: 5.7
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Format lint
23+
run: swiftformat --lint .
24+
- name: Lint
25+
run: swiftlint .

.github/workflows/linux-test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- '*'
10+
workflow_dispatch:
11+
12+
jobs:
13+
library:
14+
runs-on: ${{ matrix.os }}
15+
environment: default
16+
strategy:
17+
matrix:
18+
os: [ubuntu2004, ubuntu2204]
19+
steps:
20+
- name: Run Tests
21+
run: swift test --enable-code-coverage --parallel

.github/workflows/macos-test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- '*'
10+
workflow_dispatch:
11+
12+
jobs:
13+
library:
14+
runs-on: macos-12
15+
environment: default
16+
strategy:
17+
matrix:
18+
xcode: ['14.2']
19+
# Swift: 5.7
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Select Xcode ${{ matrix.xcode }}
23+
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
24+
- name: Run Tests
25+
run: swift test --enable-code-coverage --parallel
26+
- name: Swift Coverage Report
27+
run: xcrun llvm-cov export -format="lcov" .build/debug/swift-argument-encodingPackageTests.xctest/Contents/MacOS/swift-argument-encodingPackageTests -instr-profile .build/debug/codecov/default.profdata > coverage_report.lcov
28+
- uses: codecov/codecov-action@v3
29+
with:
30+
fail_ci_if_error: true # optional (default = false)

Examples/Package.resolved

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Examples/Package.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// swift-tools-version: 5.7
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "swift-argument-encoding-examples",
7+
platforms: [.macOS(.v12)],
8+
products: [
9+
.executable(name: "SwiftCommand", targets: ["SwiftCommand"]),
10+
],
11+
dependencies: [
12+
.argumentEncoding,
13+
],
14+
targets: [
15+
.executableTarget(
16+
name: "SwiftCommand",
17+
dependencies: [
18+
.argumentEncoding,
19+
]
20+
),
21+
]
22+
)
23+
24+
// MARK: Local
25+
26+
extension Package.Dependency {
27+
static let argumentEncoding: Package.Dependency = .package(name: "swift-argument-encoding", path: "../")
28+
}
29+
30+
extension Target.Dependency {
31+
static let argumentEncoding: Self = .product(name: "ArgumentEncoding", package: "swift-argument-encoding")
32+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RunCommand.swift
2+
// ArgumentEncoding
3+
//
4+
// Copyright © 2023 MFB Technologies, Inc. All rights reserved.
5+
6+
import ArgumentEncoding
7+
8+
struct RunCommand: CommandRepresentable {
9+
let flagFormatter: FlagFormatter = .doubleDashPrefixKebabCase
10+
let optionFormatter: OptionFormatter = .doubleDashPrefixKebabCase
11+
12+
let executable: Command
13+
}
14+
15+
extension RunCommand: ExpressibleByStringLiteral {
16+
init(stringLiteral value: StringLiteralType) {
17+
self.init(executable: Command(rawValue: value))
18+
}
19+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SwiftCommand.swift
2+
// ArgumentEncoding
3+
//
4+
// Copyright © 2023 MFB Technologies, Inc. All rights reserved.
5+
6+
import ArgumentEncoding
7+
8+
enum SwiftCommand: TopLevelCommandRepresentable {
9+
func commandValue() -> Command { "swift" }
10+
11+
var flagFormatter: FlagFormatter { .doubleDashPrefixKebabCase }
12+
var optionFormatter: OptionFormatter { .doubleDashPrefixKebabCase }
13+
14+
case run(RunCommand)
15+
case test(TestCommand)
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// TestCommand.swift
2+
// ArgumentEncoding
3+
//
4+
// Copyright © 2023 MFB Technologies, Inc. All rights reserved.
5+
6+
import ArgumentEncoding
7+
8+
struct TestCommand: CommandRepresentable {
9+
let flagFormatter: FlagFormatter = .doubleDashPrefixKebabCase
10+
let optionFormatter: OptionFormatter = .doubleDashPrefixKebabCase
11+
12+
@Flag var parallel: Bool = true
13+
@Option var numWorkers: Int = 1
14+
@Flag var showCodecovPath: Bool = false
15+
var testProducts: [Command]
16+
}
17+
18+
extension [Command]: ArgumentGroup {}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// main.swift
2+
// ArgumentEncoding
3+
//
4+
// Copyright © 2023 MFB Technologies, Inc. All rights reserved.
5+
6+
let test = SwiftCommand.test(TestCommand(
7+
parallel: true,
8+
numWorkers: 4,
9+
showCodecovPath: true,
10+
testProducts: ["swiftlint"]
11+
))
12+
let run = SwiftCommand.run("swiftlint")
13+
print("""
14+
SwiftCommand.test(TestCommand(
15+
parallel: true,
16+
numWorkers: 4,
17+
showCodecovPath: true,
18+
testProducts: ["swiftlint"]
19+
))
20+
21+
\(test.arguments())
22+
23+
-------------------------------
24+
25+
SwiftCommand.run("swiftlint")
26+
27+
\(run.arguments())
28+
""")

0 commit comments

Comments
 (0)