diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 195ad908a0..2b52e673fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI -on: +on: push: branches: - main @@ -13,6 +13,18 @@ on: - vnext-prototype jobs: + validation: + runs-on: macos-10.15 + strategy: + fail-fast: true + steps: + - uses: actions/checkout@v2 + - name: Switch to current version of Xcode + run: scripts/xcode_select_current_version.sh + - name: pod lib lint + run: scripts/podliblint.sh + - name: validation + run: scripts/validation.sh xcodebuild: runs-on: macos-10.15 strategy: @@ -35,9 +47,5 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Switch to current version of Xcode - run: scripts/xcode_select_current_version.sh - name: scripts/xcodebuild_wrapper.sh ${{ matrix.build_command }} run: scripts/xcodebuild_wrapper.sh ${{ matrix.build_command }} - - name: pod lib lint - run: scripts/podliblint.sh \ No newline at end of file diff --git a/.swiftlint.yml b/.swiftlint.yml index a12f29e3ae..639a5a9ee8 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -99,7 +99,9 @@ whitelist_rules: - redundant_string_enum_value # Properties, variables, and constants should not have redundant type annotation - - redundant_type_annotation + # This rule is currently disabled because it invokes false warnings for Bool + # Github issue tracked on swift lint https://github.com/realm/SwiftLint/issues/3578 + # - redundant_type_annotation # Returning Void in a function declaration is redundant. - redundant_void_return @@ -166,9 +168,13 @@ whitelist_rules: included: # paths to include during linting. `--path` is ignored if present. - ${LINTPATH} + - ios + - macos excluded: # paths to ignore during linting. Takes precedence over `included`. - Pods + - tools + explicit_type_interface: # requires type annotation on everything but local variables and constants excluded: - local diff --git a/scripts/validation.sh b/scripts/validation.sh new file mode 100755 index 0000000000..433c3f86e2 --- /dev/null +++ b/scripts/validation.sh @@ -0,0 +1,7 @@ +# A simple script to validate project settings. + +if which swiftlint >/dev/null; then + swiftlint --config --strict .swiftlint.yml +else + echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint" +fi