Add initial CI workflow for code style conformance (#2)

Added a GitHub workflow to check for code style, copyrights, imports.
This commit is contained in:
Andrew Heard authored and GitHub committed 2023-08-16 10:16:19 -04:00
1 parent 2d12673670
commit 33cc784685
5 files changed
+140

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
BasedOnStyle: Google
ColumnLimit: 100
BinPackParameters: false
AllowAllParametersOfDeclarationOnNextLine: true
ObjCSpaceBeforeProtocolList: true
SpacesInContainerLiterals: true
PointerAlignment: Right
AllowShortFunctionsOnASingleLine: None
IncludeBlocks: Preserve
+56
View File
@@ -0,0 +1,56 @@
name: check
on:
pull_request:
paths:
- '.github/workflows/check.yml'
push:
branches: main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: macos-latest
env:
MINT_PATH: ${{ github.workspace }}/mint
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: 3.6
- name: Cache Mint packages
uses: actions/cache@v3
with:
path: ${{ env.MINT_PATH }}
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
restore-keys: ${{ runner.os }}-mint-
- name: Setup Scripts Directory
run: ./setup-scripts.sh
- name: Setup check
run: |
brew update
brew install clang-format@16
brew install mint
mint bootstrap
- name: Style
run: scripts/style.sh test-only
- name: Whitespace
run: scripts/check_whitespace.sh
- name: Filename spaces
run: scripts/check_filename_spaces.sh
- name: Copyrights
run: scripts/check_copyright.sh
- name: Imports
run: scripts/check_imports.swift
+50
View File
@@ -0,0 +1,50 @@
# macOS
.DS_Store
# Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
*.xccheckout
profile
*.moved-aside
DerivedData
*.hmap
*.ipa
# Swift Package Manager
.build
Package.resolved
# Mint package manager
Mint
# Vim
*.swo
*.swp
*~
# Bundler
/.bundle
/vendor
# CocoaPods
Pods/
Podfile.lock
*.xcworkspace
# CocoaPods generate
gen/
# firebase-ios-sdk clone
firebase-ios-sdk/
# scripts link
scripts
+1
View File
@@ -0,0 +1 @@
nicklockwood/SwiftFormat@0.51.12
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
# Copyright 2021 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
git clone \
--depth 1 \
--no-checkout \
https://github.com/firebase/firebase-ios-sdk.git \
;
cd firebase-ios-sdk
git checkout master -- scripts
cd ..
ln -s firebase-ios-sdk/scripts scripts
gem install xcpretty