Skip to content

Commit

Permalink
Add SwiftLint Analyse to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
winebarrel committed Nov 4, 2024
1 parent 0c0b3ef commit d689ccc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
uses: actions/checkout@v4
- name: Switch Xcode
run: sudo xcode-select -s /Applications/Xcode_16.app
- name: Install SwiftLint
env:
SWIFTLINT_VERSION: 0.57.0
run: |
curl -sSfLO https://github.com/realm/SwiftLint/releases/download/${SWIFTLINT_VERSION}/portable_swiftlint.zip
unzip portable_swiftlint.zip swiftlint
- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
Expand Down Expand Up @@ -63,4 +69,7 @@ jobs:
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-
- name: Build and Analyse
run: |
xcodebuild build analyze -scheme PagerCall -destination 'generic/platform=macOS' -allowProvisioningUpdates
xcodebuild build analyze -scheme PagerCall -destination 'generic/platform=macOS' -allowProvisioningUpdates -configuration Debug | tee build.log
- name: SwiftLint Analyse
run: |
./swiftlint analyze --compiler-log-path build.log
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ playground.xcworkspace

.build/
build/
build.log

# CocoaPods
#
Expand Down
3 changes: 3 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
disabled_rules:
- line_length
- nesting
analyzer_rules:
- unused_declaration
- unused_import
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
BUILD_DIR = ./build
APP_NAME = PagerCall
ARCHIVE_PATH = $(BUILD_DIR)/$(APP_NAME).xcarchive
BUILD_DIR = ./build
APP_NAME = PagerCall
ARCHIVE_PATH = $(BUILD_DIR)/$(APP_NAME).xcarchive
CONFIGURATION = Release
BUILD_LOG = ./build.log

.PHONY: build
build: clean
xcodebuild build analyze archive \
-destination "generic/platform=macOS" \
-scheme $(APP_NAME) \
-configuration Release \
-archivePath $(ARCHIVE_PATH)
-configuration $(CONFIGURATION) \
-archivePath $(ARCHIVE_PATH) \
| tee $(BUILD_LOG)

.PHONY: swiftlint-analyze
swiftlint-analyze:
$(MAKE) build CONFIGURATION=Debug
swiftlint analyze --compiler-log-path $(BUILD_LOG)

.PHONY: clean
clean:
Expand Down

0 comments on commit d689ccc

Please sign in to comment.