8
8
branches :
9
9
- master
10
10
release :
11
- # Only use the types keyword to narrow down the activity types that will trigger your workflow.
12
- types : [published, created, edited]
11
+ types : [published, edited]
13
12
14
13
15
14
jobs :
15
+ build-windows-x86_64 :
16
+ runs-on : ${{ matrix.os }}
17
+ defaults :
18
+ run :
19
+ shell : powershell
20
+
21
+ strategy :
22
+ fail-fast : false
23
+ matrix :
24
+ os : [windows-latest]
25
+ python-version : [3.6, 3.7, 3.8, 3.9]
26
+ platform : [x86, x64]
27
+ with_contrib : [0, 1]
28
+ without_gui : [0, 1]
29
+ build_sdist : [0]
30
+
31
+ env :
32
+ ACTIONS_ALLOW_UNSECURE_COMMANDS : true
33
+ SDIST : ${{ matrix.build_sdist || 0}}
34
+ ENABLE_HEADLESS : ${{ matrix.without_gui }}
35
+ ENABLE_CONTRIB : ${{ matrix.with_contrib }}
36
+
37
+ steps :
38
+ - name : Checkout
39
+ uses : actions/checkout@v2
40
+ with :
41
+ submodules : true
42
+ fetch-depth : 0
43
+
44
+ - name : Update submodules
45
+ run : |
46
+ git submodule update --remote
47
+
48
+ - name : Set up Python ${{ matrix.python-version }}
49
+ uses : actions/setup-python@v2
50
+ with :
51
+ python-version : ${{ matrix.python-version }}
52
+ architecture : ${{ matrix.platform }}
53
+
54
+ - name : Setup MSBuild.exe
55
+ uses : warrenbuckley/Setup-MSBuild@v1
56
+
57
+ - name : build script
58
+ run : |
59
+ python --version
60
+ python -m pip install --upgrade pip
61
+ python -m pip install --upgrade setuptools
62
+ set "CI_BUILD=1" && python -m pip wheel --wheel-dir=%cd%\wheelhouse . --verbose
63
+ shell : cmd
64
+
65
+ - name : before test
66
+ run : |
67
+ cd ${{ github.workspace }}/tests
68
+ $env:PYTHONWARNINGS = "ignore:::pip._internal.cli.base_command"
69
+ &python -m pip install --user --no-warn-script-location (ls "../wheelhouse/opencv*.whl")
70
+ if ($LastExitCode -ne 0) {throw $LastExitCode}
71
+ shell : powershell
72
+
73
+ - name : run test
74
+ run : |
75
+ cd ${{ github.workspace }}/tests
76
+ python -m unittest test
77
+ shell : cmd
78
+
79
+ - name : saving artifacts
80
+ uses : actions/upload-artifact@v2
81
+ with :
82
+ name : wheels
83
+ path : wheelhouse/opencv*.whl
84
+
16
85
build :
17
86
runs-on : ${{ matrix.os }}
18
87
defaults :
@@ -22,17 +91,12 @@ jobs:
22
91
strategy :
23
92
fail-fast : false
24
93
matrix :
25
- os : [windows-latest, ubuntu-latest, macos-latest]
94
+ os : [ubuntu-latest, macos-latest]
26
95
python-version : [3.6, 3.7, 3.8, 3.9]
27
- platform : [x32, x64]
96
+ platform : [x64]
28
97
with_contrib : [0, 1]
29
98
without_gui : [0, 1]
30
99
build_sdist : [0]
31
- exclude :
32
- - os : macos-latest
33
- platform : x32
34
- - os : ubuntu-latest
35
- platform : x32
36
100
37
101
env :
38
102
ACTIONS_ALLOW_UNSECURE_COMMANDS : true
68
132
uses : actions/setup-python@v2
69
133
with :
70
134
python-version : ${{ matrix.python-version }}
135
+ architecture : ${{ matrix.platform }}
71
136
72
137
- name : Setup Environment variables
73
- if : ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
74
138
run : |
75
139
if [ "macos-latest" == "${{ matrix.os }}" ]; then echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV; else echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV; fi
76
140
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
79
143
echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV;
80
144
81
145
- name : before install
82
- if : ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
83
146
run : |
84
147
set -e
85
148
if [[ $SDIST == 0 ]]; then
@@ -123,89 +186,31 @@ jobs:
123
186
#https://travis-ci.community/t/shell-session-update-command-not-found-in-build-log-causes-build-to-fail-if-trap-err-is-set/817
124
187
trap ERR
125
188
test "$rc" -eq 0
126
-
127
- - name : Setup MSBuild.exe
128
- if : ${{ matrix.os == 'windows-latest' }}
129
- uses : warrenbuckley/Setup-MSBuild@v1
130
-
131
- - name : build script
132
- if : ${{ matrix.os == 'windows-latest' }}
133
- run : |
134
- python --version
135
- python -m pip install --upgrade pip
136
- python -m pip install --upgrade setuptools
137
- set "CI_BUILD=1" && python -m pip wheel --wheel-dir=%cd%\dist . --verbose
138
- shell : cmd
139
-
140
- - name : before test
141
- if : ${{ matrix.os == 'windows-latest' }}
142
- run : |
143
- cd ${{ github.workspace }}/tests
144
- $env:PYTHONWARNINGS = "ignore:::pip._internal.cli.base_command"
145
- &python -m pip install --user --no-warn-script-location (ls "../dist/opencv_*.whl")
146
- if ($LastExitCode -ne 0) {throw $LastExitCode}
147
- shell : powershell
148
-
149
- - name : run test
150
- if : ${{ matrix.os == 'windows-latest' }}
151
- run : |
152
- cd ${{ github.workspace }}/tests
153
- python -m unittest test
154
- shell : cmd
155
-
156
189
- name : saving artifacts
157
- if : ${{ matrix.os == 'windows-latest' }}
158
190
uses : actions/upload-artifact@v2
159
191
with :
160
- name : ${{ matrix.os }}- wheels-${{ matrix.python-version }}-${{ matrix.platform }}-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
161
- path : dist\ opencv*.whl
192
+ name : wheels
193
+ path : wheelhouse/ opencv*.whl
162
194
163
- - name : saving artifacts
164
- if : ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
165
- uses : actions/upload-artifact@v2
166
- with :
167
- name : ${{ matrix.os }}-wheels-${{ matrix.python-version }}-${{ matrix.platform }}-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
168
- path : ./wheelhouse/opencv*.whl
169
-
170
-
171
- # - name: Upload wheels ${{ matrix.os }}
172
- # if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
173
- # env:
174
- # # PYPI repository
175
- # TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
176
- # TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
177
- # # PYPITEST repository
178
- # # TWINE_USERNAME: ${{ secrets.PYPITEST_USERNAME }}
179
- # # TWINE_PASSWORD: ${{ secrets.PYPITEST_PASSWORD }}
180
- # # TWINE_REPOSITORY_URL: 'https://test.pypi.org/legacy/'
181
- # run: |
182
- # twine upload --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/*
183
- # # Upload wheels to PYPITEST
184
- # #twine upload --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/*
185
-
186
- # - name: Upload wheels ${{ matrix.os }}
187
- # if: ${{ matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/')}}
188
- # env:
189
- # USER: fXgF9uyy6sT0JoVOR7BoqA==
190
- # PASS: 0bXSOVjf9x8L7nErTivu92TF1FwNosTjFJQPmxp8Dys=
191
- # run: |
192
- # cd ${{ github.workspace }}
193
- # if (${Env:ENABLE_CONTRIB} -eq 0) {
194
- # if (${Env:ENABLE_HEADLESS} -eq 0) {
195
- # echo "This is a default build. Deployment will be done to PyPI entry opencv-python."
196
- # }
197
- # else {
198
- # echo "This is a headless build. Deployment will be done to PyPI entry opencv-python-headless."
199
- # }
200
- # }
201
- # else {
202
- # if (${Env:ENABLE_HEADLESS} -eq 0) {
203
- # echo "This is a contrib build. Deployment will be done to PyPI entry opencv-contrib-python."
204
- # }
205
- # else {
206
- # echo "This is a headless contrib build. Deployment will be done to PyPI entry opencv-contrib-python-headless."
207
- # }
208
- # }
209
- # &python -m pip install twine
210
- # &python -m twine upload -u ${Env:USER} -p ${Env:PASS} --skip-existing dist/opencv*
211
- # shell: powershell
195
+ release :
196
+ if : startsWith(github.ref, 'refs/tags/v')
197
+ needs : [build, build-windows-x86_64]
198
+ runs-on : ubuntu-latest
199
+ defaults :
200
+ run :
201
+ shell : bash
202
+ steps :
203
+ - uses : actions/download-artifact@v2
204
+ with :
205
+ name : wheels
206
+ path : wheelhouse/
207
+
208
+ - name : Upload wheels ${{ matrix.os }}
209
+ if : ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }} && startsWith(github.ref, 'refs/tags/')
210
+ env :
211
+ # PYPI repository credentials
212
+ TWINE_USERNAME : ${{ secrets.PYPI_USERNAME }}
213
+ TWINE_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
214
+ run : |
215
+ python -m pip install twine
216
+ python -m twine upload -u ${Env:TWINE_USERNAME} -p ${Env:TWINE_PASSWORD} --skip-existing wheelhouse/opencv*
0 commit comments