Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
henrik-dmg committed Jan 23, 2024
0 parents commit 57013b3
Show file tree
Hide file tree
Showing 28 changed files with 1,503 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deployment

on:
release:
types: [created]

jobs:
distribute_binaries:
runs-on: macos-13
strategy:
matrix:
platform: [arm64, x86_64]
steps:
- name: Configure Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Checkout Code
uses: actions/checkout@v3
- name: Compile ${{ matrix.platform }} Binary
run: |
swift build -c release --arch ${{ matrix.platform }}
zip -j file-organiser-${{ matrix.platform }}.zip .build/${{ matrix.platform }}-apple-macosx/release/file-organiser
- name: Upload ${{ matrix.platform }} Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: file-organiser-${{ matrix.platform }}.zip
asset_name: file-organiser-${{ matrix.platform }}.zip
asset_content_type: application/zip
72 changes: 72 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Swift

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test-swift:
name: Test Swift Code
runs-on: macos-13
steps:
- name: Configure Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Checkout Code
uses: actions/checkout@v3
- name: Build
run: swift build -v
- name: Run tests
run: swift test -v

lint-code:
name: Lint Swift Code
runs-on: macos-13
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/checkout@v3
- name: Install SwiftLint
run: brew install swift-format peripheryapp/periphery/periphery
- name: Lint code
run: Scripts/lint-swift-code
- name: Scan for dead code
run: periphery scan --strict

deploy-pages:
name: Deploy Documentation to GitHub Pages
runs-on: macos-13
if: github.event_name != 'pull_request'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
needs:
- test-swift
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Build DocC
run: |
swift package \
--allow-writing-to-directory "$RUNNER_TEMP/docs" \
generate-documentation \
--target FileOrganiserKit \
--transform-for-static-hosting \
--hosting-base-path FileOrganiserKit \
--output-path "$RUNNER_TEMP/docs"
- name: Fix Root Path
run: echo "<script>window.location.href += \"documentation/fileorganiserkit\"</script>" > "$RUNNER_TEMP/docs/index.html"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ runner.temp }}/docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
.swiftpm
5 changes: 5 additions & 0 deletions .periphery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
targets:
- FileOrganiser
- FileOrganiserKit
- FileOrganiserKitTests
enable_unused_import_analysis: true
67 changes: 67 additions & 0 deletions .swift-format.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"fileScopedDeclarationPrivacy": {
"accessLevel": "private"
},
"indentation": {
"spaces": 4
},
"indentConditionalCompilationBlocks": true,
"indentSwitchCaseLabels": false,
"lineBreakAroundMultilineExpressionChainComponents": true,
"lineBreakBeforeControlFlowKeywords": false,
"lineBreakBeforeEachArgument": true,
"lineBreakBeforeEachGenericRequirement": true,
"lineLength": 140,
"maximumBlankLines": 1,
"multiElementCollectionTrailingCommas": true,
"noAssignmentInExpressions": {
"allowedFunctions": ["XCTAssertNoThrow"]
},
"prioritizeKeepingFunctionOutputTogether": false,
"respectsExistingLineBreaks": true,
"rules": {
"AllPublicDeclarationsHaveDocumentation": false,
"AlwaysUseLiteralForEmptyCollectionInit": true,
"AlwaysUseLowerCamelCase": true,
"AmbiguousTrailingClosureOverload": true,
"BeginDocumentationCommentWithOneLineSummary": false,
"DoNotUseSemicolons": true,
"DontRepeatTypeInStaticProperties": true,
"FileScopedDeclarationPrivacy": true,
"FullyIndirectEnum": true,
"GroupNumericLiterals": true,
"IdentifiersMustBeASCII": true,
"NeverForceUnwrap": true,
"NeverUseForceTry": true,
"NeverUseImplicitlyUnwrappedOptionals": true,
"NoAccessLevelOnExtensionDeclaration": true,
"NoAssignmentInExpressions": true,
"NoBlockComments": true,
"NoCasesWithOnlyFallthrough": true,
"NoEmptyTrailingClosureParentheses": true,
"NoLabelsInCasePatterns": true,
"NoLeadingUnderscores": true,
"NoParensAroundConditions": true,
"NoPlaygroundLiterals": true,
"NoVoidReturnOnFunctionSignature": true,
"OmitExplicitReturns": true,
"OneCasePerLine": true,
"OneVariableDeclarationPerLine": true,
"OnlyOneTrailingClosureArgument": true,
"OrderedImports": true,
"ReplaceForEachWithForLoop": true,
"ReturnVoidInsteadOfEmptyTuple": true,
"TypeNamesShouldBeCapitalized": true,
"UseEarlyExits": false,
"UseLetInEveryBoundCaseVariable": true,
"UseShorthandTypeNames": true,
"UseSingleLinePropertyGetter": true,
"UseSynthesizedInitializer": true,
"UseTripleSlashForDocumentationComments": true,
"UseWhereClausesInForLoops": false,
"ValidateDocumentationComments": true
},
"spacesAroundRangeFormationOperators": true,
"tabWidth": 4,
"version": 1
}
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Henrik Panhans

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
50 changes: 50 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"pins" : [
{
"identity" : "clifoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/henrik-dmg/CLIFoundation",
"state" : {
"branch" : "main",
"revision" : "2b3c42960cb11d38bb91497a2b5606ae530b1f8f"
}
},
{
"identity" : "globpattern",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/GlobPattern",
"state" : {
"branch" : "main",
"revision" : "c7c3d7864b24543343d7cac9a27fab4ad17410a2"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"state" : {
"revision" : "c8ed701b513cf5177118a175d85fbbbcd707ab41",
"version" : "1.3.0"
}
},
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-plugin",
"state" : {
"revision" : "26ac5758409154cc448d7ab82389c520fa8a8247",
"version" : "1.3.0"
}
},
{
"identity" : "swift-docc-symbolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-symbolkit",
"state" : {
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
}
],
"version" : 2
}
52 changes: 52 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// swift-tools-version:5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "FileOrganiser",
platforms: [
.macOS(.v10_15)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.executable(
name: "file-organiser",
targets: ["FileOrganiser"]
),
.library(
name: "FileOrganiserKit",
targets: ["FileOrganiserKit"]
),
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"),
.package(url: "https://github.com/henrik-dmg/CLIFoundation", branch: "main"),
.package(url: "https://github.com/ChimeHQ/GlobPattern", branch: "main"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.1.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "FileOrganiserKit",
dependencies: [
"CLIFoundation",
"GlobPattern",
]
),
.testTarget(
name: "FileOrganiserKitTests",
dependencies: [
"FileOrganiserKit"
]
),
.executableTarget(
name: "FileOrganiser",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
"FileOrganiserKit",
]
),
]
)
Loading

0 comments on commit 57013b3

Please sign in to comment.