This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 11
254 lines (216 loc) · 7.73 KB
/
xcode-build.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
name: CutBox Test/Build CI
on:
push:
branches: [ "master" ]
workflow_dispatch:
inputs:
debug:
description: Debug this build?
type: choice
required: true
default: 'false'
options:
- 'true'
- 'false'
jobs:
build:
name: CutBox Build
runs-on: macos-12
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
ref: master
- name: Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Go-lang 1.19
uses: gacts/setup-go-with-cache@v1
with:
go-version: 1.23
- name: Install Golang deps
run: |
go install github.com/santhosh-tekuri/jsonschema/cmd/jv@latest
go install github.com/ericchiang/pup@latest
- name: CI diagnostics
run: |
echo "============================================================"
for b in ci_is_production ci_get_release_info ci_update_info_plist ci_update_cutbox_homebrew setup test build
do
if [[ -x bin/$b ]]; then
echo "[✓] bin/$b executable."
else
echo "[✗] bin/$b - missing or non-executable" && exit 1
fi
done
- name: Production Release when commit message has tag [release]
run: |
bin/ci_is_production
- name: Setup tmate session
if: "${{ github.event.inputs.debug == 'true' }}"
uses: mxschmitt/action-tmate@v3
timeout-minutes: 15
with:
limit-access-to-actor: true
- name: Setup
run: |
make setup
- name: Run Tests
run: |
make test_ci
- name: Upload CutBox Test Coverage to Codacy
run: |
if bin/codacy_upload_coverage; then
echo "### Code coverage uploaded to Codacy [✓]" >> "$GITHUB_STEP_SUMMARY"
else
echo "### Failed uploaded to Codacy [✗]" >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
- name: Prepare CutBox Test Coverage Docs for Pages
run: |
if bin/pages_prepare_coverage_report ; then
echo "### Code coverage prepared for to cutbox.github.io/CutBox/App/ [✓]" >> "$GITHUB_STEP_SUMMARY"
else
echo "### Failed prepare coverage for cutbox.github.io/CutBox/App/ [✗]" >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
- name: Check Localized.strings
run: |
echo "# Check Localized.strings" >> "$GITHUB_STEP_SUMMARY"
echo "## Linting" >> "$GITHUB_STEP_SUMMARY"
bin/lint_localized_strings
echo "## Languages Correlate" >> "$GITHUB_STEP_SUMMARY"
find CutBox/Localization \
-type d \
-name "*lproj" \
-not -name 'en.lproj' \
-exec bin/check_localization "{}"/Localizable.strings \;
echo "## Strings Are Localized?" >> "$GITHUB_STEP_SUMMARY"
bin/check_l7n_source
- name: Theme validation
run: |
make test_themes
- name: CutBox Build
run: |
make build
- name: Command line test
run: |
bin/command_line_test
make -C cutbox_command coverage_report
- name: Refry llvm-cov html reports
run: |
bin/fix_llvm_html_pathnames docs/CLI 'cutbox_command'
bin/llvm_cov_refryer --docs-root="docs/App" --source-dir="Source"
- name: Append addBlobs.js to coverage index pages
run: |
for a in App CLI; do
echo '<script type="text/javascript" src="../js/addBlobs.js"></script>' >> docs/$a/index.html
done
- name: Commit Coverage Reports
run: |
git add docs
if git diff --cached --quiet; then
echo "No changes to coverage reports"
else
git commit -m "App & CLI coverage reports - $(TZ=UTC date +%Y-%m-%dT%H:%M:%SZ) [codacy skip]"
fi
- name: Generate coverage graphs
run: |
bin/get_coverage_numbers docs/App/index.html \
> docs/App/cov_progress.json
bin/render_cov_graph \
--output docs/App/cov.svg \
--title "CutBox.app test coverage" \
< docs/App/cov_progress.json
bin/get_coverage_numbers docs/CLI/index.html \
> docs/CLI/cov_progress.json
bin/render_cov_graph \
--output docs/CLI/cov.svg \
--title "CutBox CLI test coverage" \
< docs/CLI/cov_progress.json
- name: Commit coverage graphs
run: |
git add docs
if git diff --cached --quiet; then
echo "No changes to coverage grapghs"
else
git commit -m "App & CLI coverage graphs - $(TZ=UTC date +%Y-%m-%dT%H:%M:%SZ) [codacy skip]"
fi
- name: Push runner commits
run: |
git pull --rebase --autostash
git push origin master
- name: CLI Build
run: |
make -C cutbox_command dmg_bin
- name: Make DMG
run: |
make dmg
- name: Get Release Info
run: |
make ci_get_release_info
- name: Assemble release notes
run: |
mkdir tmp/
bin/get_release_notes | tee tmp/release-notes.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ env.RELEASE }}
release_name: ${{ env.RELEASE }}
draft: ${{ env.PRODUCTION_RUN != 1}}
prerelease: false
body_path: tmp/release-notes.md
- name: Upload CutBox.dmg release asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: CutBox.dmg
asset_name: CutBox-${{env.RELEASE}}.dmg
asset_content_type: application/octet-stream
- name: Update Info.plist (commit/push)
run: |
if [[ "$PRODUCTION_RUN" == "1" ]]; then
bin/ci_update_info_plist
fi
- name: Notify brew tap cutbox
run: |
if [[ "$PRODUCTION_RUN" == "1" ]]; then
curl \
-s \
-XPOST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.CUTBOX_PAT }}" \
https://api.github.com/repos/cutbox/homebrew-cutbox/actions/workflows/35793720/dispatches \
--data '{"ref":"main","inputs":{"release":"${{ env.RELEASE }}"}}'
fi
- name: Notify cutbox.github.io
run: |
if [[ "$PRODUCTION_RUN" == "1" ]]; then
curl \
-s \
-XPOST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.CUTBOX_PAT }}" \
https://api.github.com/repos/cutbox/cutbox.github.io/actions/workflows/35834026/dispatches \
--data '{"ref":"master","inputs":{"release":"${{ env.RELEASE }}"}}'
fi
- name: Release Notes to Step Summary
run: |
{
echo "- - -"
cat tmp/release-notes.md
echo ""
echo "### Link to [${{env.RELEASE}}](${{ steps.create_release.outputs.html_url }})"
echo "- - -"
echo "### [Codacy Dashboard...](https://app.codacy.com/gh/cutbox/CutBox/dashboard)"
echo "### [Code Coverage reports...](https://cutbox.github.io/CutBox/)"
echo "- - -"
} >> "$GITHUB_STEP_SUMMARY"