Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run lint & build in CI #6

Merged
merged 7 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

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

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true

- run: make lint-ci
- run: make format-ci

build:
needs:
- lint
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true

- uses: actions/cache@v3
with:
path: |
.swiftpm-packages
key: v0-${{ runner.os }}-swiftpm-${{ hashFiles('**/Package.resolved') }}
restore-keys: v0-${{ runner.os }}-swiftpm-

- run: make build
4 changes: 4 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--swiftversion 5.7
--indent 2
--maxwidth 120
--exclude WebSocketDemo-Shared/Schemas/foxglove
15 changes: 15 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
excluded:
- .build
- .swiftpm-packages
- WebSocketDemo-Shared/Schemas/foxglove

disabled_rules:
- function_body_length
- type_body_length
- file_length
- cyclomatic_complexity
- identifier_name
- opening_brace # conflicts with swiftformat

trailing_comma:
mandatory_comma: true
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.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
# https://forums.swift.org/t/swiftpm-with-git-lfs/42396/4
GIT_LFS_SKIP_DOWNLOAD_ERRORS=1 \
xcodebuild \
-disableAutomaticPackageResolution \
-clonedSourcePackagesDirPath .swiftpm-packages \
-destination generic/platform=iOS \
-scheme "Foxglove Bridge" \
SYMROOT="$(PWD)"/build \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
-configuration Release \
clean build analyze

.PHONY: lint-ci
lint-ci:
docker run -t --platform linux/amd64 --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.52.8 --lint /work
Loading