Skip to content

Commit a7ed544

Browse files
author
Lukas Pistrol
authored
Merge pull request #3 from lukepistrol/feat/add-docs-generation
[Chore]: Add workflows for `swiftlint`, `test`, and `build-documentation`
2 parents 351d004 + 53060c6 commit a7ed544

File tree

10 files changed

+167
-10
lines changed

10 files changed

+167
-10
lines changed

.github/scripts/tests.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
ARCH=""
4+
5+
if [ $1 = "arm" ]
6+
then
7+
ARCH="arm64"
8+
else
9+
ARCH="x86_64"
10+
fi
11+
12+
echo "Building with arch: ${ARCH}"
13+
14+
export LC_CTYPE=en_US.UTF-8
15+
16+
set -o pipefail && arch -"${ARCH}" xcodebuild \
17+
-scheme CodeEditKit \
18+
-derivedDataPath ".build" \
19+
-destination "platform=macos,arch=${ARCH}" \
20+
clean test | xcpretty
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: build-documentation
2+
on:
3+
push:
4+
branches:
5+
- 'main'
6+
paths:
7+
- 'Sources/**'
8+
jobs:
9+
build-docc:
10+
runs-on: macos-12
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v1
14+
- uses: actions/cache@v3
15+
with:
16+
path: '.build'
17+
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
18+
restore-keys: |
19+
${{ runner.os }}-spm-
20+
- uses: fwcd/[email protected]
21+
with:
22+
target: CodeEditKit
23+
output: ./docs
24+
hosting-base-path: CodeEditKit
25+
disable-indexing: 'true'
26+
transform-for-static-hosting: 'true'
27+
- name: Init new repo in dist folder and commit generated files
28+
run: |
29+
cd docs
30+
git init
31+
git add -A
32+
git config --local user.email "[email protected]"
33+
git config --local user.name "GitHub Action"
34+
git commit -m 'deploy'
35+
36+
- name: Force push to destination branch
37+
uses: ad-m/[email protected]
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
branch: docs
41+
force: true
42+
directory: ./docs

.github/workflows/swiftlint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: SwiftLint
2+
on:
3+
push:
4+
branches:
5+
- 'main'
6+
paths:
7+
- '.github/workflows/swiftlint.yml'
8+
- '.swiftlint.yml'
9+
- '**/*.swift'
10+
pull_request:
11+
branches:
12+
- 'main'
13+
paths:
14+
- '.github/workflows/swiftlint.yml'
15+
- '.swiftlint.yml'
16+
- '**/*.swift'
17+
jobs:
18+
SwiftLint:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v1
22+
- name: GitHub Action for SwiftLint with --strict
23+
uses: norio-nomura/[email protected]
24+
with:
25+
args: --strict

.github/workflows/tests.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: tests
2+
on:
3+
push:
4+
branches:
5+
- 'main'
6+
paths:
7+
- 'Sources/**'
8+
- 'Tests/**'
9+
pull_request:
10+
branches:
11+
- 'main'
12+
jobs:
13+
code-edit-text-view-tests:
14+
name: Testing CodeEditTextView
15+
runs-on: macos-12
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v1
19+
- uses: actions/cache@v3
20+
with:
21+
path: '.build'
22+
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
23+
restore-keys: |
24+
${{ runner.os }}-spm-
25+
- name: Make executeable
26+
run: chmod +x ./.github/scripts/tests.sh
27+
- name: Testing Package
28+
run: exec ./.github/scripts/tests.sh

.swiftlint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
disabled_rules:
2+
- todo
3+
- trailing_comma
4+
- nesting
5+
6+
type_name:
7+
excluded:
8+
- ID
9+
10+
identifier_name:
11+
min_length: 2
12+
allowed_symbols: ['_']
13+
excluded:
14+
- c
15+
- id
16+
- vc

Package.resolved

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

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ let package = Package(
1313
targets: ["CodeEditKit"]),
1414
],
1515
dependencies: [
16+
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
1617
// Dependencies declare other packages that this package depends on.
1718
// .package(url: /* package url */, from: "1.0.0"),
1819
],
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ``CodeEditKit``
2+
3+
CodeEditKit is a dynamic library which is shared between CodeEdit and it's extensions. It allows them to communicate with and understand one another.
4+
5+
## Overview
6+
7+
This is still work in progress.

Sources/CodeEditKit/Targets/Target.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ public struct Target: Identifiable {
1717
* - Parameter executable: The executable to launch inside the pseudo terminal
1818
* - Parameter args: an array of strings that is passed as the arguments to the underlying process
1919
* - Parameter environment: an array of environment variables to pass to the child process.
20-
* - Parameter execName: If provided, this is used as the Unix argv[0] parameter, otherwise, the executable is used as the args [0], this is used when the intent is to set a different process name than the file that backs it.
20+
* - Parameter execName: If provided, this is used as the Unix argv[0] parameter, otherwise,
21+
* the executable is used as the args [0], this is used when the intent is to set a different process name
22+
* than the file that backs it.
2123
*/
2224
public init(id: String, displayName: String,
2325
executable: String, args: [String] = [],
@@ -30,21 +32,23 @@ public struct Target: Identifiable {
3032
self.execName = execName
3133
}
3234

33-
/// ``id`` is a unique identifier of the target set by the extension
35+
/// `id` is a unique identifier of the target set by the extension
3436
public var id: String
3537

36-
/// ``displayName`` is a name to be displayed in the UI to represent target
38+
/// `displayName` is a name to be displayed in the UI to represent target
3739
public var displayName: String
3840

39-
/// ``executable`` is the executable to launch inside the pseudo terminal
41+
/// `executable` is the executable to launch inside the pseudo terminal
4042
public var executable: String
4143

42-
/// ``args`` is an array of strings that is passed as the arguments to the underlying process
44+
/// `args` is an array of strings that is passed as the arguments to the underlying process
4345
public var args: [String] = []
4446

45-
/// ``environment`` is an array of environment variables to pass to the child process.
47+
/// `environment` is an array of environment variables to pass to the child process.
4648
public var environment: [String]?
4749

48-
/// ``execName`` If provided, this is used as the Unix argv[0] parameter, otherwise, the executable is used as the args [0], this is used when the intent is to set a different process name than the file that backs it.
50+
/// `execName` If provided, this is used as the Unix argv[0] parameter, otherwise,
51+
/// the executable is used as the args [0], this is used when the intent is to set a different
52+
/// process name than the file that backs it.
4953
public var execName: String?
5054
}

Tests/CodeEditKitTests/CEExtensionKitTests.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import XCTest
33

44
final class CEExtensionKitTests: XCTestCase {
55
func testExample() throws {
6-
// This is an example of a functional test case.
7-
// Use XCTAssert and related functions to verify your tests produce the correct
8-
// results.
6+
XCTAssertTrue(true)
97
}
108
}

0 commit comments

Comments
 (0)