Run SwiftFormat (non-lenient) separately on CI. (#167)

Make the lenient run into a post build step.
This commit is contained in:
Doug 2022-08-30 16:45:40 +01:00 committed by GitHub
parent 39be67cec6
commit 7c37d2f143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 37 deletions

View File

@ -36,6 +36,10 @@ jobs:
run: run:
brew update && brew bundle && brew upgrade swiftformat brew update && brew bundle && brew upgrade swiftformat
- name: SwiftFormat
run:
swiftformat --lint .
- name: Bundle install - name: Bundle install
run: | run: |
bundle config path vendor/bundle bundle config path vendor/bundle

View File

@ -1768,11 +1768,11 @@
buildConfigurationList = B15427F8699AD5A5FC75C17E /* Build configuration list for PBXNativeTarget "ElementX" */; buildConfigurationList = B15427F8699AD5A5FC75C17E /* Build configuration list for PBXNativeTarget "ElementX" */;
buildPhases = ( buildPhases = (
A7130911BCB2DF3D249A1836 /* 🛠 SwiftGen */, A7130911BCB2DF3D249A1836 /* 🛠 SwiftGen */,
B35AB66424BB30087EEE408C /* 🧹 SwiftFormat */,
9797D588420FCBBC228A63C9 /* Sources */, 9797D588420FCBBC228A63C9 /* Sources */,
215E1D91B98672C856F559D0 /* Resources */, 215E1D91B98672C856F559D0 /* Resources */,
EE878EAA342710DB973E0A87 /* Frameworks */, EE878EAA342710DB973E0A87 /* Frameworks */,
98CA896D84BFD53B2554E891 /* ⚠️ SwiftLint */, 98CA896D84BFD53B2554E891 /* ⚠️ SwiftLint */,
B35AB66424BB30087EEE408C /* 🧹 SwiftFormat */,
); );
buildRules = ( buildRules = (
); );
@ -2073,7 +2073,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which swiftformat >/dev/null; then\n if [ $CONFIGURATION = \"Debug\" ]; then \n swiftformat --lint --lenient \"$PROJECT_DIR\"\n else \n swiftformat --lint \"$PROJECT_DIR\"\n fi\nelse\n echo \"warning: SwiftFormat not installed, download from https://github.com/nicklockwood/SwiftFormat\"\nfi\n"; shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which swiftformat >/dev/null; then\n swiftformat --lint --lenient \"$PROJECT_DIR\"\nelse\n echo \"warning: SwiftFormat not installed, download from https://github.com/nicklockwood/SwiftFormat\"\nfi\n";
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */

View File

@ -115,16 +115,6 @@
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"> debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D3DB351B7FBE0F49649171FC"
BuildableName = "IntegrationTests.xctest"
BlueprintName = "IntegrationTests"
ReferencedContainer = "container:ElementX.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments> <CommandLineArguments>
</CommandLineArguments> </CommandLineArguments>
<EnvironmentVariables> <EnvironmentVariables>
@ -144,6 +134,15 @@
isEnabled = "YES"> isEnabled = "YES">
</EnvironmentVariable> </EnvironmentVariable>
</EnvironmentVariables> </EnvironmentVariables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D3DB351B7FBE0F49649171FC"
BuildableName = "IntegrationTests.xctest"
BlueprintName = "IntegrationTests"
ReferencedContainer = "container:ElementX.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction> </ProfileAction>
<AnalyzeAction <AnalyzeAction
buildConfiguration = "Debug"> buildConfiguration = "Debug">

View File

@ -77,8 +77,9 @@
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"> debugDocumentVersioning = "YES">
<BuildableProductRunnable <CommandLineArguments>
runnableDebuggingMode = "0"> </CommandLineArguments>
<MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "0E28CD62691FDBC63147D5E3" BlueprintIdentifier = "0E28CD62691FDBC63147D5E3"
@ -86,9 +87,7 @@
BlueprintName = "UITests" BlueprintName = "UITests"
ReferencedContainer = "container:ElementX.xcodeproj"> ReferencedContainer = "container:ElementX.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
</ProfileAction> </ProfileAction>
<AnalyzeAction <AnalyzeAction
buildConfiguration = "Debug"> buildConfiguration = "Debug">

View File

@ -99,8 +99,9 @@
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"> debugDocumentVersioning = "YES">
<BuildableProductRunnable <CommandLineArguments>
runnableDebuggingMode = "0"> </CommandLineArguments>
<MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "32C23C8D224D46EFE62AFAD0" BlueprintIdentifier = "32C23C8D224D46EFE62AFAD0"
@ -108,9 +109,7 @@
BlueprintName = "UnitTests" BlueprintName = "UnitTests"
ReferencedContainer = "container:ElementX.xcodeproj"> ReferencedContainer = "container:ElementX.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </MacroExpansion>
<CommandLineArguments>
</CommandLineArguments>
</ProfileAction> </ProfileAction>
<AnalyzeAction <AnalyzeAction
buildConfiguration = "Debug"> buildConfiguration = "Debug">

View File

@ -70,21 +70,6 @@ targets:
echo "warning: SwiftGen not installed, download from https://github.com/SwiftGen/SwiftGen" echo "warning: SwiftGen not installed, download from https://github.com/SwiftGen/SwiftGen"
fi fi
- name: 🧹 SwiftFormat
runOnlyWhenInstalling: false
shell: /bin/sh
script: |
export PATH="$PATH:/opt/homebrew/bin"
if which swiftformat >/dev/null; then
if [ $CONFIGURATION = "Debug" ]; then
swiftformat --lint --lenient "$PROJECT_DIR"
else
swiftformat --lint "$PROJECT_DIR"
fi
else
echo "warning: SwiftFormat not installed, download from https://github.com/nicklockwood/SwiftFormat"
fi
postBuildScripts: postBuildScripts:
- name: ⚠️ SwiftLint - name: ⚠️ SwiftLint
runOnlyWhenInstalling: false runOnlyWhenInstalling: false
@ -96,6 +81,16 @@ targets:
else else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint" echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi fi
- name: 🧹 SwiftFormat
runOnlyWhenInstalling: false
shell: /bin/sh
script: |
export PATH="$PATH:/opt/homebrew/bin"
if which swiftformat >/dev/null; then
swiftformat --lint --lenient "$PROJECT_DIR"
else
echo "warning: SwiftFormat not installed, download from https://github.com/nicklockwood/SwiftFormat"
fi
dependencies: dependencies:
- package: MatrixRustSDK - package: MatrixRustSDK

1
changelog.d/pr-167.build Normal file
View File

@ -0,0 +1 @@
Run SwiftFormat as a post-build script locally, with an additional pre-build step on CI.