Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
pytorch/.github/workflows/_mac-build.yml at master · ragulpr/pytorch · GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
ragulpr
pytorch
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
pytorch
/
.github
/
workflows
/
_mac-build.yml
Copy path
View runs
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
204 lines (185 loc) · 8.09 KB
master
Breadcrumbs
pytorch
/
.github
/
workflows
/
_mac-build.yml
Copy path
Top
File metadata and controls
Code
Blame
204 lines (185 loc) · 8.09 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
name
:
mac-build
on
:
workflow_call
:
inputs
:
build-environment
:
required
:
true
type
:
string
description
:
Top-level label for what's being built/tested.
runner-type
:
required
:
true
type
:
string
description
:
Name of the GitHub-managed runner type to use for the build.
build-generates-artifacts
:
required
:
true
type
:
boolean
description
:
If set, upload generated build artifacts.
xcode-version
:
required
:
false
type
:
string
default
:
"
"
description
:
What xcode version to build with.
sync-tag
:
required
:
false
type
:
string
default
:
"
"
description
:
|
If this is set, our linter will use this to make sure that every other
job with the same `sync-tag` is identical.
python_version
:
required
:
false
type
:
string
default
:
"
3.8
"
description
:
|
The python version to be used. Will be 3.8 by default
environment-file
:
required
:
false
type
:
string
description
:
Set the conda environment file used to setup macOS build.
test-matrix
:
required
:
false
type
:
string
description
:
|
An option JSON description of what test configs to run later on. This
is moved here from the Linux test workflow so that we can apply filter
logic using test-config labels earlier and skip unnecessary builds
sccache-use-gha
:
required
:
false
type
:
boolean
default
:
false
description
:
If true, use the Github cache as the storage option for sccache instead of S3.
outputs
:
test-matrix
:
value
:
${{ inputs.test-matrix }}
description
:
An optional JSON description of what test configs to run later on.
build-outcome
:
value
:
${{ jobs.build.outputs.build-outcome }}
description
:
The outcome of the build step. This is used to influence test filtering logic later on.
secrets
:
MACOS_SCCACHE_S3_ACCESS_KEY_ID
:
required
:
true
description
:
Access key for S3 bucket for macOS sccache.
MACOS_SCCACHE_S3_SECRET_ACCESS_KEY
:
required
:
true
description
:
Secret for S3 bucket for macOS sccache.
jobs
:
build
:
#
Don't run on forked repos.
if
:
github.repository_owner == 'pytorch'
runs-on
:
${{ inputs.runner-type }}
env
:
#
For sccache access (only on non-forked PRs)
AWS_ACCESS_KEY_ID
:
${{ secrets.MACOS_SCCACHE_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY
:
${{ secrets.MACOS_SCCACHE_S3_SECRET_ACCESS_KEY }}
BUILD_ENVIRONMENT
:
${{ inputs.build-environment }}
SCCACHE_USE_GHA
:
${{ inputs.sccache-use-gha }}
#
this is placed here instead of the sccache step to appease actionlint
outputs
:
build-outcome
:
${{ steps.build.outcome }}
steps
:
-
name
:
Clean up disk space before running MacOS workflow
uses
:
pytorch/test-infra/.github/actions/check-disk-space@main
#
[see note: pytorch repo ref]
-
name
:
Checkout PyTorch
uses
:
pytorch/pytorch/.github/actions/checkout-pytorch@master
-
name
:
Set xcode version
env
:
XCODE_VERSION
:
${{ inputs.xcode-version }}
run
:
|
if [ -n "${XCODE_VERSION}" ]; then
echo "DEVELOPER_DIR=/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer" >> "${GITHUB_ENV}"
fi
-
name
:
Setup miniconda
if
:
inputs.environment-file == ''
uses
:
pytorch/test-infra/.github/actions/setup-miniconda@main
with
:
python-version
:
${{ inputs.python_version }}
environment-file
:
.github/requirements/conda-env-${{ runner.os }}-${{ runner.arch }}
pip-requirements-file
:
.github/requirements/pip-requirements-${{ runner.os }}.txt
#
This option is used when cross-compiling arm64 from x86-64. Specifically, we need arm64 conda
#
environment even though the arch is x86-64
-
name
:
Setup miniconda using the provided environment file
if
:
inputs.environment-file != ''
uses
:
pytorch/test-infra/.github/actions/setup-miniconda@main
with
:
python-version
:
${{ inputs.python_version }}
environment-file
:
${{ inputs.environment-file }}
pip-requirements-file
:
.github/requirements/pip-requirements-${{ runner.os }}.txt
-
name
:
Install macOS homebrew dependencies
uses
:
nick-fields/retry@v2.8.2
with
:
timeout_minutes
:
5
max_attempts
:
3
retry_wait_seconds
:
90
command
:
|
# Install dependencies
brew install libomp
brew link --force libomp
-
name
:
Install sccache (only for non-forked PRs, and pushes to trunk)
uses
:
nick-fields/retry@v2.8.2
if
:
${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
with
:
timeout_minutes
:
5
max_attempts
:
3
retry_wait_seconds
:
90
command
:
|
if [[ "${SCCACHE_USE_GHA}" == "true" ]]; then
sudo curl --retry 3 --retry-all-errors https://s3.amazonaws.com/ossci-macos/sccache_v0.4.0-pre.7 --output /usr/local/bin/sccache
echo "ACTIONS_CACHE_URL=${ACTIONS_CACHE_URL}" >> "${GITHUB_ENV}"
echo "ACTIONS_RUNTIME_TOKEN=${ACTIONS_RUNTIME_TOKEN}" >> "${GITHUB_ENV}"
echo "SCCACHE_GHA_ENABLED=on" >> "${GITHUB_ENV}"
else
sudo curl --retry 3 --retry-all-errors https://s3.amazonaws.com/ossci-macos/sccache_v2.15 --output /usr/local/bin/sccache
echo "SCCACHE_BUCKET=ossci-compiler-cache-circleci-v2" >> "${GITHUB_ENV}"
echo "SCCACHE_S3_KEY_PREFIX=${GITHUB_WORKFLOW}" >> "${GITHUB_ENV}"
fi
sudo chmod +x /usr/local/bin/sccache
-
name
:
Get workflow job id
id
:
get-job-id
uses
:
./.github/actions/get-workflow-job-id
if
:
always()
with
:
github-token
:
${{ secrets.GITHUB_TOKEN }}
#
Apply the filter logic to the build step too if the test-config label is already there
-
name
:
Select all requested test configurations (if the test matrix is available)
id
:
filter
uses
:
./.github/actions/filter-test-configs
with
:
github-token
:
${{ secrets.GITHUB_TOKEN }}
test-matrix
:
${{ inputs.test-matrix }}
-
name
:
Build
if
:
steps.filter.outputs.is-test-matrix-empty == 'False' || inputs.test-matrix == ''
id
:
build
env
:
OUR_GITHUB_JOB_ID
:
${{ steps.get-job-id.outputs.job-id }}
run
:
|
echo "CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"}" >> "${GITHUB_ENV}"
if [[ -n "$CONDA_ENV" ]]; then
# Use binaries under conda environment
export PATH="$CONDA_ENV/bin":$PATH
fi
${CONDA_RUN} .ci/pytorch/macos-build.sh
-
name
:
Archive artifacts into zip
if
:
inputs.build-generates-artifacts && steps.build.outcome != 'skipped'
run
:
|
zip -1 -r artifacts.zip dist/ build/.ninja_log build/compile_commands.json .pytorch-test-times.json
-
name
:
Store PyTorch Build Artifacts on GHA
uses
:
actions/upload-artifact@v3
if
:
inputs.build-generates-artifacts && steps.build.outcome != 'skipped'
with
:
name
:
${{ env.BUILD_ENVIRONMENT }}
retention-days
:
14
if-no-files-found
:
error
path
:
artifacts.zip
-
name
:
Upload sccache stats to GHA
uses
:
actions/upload-artifact@v3
#
Only if sccache is installed, see above
if
:
${{ (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && steps.build.outcome != 'skipped' }}
with
:
name
:
sccache-stats-${{ inputs.build-environment }}-runattempt${{ github.run_attempt }}-${{ steps.get-job-id.outputs.job-id }}
retention-days
:
14
if-no-files-found
:
warn
path
:
sccache-stats-*.json
-
name
:
Clean up disk space
if
:
always()
continue-on-error
:
true
uses
:
pytorch/test-infra/.github/actions/check-disk-space@main
You can’t perform that action at this time.