Skip to content

Commit 7e64cf9

Browse files
authored
Merge pull request #306 from brandonpage/cleanup-ci-w22712082
Update nightly schedule to Tue/Thu at 9:30 PM PT and fix security issues
2 parents 8ae7302 + 99687ef commit 7e64cf9

4 files changed

Lines changed: 82 additions & 19 deletions

File tree

.github/workflows/nightly.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ name: Nightly Tests
22

33
on:
44
schedule:
5-
- cron: "0 5 * * 4" # cron is UTC, this translates to 10 PM PST Wednesday.
5+
- cron: "30 5 * * 3,5" # cron is UTC; 9:30 PM PT Tue/Thu.
66
# This lets us trigger the workflow from a browser.
77
workflow_dispatch:
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
ios-nightly:
1114
strategy:
@@ -23,7 +26,12 @@ jobs:
2326
lib: ${{ matrix.lib }}
2427
ios: ${{ matrix.ios }}
2528
xcode: ${{ matrix.xcode }}
26-
secrets: inherit
29+
permissions:
30+
contents: read
31+
pull-requests: write
32+
secrets:
33+
TEST_CREDENTIALS: ${{ secrets.TEST_CREDENTIALS }}
34+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2735

2836
hybrid-samples-nightly:
2937
strategy:
@@ -41,4 +49,5 @@ jobs:
4149
app: ${{ matrix.app }}
4250
ios: ${{ matrix.ios }}
4351
xcode: ${{ matrix.xcode }}
44-
secrets: inherit
52+
permissions:
53+
contents: read

.github/workflows/pr.yaml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
name: Pull Request
22

33
on:
4-
pull_request_target:
4+
# pull_request_target is required for fork PRs to receive secrets.
5+
# Mitigated by per-job Member Check (see "Check Write Permission" / "Validate Write Permission").
6+
pull_request_target: # zizmor: ignore[dangerous-triggers]
57
branches: [dev, master]
68

9+
permissions:
10+
contents: read
11+
712
jobs:
813
static-analysis:
914
runs-on: macos-latest
15+
permissions:
16+
contents: read
17+
pull-requests: write
1018
env:
1119
BUNDLE_GEMFILE: ${{ github.workspace }}/.github/DangerFiles/Gemfile
1220
steps:
1321
- name: Check Write Permission
14-
uses: octokit/request-action@v2.x
22+
uses: octokit/request-action@dad4362715b7fb2ddedf9772c8670824af564f0d # v2.4.0
1523
id: check_permissions
1624
with:
1725
route: GET /repos/${{ github.repository }}/collaborators/${{ github.triggering_actor }}/permission
@@ -29,8 +37,9 @@ jobs:
2937
exit 1
3038
fi
3139
- name: Checkout
32-
uses: actions/checkout@v4
40+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
3341
with:
42+
persist-credentials: false
3443
# We need a sufficient depth or Danger will occasionally run into issues checking which files were modified.
3544
fetch-depth: 100
3645
# This is dangerous without the member check
@@ -43,7 +52,7 @@ jobs:
4352
run:
4453
xcodebuild analyze -workspace SalesforceMobileSDK-Hybrid.xcworkspace -scheme MobileSync -sdk 'iphonesimulator' \
4554
CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR=./clangReport RUN_CLANG_STATIC_ANALYZER=YES
46-
- uses: ruby/setup-ruby@v1
55+
- uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
4756
with:
4857
ruby-version: '3.3'
4958
bundler-cache: true
@@ -64,7 +73,12 @@ jobs:
6473
lib: ${{ matrix.lib }}
6574
ios: ${{ matrix.ios }}
6675
is_pr: true
67-
secrets: inherit
76+
permissions:
77+
contents: read
78+
pull-requests: write
79+
secrets:
80+
TEST_CREDENTIALS: ${{ secrets.TEST_CREDENTIALS }}
81+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6882

6983
hybrid-samples-pr:
7084
needs: [static-analysis]
@@ -76,4 +90,5 @@ jobs:
7690
with:
7791
app: ${{ matrix.app }}
7892
is_pr: true
79-
secrets: inherit
93+
permissions:
94+
contents: read

.github/workflows/reusable-build-workflow.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,30 @@ on:
2020
type: boolean
2121
default: false
2222

23+
permissions:
24+
contents: read
25+
2326
jobs:
2427
build-ios:
2528
runs-on: ${{ inputs.macos }}
2629
steps:
27-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2831
if: ${{ inputs.is_pr }}
2932
with:
33+
persist-credentials: false
3034
ref: ${{ github.event.pull_request.head.sha }}
31-
- uses: actions/checkout@v4
35+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
3236
if: ${{ ! inputs.is_pr }}
3337
with:
38+
persist-credentials: false
3439
ref: ${{ github.head_ref }}
3540
- name: Install Dependencies
3641
run: ./install.sh
3742
- name: Install iOS 17 runtime if needed
3843
if: ${{ inputs.ios == '^17' }}
3944
run: xcodes runtimes install "iOS 17.5"
40-
- uses: mxcl/xcodebuild@v3
45+
- uses: mxcl/xcodebuild@d3ee9b419c1be9a988086c58fe0988f32d99cfc5 # v3.6.0
46+
id: build
4147
with:
4248
xcode: ${{ inputs.xcode }}
4349
platform: iOS
@@ -46,3 +52,13 @@ jobs:
4652
scheme: ${{ inputs.app }}
4753
action: build
4854
verbosity: xcbeautify
55+
- name: Archive build logs on failure
56+
if: failure() && steps.build.outcome == 'failure'
57+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
58+
with:
59+
name: xcode-build-logs-${{ inputs.app }}-ios${{ inputs.ios }}
60+
path: |
61+
~/Library/Developer/Xcode/DerivedData/**/Logs/Build/*.xcactivitylog
62+
~/Library/Logs/DiagnosticReports/**
63+
if-no-files-found: ignore
64+
retention-days: 14

.github/workflows/reusable-test-workflow.yaml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,37 @@ on:
1919
is_pr:
2020
type: boolean
2121
default: false
22+
secrets:
23+
TEST_CREDENTIALS:
24+
required: true
25+
CODECOV_TOKEN:
26+
required: true
27+
28+
permissions:
29+
contents: read
30+
pull-requests: write
2231

2332
jobs:
2433
test-ios:
2534
runs-on: ${{ inputs.macos }}
2635
steps:
27-
- uses: actions/checkout@v4
36+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2837
if: ${{ inputs.is_pr }}
2938
with:
39+
persist-credentials: false
3040
ref: ${{ github.event.pull_request.head.sha }}
31-
- uses: actions/checkout@v4
41+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
3242
if: ${{ ! inputs.is_pr }}
3343
with:
44+
persist-credentials: false
3445
ref: ${{ github.head_ref }}
3546
- name: Install Dependencies
3647
env:
3748
TEST_CREDENTIALS: ${{ secrets.TEST_CREDENTIALS }}
3849
run: |
3950
./install.sh
4051
echo $TEST_CREDENTIALS > ./shared/test/test_credentials.json
41-
- uses: mxcl/xcodebuild@v3
52+
- uses: mxcl/xcodebuild@d3ee9b419c1be9a988086c58fe0988f32d99cfc5 # v3.6.0
4253
id: xcodebuild
4354
with:
4455
xcode: ${{ inputs.xcode }}
@@ -49,13 +60,25 @@ jobs:
4960
action: test
5061
code-coverage: true
5162
verbosity: xcbeautify
63+
- name: Archive xcodebuild logs on build failure
64+
if: failure() && steps.xcodebuild.outcome == 'failure'
65+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
66+
with:
67+
name: xcodebuild-logs-${{ inputs.lib }}-ios${{ inputs.ios }}
68+
path: |
69+
~/Library/Developer/Xcode/DerivedData/**/Logs/Build/*.xcactivitylog
70+
if-no-files-found: ignore
71+
retention-days: 14
5272
- name: Parse test results
5373
if: success() || failure()
74+
env:
75+
LIB: ${{ inputs.lib }}
76+
IOS: ${{ inputs.ios }}
5477
run: |
5578
brew install xcresultparser
56-
xcresultparser -o junit test.xcresult > test-results-${{ inputs.lib }}-ios${{ inputs.ios }}.xml
79+
xcresultparser -o junit test.xcresult > "test-results-${LIB}-ios${IOS}.xml"
5780
- name: Test Report
58-
uses: mikepenz/action-junit-report@v6
81+
uses: mikepenz/action-junit-report@3a81627bfac62268172037048872e8ebd4207e6d # v6.4.1
5982
if: success() || failure()
6083
with:
6184
check_name: ${{ inputs.lib }} iOS ${{ inputs.ios }} Test Results
@@ -67,15 +90,15 @@ jobs:
6790
comment: true
6891
job_summary: ${{ steps.xcodebuild.outcome == 'failure' }}
6992
report_paths: 'test-results-${{ inputs.lib }}-ios${{ inputs.ios }}.xml'
70-
- uses: codecov/codecov-action@v4
93+
- uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
7194
if: success() || failure()
7295
with:
7396
flags: ${{ inputs.lib }}
7497
env:
7598
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
7699
- name: Upload test results artifact
77100
if: success() || failure()
78-
uses: actions/upload-artifact@v4
101+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
79102
with:
80103
name: test-results-${{ inputs.lib }}-ios${{ inputs.ios }}
81104
path: test-results-${{ inputs.lib }}-ios${{ inputs.ios }}.xml

0 commit comments

Comments
 (0)