Skip to content

Commit f74047f

Browse files
authored
Merge pull request #3822 from brandonpage/cleanup-github-actions
Fix Github Actions issues.
2 parents 6f49ba2 + f1e99d2 commit f74047f

File tree

6 files changed

+36
-18
lines changed

6 files changed

+36
-18
lines changed

.github/DangerFiles/StaticAnalysis.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env ruby
2+
13
require 'plist'
24

35
# Markdown table character length without any issues
@@ -6,7 +8,7 @@
68

79
files = Set[]
810
for lib in LIBS;
9-
files.merge(Dir["../../libs/#{lib}/clangReport/StaticAnalyzer/#{lib}/#{lib}/normal/**/*.plist"])
11+
files.merge(Dir["libs/#{lib}/clangReport/StaticAnalyzer/#{lib}/#{lib}/normal/**/*.plist"])
1012
end
1113
print "Found #{files.count} classes with static analysis files.\n"
1214

.github/DangerFiles/TestOrchestrator.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#!/usr/bin/env ruby
2+
3+
# Warn when there is a big PR
4+
warn("Big PR, try to keep changes smaller if you can.", sticky: true) if git.lines_of_code > 1000
5+
6+
# Redirect contributors to PR to dev.
7+
fail("Please re-submit this PR to the dev branch, we may have already fixed your issue.", sticky: true) if github.branch_for_base != "dev"
8+
19
# List of supported xcode schemes for testing
210
SCHEMES = ['SalesforceSDKCommon', 'SalesforceAnalytics', 'SalesforceSDKCore', 'SmartStore', 'MobileSync']
311

.github/DangerFiles/TestResults.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#!/usr/bin/env ruby
2+
13
xcode_summary.ignores_warnings = true
24
xcode_summary.inline_mode = true
35

4-
if File.exist?('../../test.xcresult')
5-
xcode_summary.report '../../test.xcresult'
6+
if File.exist?('test.xcresult')
7+
xcode_summary.report 'test.xcresult'
68
else
79
fail "No test results found."
810
end

.github/workflows/nightly.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
name: Nightly Tests
22

3-
on:
3+
on:
44
schedule:
55
- cron: "0 5 * * 3,5" # cron is UTC, this translates to 10 PM PST Tues and Thur.
6+
# This lets us trigger the workflow from a browser.
7+
workflow_dispatch:
68

79
jobs:
8-
ios-pr:
10+
ios-nightly:
911
strategy:
1012
fail-fast: false
1113
matrix:

.github/workflows/pr.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: Pull Request
22

33
on:
4-
# Dangerious without Member Check setup!
54
pull_request_target:
6-
branches:
7-
- dev
5+
branches: [dev, master]
86

97
jobs:
108
static-analysis:
119
runs-on: macos-15
10+
env:
11+
BUNDLE_GEMFILE: ${{ github.workspace }}/.github/DangerFiles/Gemfile
1212
steps:
1313
- name: Check Write Permission
1414
uses: octokit/request-action@v2.x
@@ -34,7 +34,7 @@ jobs:
3434
# We need a sufficient depth or Danger will occasionally run into issues checking which files were modified.
3535
fetch-depth: 100
3636
# This is dangerous without the member check
37-
ref: ${{ github.event.pull_request.head.sha }}
37+
ref: ${{ github.head_ref }}
3838
- name: Install Dependencies
3939
run: |
4040
npm install shelljs@0.8.5
@@ -45,13 +45,14 @@ jobs:
4545
run:
4646
xcodebuild analyze -workspace SalesforceMobileSDK.xcworkspace -scheme MobileSync -sdk 'iphonesimulator' \
4747
CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR=./clangReport RUN_CLANG_STATIC_ANALYZER=YES
48+
- uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: '3.3'
51+
bundler-cache: true
4852
- name: Report Static Analysis
4953
env:
5054
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51-
run: |
52-
cd .github/DangerFiles
53-
bundle update && bundle install
54-
bundle exec danger --dangerfile=StaticAnalysis.rb --danger_id=StaticAnalysis
55+
run: bundle exec danger --dangerfile=StaticAnalysis.rb --danger_id=StaticAnalysis
5556

5657
test-orchestrator:
5758
runs-on: macos-15

.github/workflows/reusable-workflow.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
on:
2-
workflow_dispatch:
32
workflow_call:
43
inputs:
54
lib:
@@ -21,12 +20,15 @@ on:
2120
jobs:
2221
test-ios:
2322
runs-on: ${{ inputs.macos }}
23+
env:
24+
BUNDLE_GEMFILE: ${{ github.workspace }}/.github/DangerFiles/Gemfile
2425
steps:
2526
- uses: actions/checkout@v4
2627
# We need a sufficient depth or Danger will occasionally run into issues
2728
# checking which files were modified.
2829
with:
2930
fetch-depth: 100
31+
ref: ${{ github.head_ref }}
3032
- name: Install Dependencies
3133
env:
3234
TEST_CREDENTIALS: ${{ secrets.TEST_CREDENTIALS }}
@@ -44,14 +46,15 @@ jobs:
4446
code-coverage: true
4547
upload-logs: always
4648
verbosity: xcbeautify
49+
- uses: ruby/setup-ruby@v1
50+
with:
51+
ruby-version: '3.3'
52+
bundler-cache: true
4753
- name: Danger Test Results
4854
if: (github.event_name == 'pull_request') && failure()
4955
env:
5056
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51-
run: |
52-
cd .github/DangerFiles
53-
bundle update && bundle install
54-
bundle exec danger --dangerfile=TestResults.rb --danger_id=${{ inputs.lib }}
57+
run: bundle exec danger --dangerfile=TestResults.rb --danger_id=${{ inputs.lib }}
5558
- uses: codecov/codecov-action@v4
5659
with:
5760
flags: ${{ inputs.lib }}

0 commit comments

Comments
 (0)