-
Notifications
You must be signed in to change notification settings - Fork 60
140 lines (120 loc) · 4.02 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# On a push to any branch this workflow:
# - builds the Docker image,
# - build wheels for different Python versions,
# - installs the wheel for each Python version and runs the unit tests.
name: ci
on:
push:
workflow_dispatch:
jobs:
build_docker:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and export
uses: docker/build-push-action@v6
with:
context: .
tags: mv-extractor:local
outputs: type=docker,dest=/tmp/image.tar
cache-from: type=registry,ref=lubo1994/mv-extractor:buildcache
cache-to: type=registry,ref=lubo1994/mv-extractor:buildcache,mode=max
- name: Upload Docker image as artifact
uses: actions/upload-artifact@v4
with:
name: mv-extractor-docker-image
path: /tmp/image.tar
test_docker:
name: Run unit tests in Docker container (only for the Python version used in the Dockerfile command)
runs-on: ubuntu-latest
needs: build_docker
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact containing Docker image
uses: actions/download-artifact@v4
with:
name: mv-extractor-docker-image
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/image.tar
- name: Run unit tests
run: |
docker run -v ${{ github.workspace }}:/home/video_cap \
mv-extractor:local \
python3.10 tests/tests.py
build_and_test_wheels:
name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }}
runs-on: ${{ matrix.os }}
needs:
- build_docker
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python: 39
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: mv-extractor:local
- os: ubuntu-latest
python: 310
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: mv-extractor:local
- os: ubuntu-latest
python: 311
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: mv-extractor:local
- os: ubuntu-latest
python: 312
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: mv-extractor:local
- os: ubuntu-latest
python: 313
bitness: 64
platform_id: manylinux_x86_64
manylinux_image: mv-extractor:local
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact containing Docker image
uses: actions/download-artifact@v4
with:
name: mv-extractor-docker-image
path: /tmp
- name: Load Docker image
run: |
docker load --input /tmp/image.tar
- name: Build and test wheels
uses: pypa/[email protected]
env:
CIBW_PLATFORM: linux
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
# Disable building PyPy wheels on all platforms
CIBW_SKIP: pp*
CIBW_ARCHS: x86_64
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
#CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_BUILD_FRONTEND: build
CIBW_TEST_COMMAND: VIDEO_URL={project}/vid_h264.mp4 python3 {project}/tests/tests.py
CIBW_BUILD_VERBOSITY: 1
- uses: actions/upload-artifact@v4
with:
name: python-wheel-${{ matrix.python }}
path: ./wheelhouse/*.whl