Skip to content

Commit 1bec4af

Browse files
Add loongarch64-linux support
Signed-off-by: 吴小白 <[email protected]>
1 parent 7a652f4 commit 1bec4af

File tree

5 files changed

+2801
-1
lines changed

5 files changed

+2801
-1
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Auto detect text files and perform LF normalization
2-
* text=auto
2+
* text=lf
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build manywheel docker images
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: 0 0 * * *
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check version
13+
run: |
14+
version=$(curl -s "https://api.github.com/repos/opencv/opencv-python/releases/latest" | jq -r .tag_name)
15+
if [ -z "${version}" ] || [ "${version}" == "null" ]; then
16+
echo "Failed to get version"
17+
exit 1
18+
fi
19+
20+
echo "version=${version}" >> $GITHUB_ENV
21+
echo ""
22+
echo "========== Build Args =========="
23+
echo "opencv-python version: ${version}"
24+
25+
- name: Check release
26+
run: |
27+
gh release view ${version} -R ${{ github.repository }} >/dev/null 2>&1 || echo "build=1" >> $GITHUB_ENV
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- uses: actions/checkout@v4
32+
if: env.build == '1'
33+
- uses: docker/setup-qemu-action@v3
34+
if: env.build == '1'
35+
- uses: docker/setup-buildx-action@v3
36+
if: env.build == '1'
37+
38+
- name: Generate files
39+
if: env.build == '1'
40+
run: |
41+
mkdir -p docker/manylinux_2_38
42+
cd docker/manylinux_2_38
43+
wget -qO Dockerfile_loongarch64 https://github.com/opencv/opencv-python/raw/refs/tags/${version}/docker/manylinux2014/Dockerfile_aarch64
44+
sed -i "[email protected]/opencv-ci/[email protected]/loong64/manylinux_2_38_loongarch64@g" Dockerfile_loongarch64
45+
sed -i "s@cp /usr/include/lapacke@# cp /usr/include/lapacke@g" Dockerfile_loongarch64
46+
sed -i 's/epel-release//g' Dockerfile_loongarch64
47+
48+
image_tag=$(cat Dockerfile_loongarch64 | grep "Version:" | sed 's/# Version: //')
49+
echo "image_tag=${image_tag}" >> $GITHUB_ENV
50+
51+
- name: Login to GitHub Container Registry
52+
uses: docker/login-action@v3
53+
with:
54+
registry: ghcr.io
55+
username: ${{ github.repository_owner }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Build and push image
59+
if: env.build == '1'
60+
uses: docker/build-push-action@v6
61+
with:
62+
context: docker/manylinux_2_38
63+
platforms: linux/loong64
64+
push: true
65+
tags: |
66+
ghcr.io/${{ github.repository_owner }}/opencv-python-manylinux_2_38-loongarch64:${{ env.image_tag }}
67+
ghcr.io/${{ github.repository_owner }}/opencv-python-manylinux_2_38-loongarch64:latest
68+
cache-from: ghcr.io/${{ github.repository_owner }}/opencv-python-manylinux_2_38-loongarch64:latest
69+
70+
- name: Create tag
71+
if: env.build == '1'
72+
run: |
73+
git config --global user.name "github-actions[bot]"
74+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
75+
git add .
76+
git commit -m "Update to ${version}" || true
77+
git tag ${version} || true
78+
git push origin ${version} || true
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
82+
- name: Release
83+
uses: softprops/action-gh-release@v2
84+
with:
85+
repository: ${{ github.repository }}
86+
tag_name: ${{ env.version }}

0 commit comments

Comments
 (0)