Skip to content

Commit 1c44d2b

Browse files
feat: 添加自定义构建模板
1 parent dea58ae commit 1c44d2b

File tree

2 files changed

+70
-2
lines changed

2 files changed

+70
-2
lines changed

.github/workflows/build_wheels_linux.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
echo "========== Build Args =========="
2929
echo "opencv-python version: ${version}"
3030
31-
gh release view ${version} -R ${{ github.repository }} | grep opencv.*.whl >/dev/null 2>&1 || echo "build=1" >> $GITHUB_ENV
31+
gh release view ${version} -R ${{ github.repository }} | grep opencv.*.whl >/dev/null 2>&1 || echo "build=1" >> $GITHUB_OUTPUT
3232
env:
3333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3434

@@ -80,6 +80,8 @@ jobs:
8080
uses: docker/setup-qemu-action@v3
8181
- name: Build a package
8282
run: source scripts/build.sh
83+
env:
84+
DOCKER_DEFAULT_PLATFORM: linux/loong64
8385
- name: Saving a wheel accordingly to matrix
8486
uses: actions/upload-artifact@v4
8587
with:
@@ -98,10 +100,12 @@ jobs:
98100
steps:
99101
- uses: actions/download-artifact@v4
100102
with:
101-
name: wheels
103+
pattern: wheel-*
102104
path: wheelhouse/
105+
merge-multiple: true
103106
- name: Upload wheels
104107
run: |
108+
ls -al wheelhouse/
105109
pip install twine==6.0.1
106110
for file in wheelhouse/*.whl; do
107111
twine upload --repository-url https://gitlab.com/api/v4/projects/65746188/packages/pypi $file || true
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Custom build
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Build with specific tag'
8+
required: true
9+
default: ''
10+
11+
jobs:
12+
Build:
13+
name: Build with_contrib ${{ matrix.with_contrib }} without_gui ${{ matrix.without_gui }}
14+
runs-on: ubuntu-22.04
15+
defaults:
16+
run:
17+
shell: bash
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: ['3.9']
22+
platform: [x64]
23+
with_contrib: [0, 1]
24+
without_gui: [0, 1]
25+
build_sdist: [0]
26+
env:
27+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
28+
REPO_DIR: .
29+
PROJECT_SPEC: opencv-python
30+
MB_PYTHON_VERSION: ${{ matrix.python-version }}
31+
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
32+
MB_ML_VER: _2_38
33+
TRAVIS_BUILD_DIR: ${{ github.workspace }}
34+
CONFIG_PATH: travis_config.sh
35+
DOCKER_IMAGE: ghcr.io/loong64/opencv-python-manylinux_2_38-loongarch64:latest
36+
USE_CCACHE: 0
37+
UNICODE_WIDTH: 32
38+
PLAT: loongarch64
39+
SDIST: ${{ matrix.build_sdist || 0 }}
40+
ENABLE_HEADLESS: ${{ matrix.without_gui }}
41+
ENABLE_CONTRIB: ${{ matrix.with_contrib }}
42+
VERSION: ${{ github.event.inputs.tag }}
43+
steps:
44+
- name: Cleanup
45+
run: find . -mindepth 1 -delete
46+
working-directory: ${{ github.workspace }}
47+
- name: Checkout
48+
uses: actions/checkout@v3
49+
with:
50+
repository: opencv/opencv-python
51+
ref: ${{ env.VERSION }}
52+
submodules: false
53+
fetch-depth: 0
54+
- name: Setup QEMU
55+
uses: docker/setup-qemu-action@v3
56+
- name: Build a package
57+
run: source scripts/build.sh
58+
env:
59+
DOCKER_DEFAULT_PLATFORM: linux/loong64
60+
- name: Saving a wheel accordingly to matrix
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
64+
path: wheelhouse/opencv*.whl

0 commit comments

Comments
 (0)