-
Notifications
You must be signed in to change notification settings - Fork 137
139 lines (131 loc) · 4.46 KB
/
_build_wheel-macos.yaml
File metadata and controls
139 lines (131 loc) · 4.46 KB
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
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
on:
workflow_call:
inputs:
torch:
type: string
required: true
py:
type: string
required: true
arch:
type: string
default: 'arm64'
artifacts_name:
type: string
default: 'wheels'
version_override:
type: string
default: ''
jobs:
build:
name: Build
runs-on: macos-14
steps:
- name: Check-out the repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install system dependencies
env:
HOMEBREW_NO_INSTALL_UPGRADE: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
brew install libsndfile python@${{ inputs.py }} || true
- name: Create the Python virtual environment
run: |
$(brew --prefix python@${{ inputs.py }})/bin/python${{ inputs.py }} -m venv ~/venv
echo ~/venv/bin >> "$GITHUB_PATH"
- name: Install PyTorch
run: |
pip install torch==${{ inputs.torch }}
- name: Install requirements
run: |
pip install --requirement native/python/requirements-build.txt
- name: Override project version
if: inputs.version_override
run: |
tools/set-project-version.sh ${{ inputs.version_override }}
- name: Build fairseq2n
working-directory: native
run: |
cmake\
-GNinja\
-DCMAKE_BUILD_TYPE=Release\
-DPython3_FIND_FRAMEWORK=NEVER\
-DFAIRSEQ2N_PERFORM_LTO=OFF\
-DFAIRSEQ2N_TREAT_WARNINGS_AS_ERRORS=ON\
-DFAIRSEQ2N_THREAD_LIB=""\
-DFAIRSEQ2N_BUILD_PYTHON_BINDINGS=ON\
-DFAIRSEQ2N_PYTHON_DEVEL=OFF\
-B build
cmake --build build
- name: Package fairseq2n
working-directory: native/python
run: |
pip wheel\
--use-pep517\
--no-build-isolation\
--no-deps\
--wheel-dir build/wheelhouse\
.
- name: Package fairseq2
run: |
pip wheel --no-deps --wheel-dir build/wheelhouse .
- name: Upload wheels and native tests to staging
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifacts_name }}-pt${{ inputs.torch }}-py${{ inputs.py }}-macos_${{ inputs.arch }}-cpu-nosan
path: |
build/wheelhouse/*.whl
native/build/tests/run-tests
native/python/build/wheelhouse/*.whl
retention-days: 1
test:
name: Test
needs: build
runs-on: macos-14
steps:
- name: Install system dependencies
env:
HOMEBREW_NO_INSTALL_UPGRADE: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
brew install libsndfile python@${{ inputs.py }} || true
- name: Download wheels and native tests from staging
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifacts_name }}-pt${{ inputs.torch }}-py${{ inputs.py }}-macos_${{ inputs.arch }}-cpu-nosan
path: ~/artifacts/
- name: Check-out the repository
uses: actions/checkout@v3
- name: Create the Python virtual environment
run: |
$(brew --prefix python@${{ inputs.py }})/bin/python${{ inputs.py }} -m venv ~/venv
echo ~/venv/bin >> "$GITHUB_PATH"
- name: Install PyTorch
run: |
pip install torch==${{ inputs.torch }}
- name: Install requirements
run: |
pip install --requirement requirements-devel.txt
- name: Install fairseq2n
run: |
pip install --no-cache-dir ~/artifacts/native/python/build/wheelhouse/*.whl
- name: Install fairseq2
run: |
whl=$(ls ~/artifacts/build/wheelhouse/*.whl)
pip install --no-cache-dir\
"fairseq2@file://$whl" "fairseq2[arrow,hg]@file://$whl"
- name: Run native tests
run: |
chmod 755 ~/artifacts/native/build/tests/run-tests
DYLD_LIBRARY_PATH=~/venv/lib:~/venv/lib/python${{ inputs.py }}/site-packages/torch/lib:~/venv/lib/python${{ inputs.py }}/site-packages/fairseq2n/lib\
~/artifacts/native/build/tests/run-tests
- name: Run Python tests
run: |
pytest -rP --verbose