@@ -8,105 +8,38 @@ permissions:
8
8
contents : read
9
9
10
10
jobs :
11
- deploy-with-custom-ops :
12
- # This job is currently skipped until we cut a release with custom ops.
13
- if : false
14
- name : Build and deploy release wheels with custom ops
15
- runs-on : ${{ matrix.os }}
16
- strategy :
17
- matrix :
18
- # To switch on windows-2022/latest, please verify the bazel version:
19
- # https://github.com/bazelbuild/bazel/issues/14232#issuecomment-1011247429
20
- os : ['macos-12', 'windows-2019', 'ubuntu-18.04']
21
- py-version : ['3.9', '3.10', '3.11']
22
- tf-version : ['2.13.0']
23
- use-macos-arm : [false]
24
- include :
25
- - os : ' macos-12'
26
- tf-version : ' 2.13.0'
27
- py-version : ' 3.9'
28
- use-macos-arm : true
29
- - os : ' macos-12'
30
- tf-version : ' 2.13.0'
31
- py-version : ' 3.10'
32
- use-macos-arm : true
33
- fail-fast : false
34
- steps :
35
- - uses : actions/checkout@v2
36
- - name : Set up Python
37
- uses : actions/setup-python@v1
38
- with :
39
- python-version : ${{ matrix.py-version }}
40
- - name : Get pip cache dir
41
- id : pip-cache
42
- run : |
43
- python -m pip install --upgrade pip setuptools wheel auditwheel twine
44
- echo "::set-output name=dir::$(pip cache dir)"
45
- - name : pip cache
46
- uses : actions/cache@v2
47
- with :
48
- path : ${{ steps.pip-cache.outputs.dir }}
49
- key : ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
50
- restore-keys : |
51
- ${{ runner.os }}-pip-
52
- - name : Install dependencies
53
- run : |
54
- python -m pip install tensorflow-cpu==${{ matrix.tf-version }}
55
- python -m pip install -e ".[tests]" --progress-bar off --upgrade
56
- - name : Configure Build Environment
57
- run : |
58
- python build_deps/configure.py
59
- - name : Reinstall TensorFlow (MacOS ARM)
60
- if : ${{ matrix.os == 'macos-12' && matrix.use-macos-arm}}
61
- run : |
62
- python -m pip uninstall -y tensorflow-cpu
63
- python -m pip install --platform=macosx_12_0_arm64 --no-deps --target=$(python -c 'import site; print(site.getsitepackages()[0])') --upgrade tensorflow-macos==${{ matrix.tf-version }}
64
- - name : Bazel Build
65
- if : ${{ ! matrix.use-macos-arm }}
66
- run : |
67
- export BUILD_WITH_CUSTOM_OPS=true
68
- bazel build build_pip_pkg
69
- - name : Bazel Build (MacOS ARM)
70
- if : ${{ matrix.use-macos-arm}}
71
- run : |
72
- bazel build --cpu=darwin_arm64 --copt -mmacosx-version-min=12.0 --linkopt -mmacosx-version-min=12.0 build_pip_pkg
73
- - name : Build wheels
74
- run : |
75
- export BUILD_WITH_CUSTOM_OPS=true
76
- bazel-bin/build_pip_pkg wheels
77
- - name : Repair wheels (manylinux)
78
- if : ${{ matrix.os == 'ubuntu-18.04' }}
79
- run : |
80
- python -m pip install --upgrade patchelf==0.14
81
- bash build_deps/tf_auditwheel_patch.sh
82
- python -m auditwheel repair --plat manylinux2014_x86_64 wheels/*.whl
83
- rm wheels/*.whl
84
- mv wheelhouse/* wheels/
85
- - name : Upload wheels
86
- env :
87
- TWINE_USERNAME : ${{ secrets.PYPI_USERNAME }}
88
- TWINE_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
89
- run : |
90
- twine upload wheels/*
91
- deploy-without-custom-ops :
92
- name : Build and deploy release wheels without custom ops
11
+ run-test-for-release :
12
+ uses : ./.github/workflows/actions.yml
13
+ release :
14
+ name : Build and publish to PyPI
93
15
runs-on : ubuntu-latest
94
16
steps :
95
- - uses : actions/checkout@v2
96
- - name : Set up Python
97
- uses : actions/setup-python@v1
98
- with :
99
- python-version : 3.9
100
- - name : Build wheels
101
- run : |
102
- pip install tensorflow==2.13.0
103
- python -m pip install --upgrade setuptools wheel twine
104
- python -m pip install --upgrade -r requirements.txt
105
- export BUILD_WITH_CUSTOM_OPS=false
106
- python pip_build.py
107
- - name : Upload wheels
108
- env :
109
- TWINE_USERNAME : ${{ secrets.PYPI_USERNAME }}
110
- TWINE_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
111
- run : |
112
- twine upload dist/*.whl
17
+ - uses : actions/checkout@v3
18
+ - name : Set up Python
19
+ uses : actions/setup-python@v4
20
+ with :
21
+ python-version : 3.9
22
+ - name : Get pip cache dir
23
+ id : pip-cache
24
+ run : |
25
+ python -m pip install --upgrade pip setuptools
26
+ echo "::set-output name=dir::$(pip cache dir)"
27
+ - name : pip cache
28
+ uses : actions/cache@v2
29
+ with :
30
+ path : ${{ steps.pip-cache.outputs.dir }}
31
+ key : ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
32
+ restore-keys : |
33
+ ${{ runner.os }}-pip-
34
+ - name : Install dependencies
35
+ run : |
36
+ pip install -r requirements.txt --progress-bar off
37
+ - name : Build a binary wheel and a source tarball
38
+ run : |
39
+ export BUILD_WITH_CUSTOM_OPS=false
40
+ python pip_build.py
41
+ - name : Publish distribution to PyPI
42
+ if : startsWith(github.ref, 'refs/tags')
43
+ uses : pypa/gh-action-pypi-publish@master
44
+ with :
45
+ password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments