-
Notifications
You must be signed in to change notification settings - Fork 34
198 lines (166 loc) · 6.7 KB
/
tests.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
---
name: brew test-bot
on:
push:
branches:
- main
- master
pull_request:
# workflow_dispatch: # NOTE: nova with homebrew gha
env:
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_INSTALL_FROM_API: 1
HOMEBREW_DEVELOPER: 1
jobs:
test-bot:
strategy:
# NOTE: ipatch, `fail-fast` disabled because subsequent runners can not run job if previous job failed
fail-fast: false
# NOTE: ipatch, all three self hosted runners (vms) are hosted on same computer
# ...so limit job to one runner at a time.
# REF:
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#defining-the-maximum-number
max-parallel: 1
matrix:
# os: [ubuntu-latest, macos-latest] # NOTE: default
# NOTE: homebrew/homebrew-core uses private self hosted runners
os:
- ubuntu-22.04
# NOTE: macos-*-large runner requires additional spending limits
# - macos-14-large
- macos-14
# - macos-13-large
- macos-13
# - macos-12-large
- macos-12
# - self-hosted-catalinavm
# - self-hosted-bigsurvm
# - self-hosted-mojavevm
runs-on: ${{ matrix.os }}
timeout-minutes: 1200
steps:
- name: Get current date
id: get-current-date
run: echo "date=$(date +'%Y-%m-%dT%H:%M:%S')" >> "$GITHUB_ENV"
- name: Set date output
id: set-date
run: echo "date=$(date +'%Y-%m-%dT%H:%M:%S')" >> "$GITHUB_OUTPUT"
- name: Print value of date from previous step
id: print-date
run: echo "${{ steps.set-date.outputs.date }}"
- name: Set default run status
id: set-default-run-status
run: echo "last-run-status=default" >> "$GITHUB-ENV"
- name: Restore last run status
id: restore-last-run-status
uses: actions/[email protected]
with:
path: |
last-run-status
key: |
${{ github.run_id }}-${{ matrix.os }}-${{ steps.set-date.outputs.date }}
restore-keys: |
${{ github.run_id }}-${{ matrix.os }}-
- name: Set last run status
id: set-last-run-status
run: echo "last-run-status=${{ env.last-run-status }}" >> "GITHUB_OUTPUT"
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Cache Homebrew Bundler RubyGems
if: steps.set-last-run-status.outputs.last-run-status != 'success'
id: cache
uses: actions/[email protected]
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ runner.os }}-rubygems-
- name: print env
id: print-env
run: env
# NOTE: use a condition to add env var for mojave runner
# REF: https://docs.github.com/en/actions/learn-github-actions/environment-variables
- name: condition, check runner name
if: runner.name == 'vmmojave'
run: echo "The operating system on the runner is, $RUNNER_OS."; echo HOMEBREW_DEVELOPER=1 >> "$GITHUB_ENV"
# NOTE: not possible to have two `run:` blocks within a `name`
- name: Install Homebrew Bundler RubyGems
if: steps.cache.outputs.cache-hit != 'true' && steps.set-last-run-status.outputs.last-run-status != 'success'
run: brew install-bundler-gems
- run: brew test-bot --only-cleanup-before
- run: brew test-bot --only-setup
- run: brew test-bot --only-tap-syntax
# NOTE: ipatch, attempt to set homebrew-core repo to specific commit for catalina bottling
- name: check for catalina vm and set homebrew-core repo to specific commit
if: runner.name == 'vmcatalina'
run: |
cd "$(brew --repo homebrew/core)"; \
git checkout ipatch-1015-cmake-bottle
- name: condition, update style exceptions for vmmojave
if: runner.name == 'vmmojave'
run: |
sed -i '' \
-e '/[email protected]/d' \
-e '/[email protected]/d' \
-e '/[email protected]/d' \
-e '/[email protected]/d' \
"$(brew --repo homebrew/core)/style_exceptions/binary_bootstrap_formula_urls_allowlist.json"
# NOTE: ipatch, env var required, see, https://github.com/orgs/Homebrew/discussions/4856
- name: unset HOMEBREW_NO_INSTALL_FROM_API for linux runners
run: |
if [[ $RUNNER_OS == 'Linux' ]]; then
unset HOMEBREW_NO_INSTALL_FROM_API
fi
- name: build bottle using test-bot for current formula
id: build-bottle
run: |
# Check if the runner name is vmmojave or vmcatalina and add the flag if true
# NOTE: ipatch, keep-old is not the droid you're looking for,
# see: https://github.com/orgs/Homebrew/discussions/4935
# --keep-old \
if [[ runner.name == 'vmmojave' || runner.name == 'vmcatalina' ]]; then
brew test-bot \
--skip-online-checks \
--only-formulae \
--only-json-tab \
--skip-recursive-dependents \
--build-dependents-from-source \
--root-url=https://ghcr.io/v2/freecad/homebrew-freecad
else
brew test-bot \
--skip-online-checks \
--only-formulae \
--only-json-tab \
--skip-recursive-dependents \
--root-url=https://ghcr.io/v2/freecad/homebrew-freecad
fi
if: github.event_name == 'pull_request'
# - name: debug with tmate on failure
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
- name: debug with lhotari/action-upterm
id: debug-workflow-run
# uses: actions/checkout@v2
uses: lhotari/action-upterm@v1
if: ${{ failure() }}
with:
# limit ssh access to user who triggered the workflow
limit-access-to-actor: true
# shut down server after 10 minutes if no one connects
wait-timeout-minutes: 10
# NOTE: ipatch, issue using upload-artifact@v4
# see: https://github.com/actions/upload-artifact/issues/478
- name: Upload bottles as artifact
id: upload-bottle-artifacts
if: always() && github.event_name == 'pull_request'
# uses: actions/[email protected]
uses: actions/[email protected]
with:
name: bottles
path: '*.bottle.*'
- name: Save run status
id: save-run-status
if: steps.set-last-run-status.outputs.last-run-status != 'success'
run: echo "last-run-status=${{ steps.build-bottle.outcome }}" >> "$GITHUB-ENV"