From 35cdef61b2c90d5bd7ce2a8159839c403d4ea5e6 Mon Sep 17 00:00:00 2001 From: Kunal Balani Date: Mon, 22 Mar 2021 16:14:24 -0700 Subject: [PATCH 1/5] Adding swiftLint as a build step in CI --- .github/workflows/ci.yml | 6 ++++-- .swiftlint.yml | 8 +++++++- scripts/validation.sh | 7 +++++++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 scripts/validation.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 195ad908a0..7fd9fb5e92 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI -on: +on: push: branches: - main @@ -40,4 +40,6 @@ jobs: - 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 + run: scripts/podliblint.sh + - name: validation + run: scripts/validation.sh 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 100644 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 From 3721e2a45bc39216f95dc62dc05c7a4a6c940877 Mon Sep 17 00:00:00 2001 From: Kunal Balani Date: Mon, 22 Mar 2021 16:41:01 -0700 Subject: [PATCH 2/5] update permissions --- scripts/validation.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/validation.sh diff --git a/scripts/validation.sh b/scripts/validation.sh old mode 100644 new mode 100755 From 96cde2f23a55b6d524714cbc9107270920065717 Mon Sep 17 00:00:00 2001 From: Kunal Balani Date: Thu, 25 Mar 2021 12:20:11 -0700 Subject: [PATCH 3/5] Execute validation serially --- .github/workflows/ci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fd9fb5e92..ead1fc71f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,15 @@ on: - vnext-prototype jobs: + validation: + runs-on: macos-10.15 + strategy: + fail-fast: true + steps: + - name: pod lib lint + run: scripts/podliblint.sh + - name: validation + run: scripts/validation.sh xcodebuild: runs-on: macos-10.15 strategy: @@ -39,7 +48,3 @@ jobs: 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 - - name: validation - run: scripts/validation.sh From 21b6945d259ab86a6b63b491f1c07fac993e3a2e Mon Sep 17 00:00:00 2001 From: Kunal Balani Date: Thu, 25 Mar 2021 12:28:37 -0700 Subject: [PATCH 4/5] WIP --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ead1fc71f3..7098de75e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,9 @@ jobs: 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 From 7c90a952f84b7cf53e0fa5efe342d1ff580ff998 Mon Sep 17 00:00:00 2001 From: Kunal Balani Date: Tue, 30 Mar 2021 11:02:19 -0700 Subject: [PATCH 5/5] Check if env variables are shared across jobs --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7098de75e4..2b52e673fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +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 }}