-
Notifications
You must be signed in to change notification settings - Fork 109
165 lines (134 loc) · 4.87 KB
/
screenshots.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Screenshots
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
env:
S3_BUCKET: ${{ secrets.S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CONFIGURE_ENCRYPTION_KEY: ${{ secrets.CONFIGURE_ENCRYPTION_KEY }}
jobs:
build:
name: Build Application
if: contains(github.event.pull_request.labels.*.name, 'generate screenshots')
runs-on: macos-latest
steps:
- name: "Check out Project"
uses: actions/checkout@v1
- name: "Set up Ruby"
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Restore CocoaPods Dependency Cache
id: restore-cocoapods-dependency-cache
uses: actions/cache@v1
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
- name: Install App Dependencies
run: bundle exec rake dependencies
- name: Compile the App
run: bundle exec fastlane build_screenshots
- name: Archive App
uses: actions/upload-artifact@v1
with:
name: screenshot-app
path: fastlane/DerivedData/Build/Products/Debug-iphonesimulator/WooCommerce.app
- name: Archive Runner
uses: actions/upload-artifact@v1
with:
name: screenshot-runner
path: fastlane/DerivedData/Build/Products/Debug-iphonesimulator/WooCommerceScreenshots-Runner.app
capture:
name: Capture
needs: build
runs-on: macos-latest
strategy:
matrix:
language: [ar, de-DE, en-US, es-ES, fr-FR, he, id, it, ja, ko, nl-NL, pt-BR, ru, sv, tr, zh-Hans, zh-Hant]
mode: [dark, light]
steps:
- uses: actions/checkout@v1
- name: "Set up Ruby"
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Install Fastlane Dependencies
run: bundle exec fastlane run configure_apply
- name: Download Screenshot App
uses: actions/download-artifact@v1
with:
name: screenshot-app
path: fastlane/DerivedData/Build/Products/Debug-iphonesimulator/WooCommerce.app
- name: Download Screenshot Runner
uses: actions/download-artifact@v1
with:
name: screenshot-runner
path: fastlane/DerivedData/Build/Products/Debug-iphonesimulator/WooCommerceScreenshots-Runner.app
- name: Generate Screenshots
run: |
bundle exec fastlane take_screenshots languages:${{ matrix.language }} mode:${{ matrix.mode }}
- name: Store Logs
if: always()
uses: actions/upload-artifact@v1
with:
name: "screenshot-log-${{ matrix.language }}-${{ matrix.mode }}"
path: fastlane/logs
- name: Archive Generated Screenshots
run: |
cd fastlane && mkdir $GITHUB_RUN_ID && mv screenshots $GITHUB_RUN_ID
aws s3 cp $GITHUB_RUN_ID s3://$S3_BUCKET/$GITHUB_RUN_ID --recursive --exclude "*.html"
process:
name: "Process Screenshots"
needs: capture
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Install Native Dependencies
run: |
brew install imagemagick@7
brew link imagemagick@7 --force
- name: "Set up Ruby"
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Install Screenshot Gems
run: bundle install --with screenshots
- name: Install Fastlane Dependencies
run: bundle exec fastlane run configure_apply
- name: Download Generated Screenshots
run: |
cd fastlane
aws s3 cp s3://$S3_BUCKET/$GITHUB_RUN_ID/screenshots screenshots/ --recursive --exclude "*.html"
- name: Generate and Upload Screenshot Summary
run: |
bundle exec fastlane create_screenshot_summary
aws s3 cp fastlane/screenshots/screenshots.html s3://$S3_BUCKET/$GITHUB_RUN_ID/screenshots/screenshots.html
- name: Archive Raw Screenshots
uses: actions/upload-artifact@v1
with:
name: raw-screenshots
path: fastlane/screenshots
- name: Install Promo Screenshot Fonts
run: |
aws s3 cp s3://$S3_BUCKET/fonts.zip fonts.zip
unzip fonts.zip
mkdir -p ~/Library/Fonts
cp -v fonts/*.otf ~/Library/Fonts
ls ~/Library/Fonts
mkdir -p /Library/Fonts
cp -v fonts/*.otf /Library/Fonts
ls /Library/Fonts
# Reset the font server in order to use these fonts
atsutil databases -removeUser
atsutil server -shutdown
atsutil server -ping
- name: Generate Promo Screenshots
run: |
git lfs install && git lfs fetch && git lfs pull
bundle exec fastlane create_promo_screenshots force:true
- name: Archive Promo Screenshots
uses: actions/upload-artifact@v1
with:
name: promo-screenshots
path: fastlane/promo_screenshots