-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add format, lint, Makefile, and publish from CI (#6)
- Loading branch information
Showing
8 changed files
with
189 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,27 @@ name: CI | |
on: | ||
push: | ||
branches: [main] | ||
tags: ["v*"] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
lfs: true | ||
|
||
- run: make lint-ci | ||
- run: make format-ci | ||
|
||
build: | ||
runs-on: macos-14 | ||
permissions: | ||
# https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions | ||
id-token: write | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
|
@@ -26,6 +41,9 @@ jobs: | |
key: v0-${{ runner.os }}-swiftpm-${{ hashFiles('**/Package.resolved') }} | ||
restore-keys: v0-${{ runner.os }}-swiftpm- | ||
|
||
- run: npm run build | ||
- run: npm publish --provenance --access public --dry-run | ||
|
||
- run: file build/Release/PreviewExtension.appex/Contents/MacOS/* | ||
- run: npm publish --provenance --access public | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--swiftversion 5.2 | ||
--indent 2 | ||
--maxwidth 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
strict: true | ||
|
||
excluded: | ||
- .build | ||
- .swiftpm-packages | ||
|
||
disabled_rules: | ||
- function_body_length | ||
- type_body_length | ||
- file_length | ||
- cyclomatic_complexity | ||
- opening_brace # handled by swiftformat | ||
|
||
trailing_comma: | ||
mandatory_comma: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.PHONY: build | ||
build: | ||
# https://developer.apple.com/documentation/xcode/building-swift-packages-or-apps-that-use-them-in-continuous-integration-workflows | ||
# https://stackoverflow.com/questions/4969932/separate-build-directory-using-xcodebuild | ||
xcodebuild \ | ||
-disableAutomaticPackageResolution \ | ||
-clonedSourcePackagesDirPath .swiftpm-packages \ | ||
-destination generic/platform=macOS \ | ||
-scheme PreviewExtension \ | ||
SYMROOT=$(PWD)/build \ | ||
-configuration Release \ | ||
clean build | ||
lipo build/Release/PreviewExtension.appex/Contents/MacOS/PreviewExtension -verify_arch arm64 x86_64 | ||
rm -rf dist | ||
mkdir -p dist | ||
cp -R build/Release/PreviewExtension.appex dist/ | ||
cp PreviewExtension/PreviewExtension.entitlements dist/ | ||
|
||
.PHONY: lint-ci | ||
lint-ci: | ||
docker run -t --rm -v $(PWD):/work -w /work ghcr.io/realm/swiftlint:0.53.0 | ||
|
||
.PHONY: format-ci | ||
format-ci: | ||
docker run -t --rm -v $(PWD):/work ghcr.io/nicklockwood/swiftformat:0.53.7 --lint /work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.