Skip to content

Commit

Permalink
Merge pull request #76 from 417-72KI/swiftlint-plugin
Browse files Browse the repository at this point in the history
add SwiftLint Plugin
  • Loading branch information
417-72KI committed Aug 28, 2024
2 parents fca4ea3 + e76531e commit c4e9ec4
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/versions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"xcode_version": "14.2",
"xcode_version": "15.4",
"swift_version": [
"5.7",
"5.8"
"5.9",
"5.10"
]
}
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
macOS:
name: macOS
needs: generate-matrix
runs-on: macOS-12
runs-on: macOS-14
env:
DEVELOPER_DIR: /Applications/Xcode_${{ fromJson(needs.generate-matrix.outputs.matrix).xcode_version }}.app/Contents/Developer
steps:
Expand All @@ -54,6 +54,11 @@ jobs:
restore-keys: |
${{ runner.os }}-swift
${{ runner.os }}-
- name: Update User Defaults
run: |
defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES
defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
- name: test
run: |
swift package clean
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ jobs:
restore-keys: |
${{ runner.os }}-swift
${{ runner.os }}-
- name: Update User Defaults
run: |
defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES
defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
- name: Build and zip
env:
DEVELOPER_DIR: /Applications/Xcode_${{ needs.generate-matrix.outputs.xcode-version }}.app/Contents/Developer
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
jobs:
resolve-package:
name: Resolve package
runs-on: macos-latest
runs-on: macos-14
steps:
- uses: actions/create-github-app-token@v1
id: app-token
Expand All @@ -30,6 +30,11 @@ jobs:
restore-keys: |
${{ runner.os }}-swift
${{ runner.os }}-
- name: Update User Defaults
run: |
defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES
defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
- name: Resolve dependencies
id: resolve
run: |
Expand Down
19 changes: 18 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// swift-tools-version:5.7
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let isDevelop = true

let package = Package(
name: "SSGH",
platforms: [.macOS(.v12)],
Expand Down Expand Up @@ -51,3 +53,18 @@ let package = Package(
],
swiftLanguageVersions: [.v5]
)

if isDevelop {
#if os(macOS)
package.dependencies.append(contentsOf: [
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", from: "0.56.2"),
])

package.targets.filter { $0.type == .regular }.forEach {
if $0.plugins == nil { $0.plugins = [] }
$0.plugins?.append(contentsOf: [
.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLintPlugins"),
])
}
#endif
}
14 changes: 11 additions & 3 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -eu
EXECUTABLE_NAME=$1
APPLICATION_INFO_FILE_NAME='ApplicationInfo.swift'
APPLICATION_INFO_FILE_PATH="$(find Sources -name "${APPLICATION_INFO_FILE_NAME}")"
PACKAGE_SWIFT_FILE_PATH='Package.swift'

if [ `git symbolic-ref --short HEAD` != 'main' ]; then
echo 'Release is enabled only in main.'
Expand All @@ -31,13 +32,20 @@ cd $(git rev-parse --show-toplevel)
# Version
TAG=$(swift run ssgh --version 2>/dev/null)
if [ "$(git tag | grep -E "^${TAG}$")" != '' ]; then
echo "\e[31mTag: '${TAG}' already exists.\e[m"
echo "\e[31mTag: '$TAG' already exists.\e[m"
exit 1
fi

# Package
sed -i '' -E "s/(let isDevelop = )true/\1false/g" "$PACKAGE_SWIFT_FILE_PATH"

# TAG
git commit -m "Bump version to ${TAG}" "${APPLICATION_INFO_FILE_PATH}"
git commit -m "Bump version to $TAG" "$APPLICATION_INFO_FILE_PATH" "$PACKAGE_SWIFT_FILE_PATH"
git push origin main

# Release
gh release create ${TAG}
gh release create "$TAG"

sed -i '' -E "s/(let isDevelop = )false/\1true/g" "$PACKAGE_SWIFT_FILE_PATH"
git commit -m "Set develop mode" "$PACKAGE_SWIFT_FILE_PATH"
git push origin main

0 comments on commit c4e9ec4

Please sign in to comment.