@@ -13,125 +13,165 @@ env:
13
13
jobs :
14
14
build :
15
15
name : Build
16
- runs-on : macos-latest
16
+ runs-on : macos-12
17
+ if : ${{ !github.event.pull_request.draft }}
17
18
env :
18
19
scheme : ${{ 'Readium-Package' }}
19
- DEVELOPER_DIR : /Applications/Xcode_12.4 .app/Contents/Developer
20
+ DEVELOPER_DIR : /Applications/Xcode_13.4.1 .app/Contents/Developer
20
21
21
22
steps :
22
23
- name : Checkout
23
- uses : actions/checkout@v2
24
+ uses : actions/checkout@v3
24
25
- name : Install dependencies
25
- run : brew install xcodegen
26
+ run : |
27
+ brew update
28
+ brew install xcodegen
26
29
- name : Check Carthage project
27
30
run : |
28
31
# Check that the Carthage project is up to date.
29
32
make carthage-project
30
- git diff --exit-code --name-only Support/Carthage/Readium.xcodeproj
33
+ git diff --exit-code Support/Carthage/Readium.xcodeproj
31
34
- name : Build
32
35
run : |
33
- xcodebuild build-for-testing -scheme "$scheme" -destination "platform=$platform,name=$device"
36
+ set -eo pipefail
37
+ xcodebuild build-for-testing -scheme "$scheme" -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi
34
38
- name : Test
35
39
run : |
36
- xcodebuild test-without-building -scheme "$scheme" -destination "platform=$platform,name=$device"
40
+ set -eo pipefail
41
+ xcodebuild test-without-building -scheme "$scheme" -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi
37
42
38
43
lint :
39
44
name : Lint
40
- runs-on : macos-latest
45
+ runs-on : macos-12
46
+ if : ${{ !github.event.pull_request.draft }}
41
47
env :
42
48
scripts : ${{ 'Sources/Navigator/EPUB/Scripts' }}
43
49
44
50
steps :
45
51
- name : Checkout
46
- uses : actions/checkout@v2
52
+ uses : actions/checkout@v3
53
+ - name : Install pnpm
54
+ uses : pnpm/action-setup@v2
55
+ with :
56
+ package_json_file : Sources/Navigator/EPUB/Scripts/package.json
57
+ run_install : false
58
+ - name : Setup cache
59
+ uses : actions/setup-node@v3
60
+ with :
61
+ node-version : 20
62
+ cache : ' pnpm'
63
+ cache-dependency-path : Sources/Navigator/EPUB/Scripts/pnpm-lock.yaml
47
64
- name : Install dependencies
48
- run : yarn --cwd "$scripts" install --frozen-lockfile
49
- - name : Lint JavaScript
50
- run : yarn --cwd "$scripts" run lint
51
- - name : Check JavaScript formatting
52
- run : yarn --cwd "$scripts" run checkformat
65
+ run : pnpm --dir "$scripts" install --frozen-lockfile
66
+ - name : Lint
67
+ run : pnpm --dir "$scripts" run lint
68
+ - name : Check formatting
69
+ run : pnpm --dir "$scripts" run checkformat
53
70
- name : Check if bundled scripts are up-to-date
54
71
run : |
55
72
make scripts
56
73
git diff --exit-code --name-only Sources/Navigator/EPUB/Assets/Static/scripts/*.js
74
+ - name : Lint Swift formatting
75
+ run : make lint-format
57
76
58
77
int-dev :
59
78
name : Integration (Local)
60
- runs-on : macos-latest
79
+ runs-on : macos-12
80
+ if : ${{ !github.event.pull_request.draft }}
61
81
defaults :
62
82
run :
63
83
working-directory : TestApp
64
84
environment : LCP
65
85
steps :
66
86
- name : Checkout
67
- uses : actions/checkout@v2
87
+ uses : actions/checkout@v3
68
88
- name : Install dependencies
69
- run : brew install xcodegen
89
+ run : |
90
+ brew update
91
+ brew install xcodegen
70
92
- name : Generate project
71
93
run : make dev lcp=${{ secrets.LCP_URL_SPM }}
72
94
- name : Build
73
95
run : |
74
- xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device"
75
-
76
- # The following integration jobs are run only when pushing to `develop` or `main`.
77
- # As they use a specific commit hash, they can't run properly from a pull request
78
- # opened from forks.
96
+ set -eo pipefail
97
+ xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi
79
98
80
99
int-spm :
81
100
name : Integration (Swift Package Manager)
82
- if : github.event_name == 'push'
83
- runs-on : macos-latest
101
+ runs-on : macos-12
102
+ if : ${{ !github.event.pull_request.draft }}
84
103
defaults :
85
104
run :
86
105
working-directory : TestApp
87
106
environment : LCP
88
107
steps :
89
108
- name : Checkout
90
- uses : actions/checkout@v2
109
+ uses : actions/checkout@v3
110
+ # We can't use the current github.sha with pull_request event, because they will
111
+ # reference the merge commit which cannot be fetched with SPM.
112
+ - name : Set commit SHA
113
+ if : github.event_name == 'pull_request'
114
+ run : |
115
+ echo "commit_sha=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_ENV"
91
116
- name : Install dependencies
92
- run : brew install xcodegen
117
+ run : |
118
+ brew update
119
+ brew install xcodegen
93
120
- name : Generate project
94
121
run : make spm lcp=${{ secrets.LCP_URL_SPM }} commit=$commit_sha
95
122
- name : Build
96
123
run : |
97
- xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device"
124
+ set -eo pipefail
125
+ xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi
98
126
99
127
int-carthage :
100
128
name : Integration (Carthage)
101
- if : github.event_name == 'push'
102
- runs-on : macos-latest
129
+ runs-on : macos-12
130
+ if : ${{ !github.event.pull_request.draft }}
103
131
defaults :
104
132
run :
105
133
working-directory : TestApp
106
134
environment : LCP
107
135
steps :
108
136
- name : Checkout
109
- uses : actions/checkout@v2
137
+ uses : actions/checkout@v3
138
+ # We can't use the current github.sha with pull_request event, because they will
139
+ # reference the merge commit which cannot be fetched with Carthage.
140
+ - name : Set commit SHA
141
+ if : github.event_name == 'pull_request'
142
+ run : |
143
+ echo "commit_sha=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_ENV"
110
144
- name : Install dependencies
111
- run : brew install xcodegen
145
+ run : |
146
+ brew update
147
+ brew install xcodegen
112
148
- name : Generate project
113
149
run : make carthage lcp=${{ secrets.LCP_URL_CARTHAGE }} commit=$commit_sha
114
150
- name : Build
115
151
run : |
116
- xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device"
152
+ set -eo pipefail
153
+ xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi
117
154
118
155
# Warning: This job cannot actually test the state of the current commit,
119
156
# but will check that the latest branch/tag set in the Podspecs are valid.
120
157
int-cocoapods :
121
158
name : Integration (CocoaPods)
122
159
if : github.event_name == 'push'
123
- runs-on : macos-latest
160
+ runs-on : macos-12
124
161
defaults :
125
162
run :
126
163
working-directory : TestApp
127
164
environment : LCP
128
165
steps :
129
166
- name : Checkout
130
- uses : actions/checkout@v2
167
+ uses : actions/checkout@v3
131
168
- name : Install dependencies
132
- run : brew install xcodegen
169
+ run : |
170
+ brew update
171
+ brew install xcodegen
133
172
- name : Generate project
134
173
run : make cocoapods lcp=${{ secrets.LCP_URL_COCOAPODS }} commit=$commit_sha
135
174
- name : Build
136
175
run : |
137
- xcodebuild build -workspace TestApp.xcworkspace -scheme TestApp -destination "platform=$platform,name=$device"
176
+ set -eo pipefail
177
+ xcodebuild build -workspace TestApp.xcworkspace -scheme TestApp -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi
0 commit comments