Skip to content

Commit

Permalink
Add lint CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Feb 20, 2024
1 parent 2e51857 commit 2859841
Show file tree
Hide file tree
Showing 15 changed files with 8,682 additions and 163 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build Android

on:
push:
branches:
- main
paths:
- '.github/workflows/build-android.yml'
- 'package/cpp/**'
- 'package/android/**'
- 'package/example/android/**'
- 'package/yarn.lock'
- 'package/example/yarn.lock'
pull_request:
paths:
- '.github/workflows/build-android.yml'
- 'package/cpp/**'
- 'package/android/**'
- 'package/example/android/**'
- 'package/yarn.lock'
- 'package/example/yarn.lock'

jobs:
build:
name: Build Android Example App
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./package
steps:
- uses: actions/checkout@v4

- name: Setup JDK 11
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
java-package: jdk

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd example

- name: Restore Gradle cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Gradle Build for example/android/
run: cd example/android && ./gradlew assembleDebug --build-cache && cd ../..
- name: Upload .apk to GitHub
uses: actions/upload-artifact@v4
with:
name: Example App (.apk)
path: package/example/android/app/build/outputs/apk/debug/app-debug.apk
if-no-files-found: error
77 changes: 77 additions & 0 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build iOS

on:
push:
branches:
- main
paths:
- '.github/workflows/build-ios.yml'
- 'package/cpp/**'
- 'package/ios/**'
- 'package/*.podspec'
- 'package/example/ios/**'
pull_request:
paths:
- '.github/workflows/build-ios.yml'
- 'package/cpp/**'
- 'package/ios/**'
- 'package/*.podspec'
- 'package/example/ios/**'

jobs:
build:
name: Build iOS Example App
runs-on: macOS-latest
defaults:
run:
working-directory: package/example/ios
steps:
- uses: actions/checkout@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd ..

- name: Restore buildcache
uses: mikehardy/buildcache-action@v2
continue-on-error: true

- name: Setup Ruby (bundle)
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.10
bundler-cache: true
working-directory: package/example/ios

- name: Restore Pods cache
uses: actions/cache@v4
with:
path: package/example/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Pods
run: bundle exec pod install
- name: Install xcpretty
run: gem install xcpretty
- name: Build App
run: "set -o pipefail && xcodebuild \
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
-derivedDataPath build -UseModernBuildSystem=YES \
-workspace FilamentExample.xcworkspace \
-scheme FilamentExample \
-sdk iphonesimulator \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 11 Pro' \
build \
CODE_SIGNING_ALLOWED=NO | xcpretty"
154 changes: 0 additions & 154 deletions .github/workflows/ci.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/validate-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Validate C++

on:
push:
branches:
- main
paths:
- '.github/workflows/validate-cpp.yml'
- 'package/cpp/**'
- 'package/android/src/main/cpp/**'
- 'package/ios/**'
pull_request:
paths:
- '.github/workflows/validate-cpp.yml'
- 'package/cpp/**'
- 'package/android/src/main/cpp/**'
- 'package/ios/**'

jobs:
lint:
name: Check clang-format
runs-on: ubuntu-latest
strategy:
matrix:
path:
- 'package/cpp'
- 'package/android/src/main/cpp'
- 'package/ios'
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check
uses: mrousavy/clang-format-action@v1
with:
clang-format-version: '16'
check-path: ${{ matrix.path }}
clang-format-style-path: package/cpp/.clang-format

Loading

0 comments on commit 2859841

Please sign in to comment.