Skip to content

Commit af750cf

Browse files
authored
ci: Optimize CI workflow performance (#1724)
1 parent 1b4b86e commit af750cf

File tree

5 files changed

+87
-194
lines changed

5 files changed

+87
-194
lines changed

.github/workflows/ci.yml

Lines changed: 71 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -1,213 +1,114 @@
1+
---
12
name: ci
23
on:
34
push:
4-
branches: [ master ]
5+
branches:
6+
- master
57
pull_request:
6-
branches: [ '**' ]
8+
branches:
9+
- "**"
710
env:
8-
CI_XCODE_11: '/Applications/Xcode_11.7.app/Contents/Developer'
9-
CI_XCODE_13: '/Applications/Xcode_13.4.1.app/Contents/Developer'
10-
11+
CI_XCODE_11: /Applications/Xcode_11.7.app/Contents/Developer
12+
CI_XCODE_14: /Applications/Xcode_14.2.app/Contents/Developer
1113
jobs:
12-
ios:
13-
runs-on: macos-12
14-
steps:
15-
- uses: actions/checkout@v2
16-
- name: Setup Ruby
17-
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
18-
- name: Cache Gems
19-
id: cache-gems
20-
uses: actions/cache@v2
21-
with:
22-
path: vendor/bundle
23-
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
24-
restore-keys: |
25-
${{ runner.os }}-gem-
26-
- name: Submodules and Bundle Install
27-
run: |
28-
git submodule update --init --recursive
29-
sudo gem install bundler
30-
bundle config set path 'vendor/bundle'
31-
bundle install
32-
- name: Build-Test
33-
run: set -o pipefail && env NSUnbufferedIO=YES bundle exec rake test:ios
34-
env:
35-
DEVELOPER_DIR: ${{ env.CI_XCODE_13 }}
36-
- name: Send codecov
37-
run: bash <(curl https://codecov.io/bash)
38-
39-
macos:
40-
runs-on: macos-latest
41-
steps:
42-
- uses: actions/checkout@v2
43-
- name: Setup Ruby
44-
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
45-
- name: Cache Gems
46-
id: cache-gems
47-
uses: actions/cache@v2
48-
with:
49-
path: vendor/bundle
50-
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
51-
restore-keys: |
52-
${{ runner.os }}-gem-
53-
- name: Submodules and Bundle Install
54-
run: |
55-
git submodule update --init --recursive
56-
sudo gem install bundler
57-
bundle config set path 'vendor/bundle'
58-
bundle install
59-
- name: Create and set the default keychain
60-
run: |
61-
security create-keychain -p "" temporary
62-
security default-keychain -s temporary
63-
security unlock-keychain -p "" temporary
64-
security set-keychain-settings -lut 7200 temporary
65-
- name: Build-Test
66-
run: set -o pipefail && env NSUnbufferedIO=YES bundle exec rake test:macos
67-
env:
68-
DEVELOPER_DIR: ${{ env.CI_XCODE_13 }}
69-
- name: Send codecov
70-
run: bash <(curl https://codecov.io/bash)
71-
72-
facebook_utils:
73-
needs: parseui
74-
runs-on: macos-latest
75-
env:
76-
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77-
steps:
78-
- uses: actions/checkout@v2
79-
- name: Setup Ruby
80-
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
81-
- name: Cache Gems
82-
id: cache-gems
83-
uses: actions/cache@v2
84-
with:
85-
path: vendor/bundle
86-
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
87-
restore-keys: |
88-
${{ runner.os }}-gem-
89-
- name: Submodules and Bundle Install
90-
run: |
91-
git submodule update --init --recursive
92-
sudo gem install bundler
93-
bundle config set path 'vendor/bundle'
94-
bundle install
95-
carthage bootstrap --use-xcframeworks
96-
- name: Build-Test
97-
run: set -o pipefail && env NSUnbufferedIO=YES bundle exec rake test:facebook_utils:ios
98-
env:
99-
DEVELOPER_DIR: ${{ env.CI_XCODE_13 }}
100-
- name: Send codecov
101-
run: bash <(curl https://codecov.io/bash)
102-
103-
twitter_utils:
104-
needs: parseui
105-
runs-on: macos-latest
106-
steps:
107-
- uses: actions/checkout@v2
108-
- name: Setup Ruby
109-
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
110-
- name: Cache Gems
111-
id: cache-gems
112-
uses: actions/cache@v2
113-
with:
114-
path: vendor/bundle
115-
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
116-
restore-keys: |
117-
${{ runner.os }}-gem-
118-
- name: Submodules and Bundle Install
119-
run: |
120-
git submodule update --init --recursive
121-
sudo gem install bundler
122-
bundle config set path 'vendor/bundle'
123-
bundle install
124-
- name: Build-Test
125-
run: set -o pipefail && env NSUnbufferedIO=YES bundle exec rake test:twitter_utils:ios
126-
env:
127-
DEVELOPER_DIR: ${{ env.CI_XCODE_13 }}
128-
- name: Send codecov
129-
run: bash <(curl https://codecov.io/bash)
130-
131-
parseui:
132-
runs-on: macos-latest
133-
env:
134-
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135-
steps:
136-
- uses: actions/checkout@v2
137-
- name: Setup Ruby
138-
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
139-
- name: Cache Gems
140-
id: cache-gems
141-
uses: actions/cache@v2
142-
with:
143-
path: vendor/bundle
144-
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
145-
restore-keys: |
146-
${{ runner.os }}-gem-
147-
- name: Submodules and Bundle Install
148-
run: |
149-
git submodule update --init --recursive
150-
sudo gem install bundler
151-
bundle config set path 'vendor/bundle'
152-
bundle install
153-
carthage bootstrap --use-xcframeworks
154-
- name: Build-Test
155-
env:
156-
DEVELOPER_DIR: ${{ env.CI_XCODE_13 }}
157-
run: set -o pipefail && env NSUnbufferedIO=YES bundle exec rake test:parseui:all
158-
- name: Send codecov
159-
run: bash <(curl https://codecov.io/bash)
160-
161-
assets:
162-
runs-on: macos-11
14+
tests:
16315
env:
16416
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
timeout-minutes: 60
18+
strategy:
19+
matrix:
20+
script:
21+
- test:ios
22+
- test:macos
23+
- test:facebook_utils:ios
24+
- test:twitter_utils:ios
25+
- test:parseui:all
26+
- package:release
27+
fail-fast: false
28+
runs-on: ${{ (matrix.script == 'package:release' && 'macos-11') || 'macos-12' }}
16529
steps:
166-
- uses: actions/checkout@v2
30+
- uses: actions/checkout@v3
16731
- name: Setup Ruby
16832
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
16933
- name: Cache Gems
17034
id: cache-gems
171-
uses: actions/cache@v2
35+
uses: actions/cache@v3
17236
with:
17337
path: vendor/bundle
17438
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
17539
restore-keys: |
17640
${{ runner.os }}-gem-
177-
- name: Submodules and Bundle Install
41+
- name: Create and set the default keychain
42+
run: |
43+
security create-keychain -p "" temporary
44+
security default-keychain -s temporary
45+
security unlock-keychain -p "" temporary
46+
security set-keychain-settings -lut 7200 temporary
47+
- name: Submodules
17848
run: |
17949
git submodule update --init --recursive
18050
sudo gem install bundler
18151
bundle config set path 'vendor/bundle'
182-
bundle install
52+
- name: Bundle Install
53+
if: steps.cache-gems.outputs.cache-hit != 'true'
54+
run: bundle install
55+
- name: Cache Carthage
56+
uses: actions/cache@v3
57+
id: carthage-cache
58+
with:
59+
path: Carthage
60+
key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}
61+
restore-keys: |
62+
${{ runner.os }}-carthage-
63+
- name: Carthage
64+
if: ${{ steps.carthage-cache.outputs.cache-hit != 'true' }}
65+
run: |
18366
carthage bootstrap --use-xcframeworks
184-
- name: Build Release
185-
run: set -o pipefail && env NSUnbufferedIO=YES bundle exec rake package:release
67+
- name: Build-Test
68+
run: set -o pipefail && env NSUnbufferedIO=YES bundle exec rake ${{ matrix.script }}
18669
env:
187-
DEVELOPER_DIR: ${{ env.CI_XCODE_11 }}
188-
70+
DEVELOPER_DIR: ${{ (matrix.script == 'package:release' && env.CI_XCODE_11) || env.CI_XCODE_14 }}
71+
- name: Get Artifact Name
72+
if: ${{ always() }}
73+
env:
74+
ARTIFACT_NAME: ${{ matrix.script }}-logs
75+
run: |
76+
ARTIFACT_NAME=${{ env.ARTIFACT_NAME }}
77+
echo ARTIFACT_NAME=${ARTIFACT_NAME//:/-} >> $GITHUB_ENV # replace colon with dashes
78+
- name: Upload Artifact Logs
79+
if: ${{ always() }}
80+
uses: actions/upload-artifact@v3
81+
with:
82+
name: ${{ env.ARTIFACT_NAME }}
83+
path: |
84+
~/Library/Logs/DiagnosticReports
85+
~/Library/Developer/Xcode/DerivedData/Parse-*/Logs/Test
86+
- name: Send Codecov
87+
run: bash <(curl https://codecov.io/bash)
18988
docs:
190-
runs-on: macos-latest
89+
runs-on: macos-12
19190
steps:
192-
- uses: actions/checkout@v2
91+
- uses: actions/checkout@v3
19392
- name: Setup Ruby
19493
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
19594
- name: Cache Gems
19695
id: cache-gems
197-
uses: actions/cache@v2
96+
uses: actions/cache@v3
19897
with:
19998
path: vendor/bundle
20099
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
201100
restore-keys: |
202101
${{ runner.os }}-gem-
203-
- name: Submodules and Bundle Instal
102+
- name: Submodules
204103
run: |
205104
git submodule update --init --recursive
206105
sudo gem install bundler
207106
bundle config path vendor/bundle
208-
bundle install
107+
- name: Bundle Install
108+
if: steps.cache-gems.outputs.cache-hit != 'true'
109+
run: bundle install
209110
- name: Create Jazzy Docs
210111
run: |
211112
./Scripts/jazzy.sh
212113
env:
213-
DEVELOPER_DIR: ${{ env.CI_XCODE_13 }}
114+
DEVELOPER_DIR: ${{ env.CI_XCODE_14 }}

.github/workflows/release-manual-docs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ on:
66
default: ''
77
description: 'Version tag:'
88
env:
9-
CI_XCODE_13: '/Applications/Xcode_13.4.1.app/Contents/Developer'
9+
CI_XCODE_14: '/Applications/Xcode_14.2.app/Contents/Developer'
1010

1111
jobs:
1212
publish-docs:
1313
if: github.event.inputs.tag != ''
14-
runs-on: macos-11
14+
runs-on: macos-12
1515
steps:
1616
- name: Checkout repository
1717
uses: actions/checkout@v3
@@ -21,7 +21,7 @@ jobs:
2121
uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
2222
- name: Cache Gems
2323
id: cache-gems
24-
uses: actions/cache@v2
24+
uses: actions/cache@v3
2525
with:
2626
path: vendor/bundle
2727
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
@@ -37,7 +37,7 @@ jobs:
3737
run: |
3838
./Scripts/jazzy.sh
3939
env:
40-
DEVELOPER_DIR: ${{ env.CI_XCODE_13 }}
40+
DEVELOPER_DIR: ${{ env.CI_XCODE_14 }}
4141
- name: Deploy Jazzy Docs
4242
uses: peaceiris/actions-gh-pages@v3
4343
with:

Parse.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 0 additions & 14 deletions
This file was deleted.

Parse/Parse.xcodeproj/xcshareddata/xcschemes/Parse-iOS.xcscheme

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@
7575
ReferencedContainer = "container:Parse.xcodeproj">
7676
</BuildableReference>
7777
<SkippedTests>
78+
<Test
79+
Identifier = "ExtensionDataSharingMobileTests">
80+
</Test>
81+
<Test
82+
Identifier = "ExtensionDataSharingTests">
83+
</Test>
7884
<Test
7985
Identifier = "PFTestCase">
8086
</Test>

Rakefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ build_folder = File.join(script_folder, 'build')
1515
release_folder = File.join(build_folder, 'release')
1616
bolts_build_folder = File.join(script_folder, 'Carthage', 'Build')
1717
bolts_folder = File.join(script_folder, 'Carthage', 'Checkouts', 'Bolts-ObjC')
18-
ios_simulator = 'platform="iOS Simulator",name="iPhone 11"'
18+
ios_simulator = 'platform="iOS Simulator",name="iPhone 14"'
1919
tvos_simulator = 'platform="tvOS Simulator",name="Apple TV 4K"'
2020

2121
module Constants
@@ -467,7 +467,7 @@ namespace :test do
467467
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
468468

469469
t.actions = [XCTask::BuildAction::TEST]
470-
t.formatter = XCTask::BuildFormatter::XCPRETTY
470+
t.formatter = XCTask::BuildFormatter::XCODEBUILD
471471
end
472472
unless task.execute
473473
puts 'iOS Tests Failed!'
@@ -488,7 +488,7 @@ namespace :test do
488488
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
489489

490490
t.actions = [XCTask::BuildAction::TEST]
491-
t.formatter = XCTask::BuildFormatter::XCPRETTY
491+
t.formatter = XCTask::BuildFormatter::XCODEBUILD
492492
end
493493
unless task.execute
494494
puts 'macOS Tests Failed!'
@@ -511,7 +511,7 @@ namespace :test do
511511
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
512512

513513
t.actions = [XCTask::BuildAction::TEST]
514-
t.formatter = XCTask::BuildFormatter::XCPRETTY
514+
t.formatter = XCTask::BuildFormatter::XCODEBUILD
515515
end
516516

517517
result = task.execute
@@ -537,7 +537,7 @@ namespace :test do
537537
"GCC_GENERATE_TEST_COVERAGE_FILES" => "YES" }
538538

539539
t.actions = [XCTask::BuildAction::TEST]
540-
t.formatter = XCTask::BuildFormatter::XCPRETTY
540+
t.formatter = XCTask::BuildFormatter::XCODEBUILD
541541
end
542542

543543
result = task.execute
@@ -565,7 +565,7 @@ namespace :test do
565565
t.configuration = 'Debug'
566566

567567
t.actions = [XCTask::BuildAction::TEST]
568-
t.formatter = XCTask::BuildFormatter::XCPRETTY
568+
t.formatter = XCTask::BuildFormatter::XCODEBUILD
569569
end
570570

571571
result = task.execute

0 commit comments

Comments
 (0)