1- name : Build PYPI wheels for opencv-python on Linux x86_64
1+ name : Linux x86_64
22
33on :
44 pull_request :
1313 - ' .github/workflows/build_wheels_macos*'
1414 release :
1515 types : [published, edited]
16+ schedule :
17+ - cron : ' 0 3 * * 6'
18+ workflow_dispatch :
1619
1720
1821jobs :
19- build :
22+ Build :
2023 runs-on : ubuntu-20.04
2124 defaults :
2225 run :
3235 env :
3336 ACTIONS_ALLOW_UNSECURE_COMMANDS : true
3437 REPO_DIR : .
35- BUILD_COMMIT : master
38+ BUILD_COMMIT : ${{ github.ref }}
3639 PROJECT_SPEC : opencv-python
3740 MB_PYTHON_VERSION : ${{ matrix.python-version }}
3841 TRAVIS_PYTHON_VERSION : ${{ matrix.python-version }}
@@ -50,29 +53,33 @@ jobs:
5053 - name : Cleanup
5154 run : find . -mindepth 1 -delete
5255 working-directory : ${{ github.workspace }}
56+ - name : Setup environment
57+ run : |
58+ if [[ "${{ github.event.pull_request }}" == "true" ]]; then
59+ echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
60+ elif [[ "${{ github.event_name }}" == "schedule" ]]; then
61+ echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
62+ fi
5363 - name : Checkout
54- uses : actions/checkout@v2
64+ uses : actions/checkout@v3
5565 with :
5666 submodules : false
5767 fetch-depth : 0
58- - name : Update submodules
59- if : github.event_name == 'pull_request'
60- run : git submodule update --remote
6168 - name : Build a package
6269 run : source scripts/build.sh
6370 - name : Saving all wheels
64- uses : actions/upload-artifact@v2
71+ uses : actions/upload-artifact@v3
6572 with :
6673 name : wheels
6774 path : wheelhouse/opencv*.whl
6875 - name : Saving a wheel accordingly to matrix
69- uses : actions/upload-artifact@v2
76+ uses : actions/upload-artifact@v3
7077 with :
7178 name : wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
7279 path : wheelhouse/opencv*.whl
7380
74- test :
75- needs : [build ]
81+ Test :
82+ needs : [Build ]
7683 runs-on : ubuntu-20.04
7784 defaults :
7885 run :
@@ -97,21 +104,21 @@ jobs:
97104 run : find . -mindepth 1 -delete
98105 working-directory : ${{ github.workspace }}
99106 - name : Checkout
100- uses : actions/checkout@v2
107+ uses : actions/checkout@v3
101108 with :
102109 submodules : true
103110 fetch-depth : 0
104111 - name : Setup Environment variables
105112 run : if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
106113 - name : Download a wheel accordingly to matrix
107- uses : actions/download-artifact@v2
114+ uses : actions/download-artifact@v3
108115 with :
109116 name : wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
110117 path : wheelhouse/
111118 - name : Package installation and run tests
112119 run : source scripts/install.sh
113120
114- build_sdist :
121+ Build_sdist :
115122 runs-on : ubuntu-20.04
116123 defaults :
117124 run :
@@ -127,7 +134,7 @@ jobs:
127134 env :
128135 ACTIONS_ALLOW_UNSECURE_COMMANDS : true
129136 REPO_DIR : .
130- BUILD_COMMIT : master
137+ BUILD_COMMIT : ${{ github.ref }}
131138 PROJECT_SPEC : opencv-python
132139 PLAT : x86_64
133140 MB_PYTHON_VERSION : ${{ matrix.python-version }}
@@ -142,20 +149,25 @@ jobs:
142149 SDIST : ${{ matrix.build_sdist || 0 }}
143150 ENABLE_HEADLESS : ${{ matrix.without_gui || 0 }}
144151 ENABLE_CONTRIB : ${{ matrix.with_contrib || 0 }}
152+ ENABLE_ROLLING : 1
145153 steps :
146154 - name : Cleanup
147155 run : find . -mindepth 1 -delete
148156 working-directory : ${{ github.workspace }}
157+ - name : Setup environment
158+ run : |
159+ if [[ "${{ github.event.pull_request }}" == "true" ]]; then
160+ echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
161+ elif [[ "${{ github.event_name }}" == "schedule" ]]; then
162+ echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
163+ fi
149164 - name : Checkout
150- uses : actions/checkout@v2
165+ uses : actions/checkout@v3
151166 with :
152167 submodules : false
153168 fetch-depth : 0
154- - name : Update submodules
155- if : github.event_name == 'pull_request'
156- run : git submodule update --remote
157169 - name : Set up Python ${{ matrix.python-version }}
158- uses : actions/setup-python@v2
170+ uses : actions/setup-python@v4
159171 with :
160172 python-version : ${{ matrix.python-version }}
161173 architecture : ${{ matrix.platform }}
@@ -172,21 +184,51 @@ jobs:
172184 set -x
173185 echo "skipping tests because of sdist"
174186 - name : saving artifacts
175- uses : actions/upload-artifact@v2
187+ uses : actions/upload-artifact@v3
176188 with :
177189 name : wheels
178190 path : dist/opencv*.tar.gz
179191
180- test_release_opencv_python :
192+ Release_rolling :
193+ if : ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
194+ needs : [Build, Build_sdist, Test]
195+ runs-on : ubuntu-20.04
196+ environment : opencv-python-rolling-release
197+ defaults :
198+ run :
199+ shell : bash
200+ steps :
201+ - uses : actions/download-artifact@v3
202+ with :
203+ name : wheels
204+ path : wheelhouse/
205+ - name : Upload wheels for opencv_python_rolling
206+ run : |
207+ python -m pip install twine
208+ python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* wheelhouse/opencv-python-rolling-[^h]*
209+ - name : Upload wheels for opencv_contrib_python_rolling
210+ run : |
211+ python -m pip install twine
212+ python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* wheelhouse/opencv-contrib-python-rolling-[^h]*
213+ - name : Upload wheels for opencv_python_headless_rolling
214+ run : |
215+ python -m pip install twine
216+ python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* wheelhouse/opencv-python-headless-rolling-*
217+ - name : Upload wheels for opencv_contrib_python_headless_rolling
218+ run : |
219+ python -m pip install twine
220+ python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* wheelhouse/opencv-contrib-python-headless-rolling-*
221+
222+ Pre-release :
181223 if : github.event_name == 'release' && github.event.release.prerelease
182- needs : [build, build_sdist, test ]
224+ needs : [Build, Build_sdist, Test ]
183225 runs-on : ubuntu-20.04
184226 environment : test-opencv-python-release
185227 defaults :
186228 run :
187229 shell : bash
188230 steps :
189- - uses : actions/download-artifact@v2
231+ - uses : actions/download-artifact@v3
190232 with :
191233 name : wheels
192234 path : wheelhouse/
@@ -195,16 +237,16 @@ jobs:
195237 python -m pip install twine
196238 python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* wheelhouse/opencv-*
197239
198- release_opencv_python :
240+ Release :
199241 if : github.event_name == 'release' && !github.event.release.prerelease
200- needs : [build, build_sdist, test ]
242+ needs : [Build, Build_sdist, Test ]
201243 runs-on : ubuntu-20.04
202244 environment : opencv-python-release
203245 defaults :
204246 run :
205247 shell : bash
206248 steps :
207- - uses : actions/download-artifact@v2
249+ - uses : actions/download-artifact@v3
208250 with :
209251 name : wheels
210252 path : wheelhouse/
0 commit comments