-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test-orchestrator so unit tests start before static analysis is f…
…inished. Move danger files into their own folder. Add CodeCov. Fix static analysis reporting.
- Loading branch information
1 parent
c9ace33
commit 623204d
Showing
9 changed files
with
69 additions
and
166 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# List of supported xcode schemes for testing | ||
SCHEMES = ['SalesforceSDKCommon', 'SalesforceAnalytics', 'SalesforceSDKCore', 'SmartStore', 'MobileSync'] | ||
|
||
modifed_libs = Set[] | ||
for file in (git.modified_files + git.added_files); | ||
scheme = file.split("libs/").last.split("/").first | ||
print "lib: #{scheme}\n" | ||
if scheme == '.github' | ||
# If CI files are modified, run all tests | ||
modifed_libs.merge(SCHEMES) | ||
elsif SCHEMES.include?(scheme) | ||
modifed_libs.add(scheme) | ||
end | ||
end | ||
|
||
# Set Github Job output so we know which tests to run | ||
json_libs = modifed_libs.map { |l| "'#{l}'"}.join(", ") | ||
`echo "libs=[#{json_libs}]" >> $GITHUB_OUTPUT` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
xcode_summary.ignores_warnings = true | ||
xcode_summary.inline_mode = true | ||
xcode_summary.report '../../test.xcresult' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,6 @@ on: | |
jobs: | ||
static-analysis: | ||
runs-on: macos-latest | ||
outputs: | ||
libs: ${{ steps.danger.outputs.libs }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
@@ -19,24 +17,43 @@ jobs: | |
run: | | ||
npm install [email protected] | ||
./install.sh | ||
- name: Static Analysis and Danger | ||
if: ${{ github.event_name == 'pull_request' }} && (success() || failure()) | ||
id: danger | ||
- name: Run Static Analysis | ||
# It would be nice to use xcbeaufity here but all the warnings and errors get annotated onto the PR, including | ||
# files not mofified in the PR which is annoying. | ||
run: xcodebuild analyze -workspace SalesforceMobileSDK.xcworkspace -scheme MobileSync -sdk 'iphonesimulator' \ | ||
CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR=./clangReport RUN_CLANG_STATIC_ANALYZER=YES | ||
- name: Report Static Analysis | ||
env: | ||
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
cd .github/DangerFiles | ||
bundle update && bundle install | ||
bundle exec danger --dangerfile=StaticAnalysis.rb --danger_id=StaticAnalysis | ||
test-orchestrator: | ||
runs-on: macos-latest | ||
outputs: | ||
libs: ${{ steps.test-orchestrator.outputs.libs }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 100 | ||
- name: Determine Tests to Run | ||
id: test-orchestrator | ||
env: | ||
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
xcodebuild analyze -workspace SalesforceMobileSDK.xcworkspace -scheme MobileSync -sdk 'iphonesimulator' \ | ||
CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR=./clangReport RUN_CLANG_STATIC_ANALYZER=YES | xcbeautify | ||
cd .github | ||
cd .github/DangerFiles | ||
bundle update && bundle install | ||
bundle exec danger --dangerfile=DangerStaticAnalysis.rb | ||
bundle exec danger --dangerfile=TestOrchestrator.rb | ||
ios-pr: | ||
needs: [static-analysis] | ||
needs: [test-orchestrator] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
lib: ${{ fromJson(needs.static-analysis.outputs.libs) }} | ||
lib: ${{ fromJson(needs.test-orchestrator.outputs.libs) }} | ||
uses: ./.github/workflows/reusable-workflow.yaml | ||
with: | ||
lib: ${{ matrix.lib }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
inputs: | ||
lib: | ||
|
@@ -21,10 +22,12 @@ jobs: | |
with: | ||
fetch-depth: 100 | ||
- name: Install Dependencies | ||
env: | ||
TEST_CREDENTIALS: ${{ secrets.TEST_CREDENTIALS }} | ||
run: | | ||
npm install [email protected] | ||
./install.sh | ||
echo ${{ secrets.TEST_CREDENTIALS }} > ./shared/test/test_credentials.json | ||
echo $TEST_CREDENTIALS > ./shared/test/test_credentials.json | ||
- uses: mxcl/xcodebuild@v3 | ||
with: | ||
xcode: ${{ inputs.xcode }} | ||
|
@@ -35,10 +38,16 @@ jobs: | |
code-coverage: ${{ github.event_name == 'pull_request' }} | ||
upload-logs: always | ||
- name: Danger Test Results | ||
if: ${{ github.event_name == 'pull_request' }} && (success() || failure()) | ||
if: (github.event_name == 'pull_request') && failure() | ||
env: | ||
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
cd .github | ||
cd .github/DangerFiles | ||
bundle update && bundle install | ||
bundle exec danger --dangerfile=DangerTestResults.rb --danger_id=${{ inputs.lib }} | ||
bundle exec danger --dangerfile=TestResults.rb --danger_id=${{ inputs.lib }} | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
flags: ${{ inputs.lib }} | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
if: success() || failure() |