Skip to content

Commit 615f3df

Browse files
authored
Scheduled rolling workflows (#699)
* Scheduled rolling workflows * Fixed a bug in commit/date for package version * Changed the name of Windows pipelines
1 parent 2585d6f commit 615f3df

9 files changed

+345
-120
lines changed

.github/workflows/build_wheels_linux.yml

+69-27
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build PYPI wheels for opencv-python on Linux x86_64
1+
name: Linux x86_64
22

33
on:
44
pull_request:
@@ -13,10 +13,13 @@ on:
1313
- '.github/workflows/build_wheels_macos*'
1414
release:
1515
types: [published, edited]
16+
schedule:
17+
- cron: '0 3 * * 6'
18+
workflow_dispatch:
1619

1720

1821
jobs:
19-
build:
22+
Build:
2023
runs-on: ubuntu-20.04
2124
defaults:
2225
run:
@@ -32,7 +35,7 @@ jobs:
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/

.github/workflows/build_wheels_linux_arm.yml

+62-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build PYPI wheels for opencv-python on Linux ARM
1+
name: Linux ARM64
22

33
on:
44
pull_request:
@@ -13,10 +13,13 @@ on:
1313
- '.github/workflows/build_wheels_macos*'
1414
release:
1515
types: [published, edited]
16+
schedule:
17+
- cron: '0 3 * * 6'
18+
workflow_dispatch:
1619

1720

1821
jobs:
19-
build_arm:
22+
Build:
2023
runs-on: opencv-cn-lin-arm64
2124
defaults:
2225
run:
@@ -32,7 +35,7 @@ jobs:
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 }}
@@ -47,31 +50,36 @@ jobs:
4750
ENABLE_HEADLESS: ${{ matrix.without_gui }}
4851
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
4952
steps:
50-
- name: UID
51-
run: id -u
5253
- name: Cleanup
5354
run: find . -mindepth 1 -delete
5455
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
5563
- name: Checkout
56-
uses: actions/checkout@v2
64+
uses: actions/checkout@v3
5765
with:
5866
submodules: false
5967
fetch-depth: 0
6068
- name: Build a package
6169
run: source scripts/build.sh
6270
- name: Saving all wheels
63-
uses: actions/upload-artifact@v2
71+
uses: actions/upload-artifact@v3
6472
with:
6573
name: wheels
6674
path: wheelhouse/opencv*.whl
6775
- name: Saving a wheel accordingly to matrix
68-
uses: actions/upload-artifact@v2
76+
uses: actions/upload-artifact@v3
6977
with:
7078
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
7179
path: wheelhouse/opencv*.whl
7280

73-
test:
74-
needs: [build_arm]
81+
Test:
82+
needs: [Build]
7583
runs-on: opencv-cn-lin-arm64
7684
defaults:
7785
run:
@@ -88,6 +96,7 @@ jobs:
8896
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
8997
MB_PYTHON_VERSION: ${{ matrix.python-version }}
9098
PLAT: aarch64
99+
BUILD_COMMIT: ${{ github.ref }}
91100
NP_TEST_DEP: numpy==1.19.4
92101
NP_TEST_DEP_LATEST: numpy==1.21.4
93102
CONFIG_PATH: travis_config.sh
@@ -97,31 +106,66 @@ jobs:
97106
- name: Cleanup
98107
run: find . -mindepth 1 -delete
99108
working-directory: ${{ github.workspace }}
109+
- name: Setup environment
110+
run: |
111+
if [[ "${{ github.event.pull_request }}" == "true" ]]; then
112+
echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
113+
fi
100114
- name: Checkout
101-
uses: actions/checkout@v2
115+
uses: actions/checkout@v3
102116
with:
103117
submodules: true
104118
fetch-depth: 0
105119
- name: Setup Environment variables
106120
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
107121
- name: Download a wheel accordingly to matrix
108-
uses: actions/download-artifact@v2
122+
uses: actions/download-artifact@v3
109123
with:
110124
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
111125
path: wheelhouse/
112126
- name: Package installation and run tests
113127
run: source scripts/install.sh
114128

115-
test_release_opencv_python:
129+
Release_rolling:
130+
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
131+
needs: [Build, Test]
132+
runs-on: ubuntu-20.04
133+
environment: opencv-python-rolling-release
134+
defaults:
135+
run:
136+
shell: bash
137+
steps:
138+
- uses: actions/download-artifact@v3
139+
with:
140+
name: wheels
141+
path: wheelhouse/
142+
- name: Upload wheels for opencv_python_rolling
143+
run: |
144+
python -m pip install twine
145+
python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-*
146+
- name: Upload wheels for opencv_contrib_python_rolling
147+
run: |
148+
python -m pip install twine
149+
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-*
150+
- name: Upload wheels for opencv_python_headless_rolling
151+
run: |
152+
python -m pip install twine
153+
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-*
154+
- name: Upload wheels for opencv_contrib_python_headless_rolling
155+
run: |
156+
python -m pip install twine
157+
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-*
158+
159+
Pre-release:
116160
if: github.event_name == 'release' && github.event.release.prerelease
117-
needs: [build_arm, test]
161+
needs: [Build, Test]
118162
runs-on: ubuntu-20.04
119163
environment: test-opencv-python-release
120164
defaults:
121165
run:
122166
shell: bash
123167
steps:
124-
- uses: actions/download-artifact@v2
168+
- uses: actions/download-artifact@v3
125169
with:
126170
name: wheels
127171
path: wheelhouse/
@@ -130,16 +174,16 @@ jobs:
130174
python -m pip install twine
131175
python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_*
132176
133-
release_opencv_python:
177+
Release:
134178
if: github.event_name == 'release' && !github.event.release.prerelease
135-
needs: [build_arm, test]
179+
needs: [Build, Test]
136180
runs-on: ubuntu-20.04
137181
environment: opencv-python-release
138182
defaults:
139183
run:
140184
shell: bash
141185
steps:
142-
- uses: actions/download-artifact@v2
186+
- uses: actions/download-artifact@v3
143187
with:
144188
name: wheels
145189
path: wheelhouse/

0 commit comments

Comments
 (0)