-
Notifications
You must be signed in to change notification settings - Fork 68
137 lines (126 loc) · 4.78 KB
/
release.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
name: Release binaries to github packages
on:
workflow_dispatch:
release:
types:
- created
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
build_and_release:
name: build binaries with ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.py_ver_prefix}}-${{ matrix.device }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
arch: x86_64
py_ver_prefix: cp39
device: cpu
- os: ubuntu-20.04
arch: x86_64
py_ver_prefix: cp39
device: gpu
- os: ubuntu-20.04
arch: i686
py_ver_prefix: cp39
device: cpu
- os: ubuntu-20.04
arch: aarch64
py_ver_prefix: cp39
device: cpu
- os: ubuntu-20.04
arch: s390x
py_ver_prefix: cp39
device: cpu
- os: ubuntu-20.04
arch: ppc64le
py_ver_prefix: cp39
device: cpu
- os: macos-12
arch: x86_64
py_ver_prefix: cp39
device: cpu
- os: macos-12
arch: arm64
py_ver_prefix: cp39
device: cpu
#- os: windows-2019
# arch: AMD64
# py_ver_prefix: cp39
# device: cpu
#- os: windows-2019
# arch: x86
# py_ver_prefix: cp39
# device: cpu
#- os: windows-2019
# arch: ARM64
# py_ver_prefix: cp39
# device: cpu
steps:
- name: Check out source code
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
- name: Set binary name for linux
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y jq
echo BINARY_NAME=bmf-bin-$(echo "${{ runner.os }}" | tr 'A-Z' 'a-z')-${{ matrix.arch }}$(echo '{"gpu": "-gpu", "cpu": ""}' | jq .${{ matrix.device }} | sed 's/"//g')-${{ matrix.py_ver_prefix }} >> $GITHUB_ENV
- name: Set binary name for macos/windows
if: runner.os != 'Linux'
run: |
echo BINARY_NAME=bmf-bin-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.py_ver_prefix }} >> $GITHUB_ENV
echo BMF_PYTHON_VERSION=$(echo ${{ matrix.py_ver_prefix }} | cut -c 3).$(echo ${{ matrix.py_ver_prefix }} | cut -c 4-) >> $GITHUB_ENV
- name: Build linux release package in Docker
if: runner.os == 'Linux'
run: |
tmp_file=$(mktemp -p .)
echo "FROM smartbrave/manylinux2014_${{ matrix.arch }}_shared_python" >>${tmp_file}
echo "RUN curl -fsSL https://autoinstall.plesk.com/PSA_18.0.62/examiners/repository_check.sh | bash -s -- update >/dev/null" >>${tmp_file}
echo "RUN yum -y install binutils-devel openssl-devel" >>${tmp_file}
echo "WORKDIR /root" >>${tmp_file}
echo "ENV PATH=\${PATH}:/opt/python/cp39-cp39/bin" >>${tmp_file}
echo "ENV LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/opt/python/cp39-cp39/lib" >>${tmp_file}
echo "ENV GITHUB_ACTIONS=${GITHUB_ACTIONS}" >>${tmp_file}
if [ "${{ matrix.device }}" == "gpu" ]; then
echo "ENV CUDA_PATH=/usr/local/cuda" >>${tmp_file}
fi
docker build -t bmf_build:tmp -f ${tmp_file} .
rm -rf ${tmp_file}
docker run --rm -v $(pwd):/root/bmf -w /root/bmf bmf_build:tmp bash -c "./scripts/build_ffmpeg.sh --device=${{ matrix.device }} && git config --global --add safe.directory /root/bmf && ./build.sh"
docker rmi bmf_build:tmp
tar czf ${{ env.BINARY_NAME }}.tar.gz --directory=. output
- name: Build macos release package
if: runner.os == 'macOS'
env:
PKG_CONFIG_PATH: "$(pwd)/ffmpeg_${{ matrix.arch }}/lib/pkgconfig"
CMAKE_ARGS: "-DHAVE_STD_REGEX=ON -DRUN_HAVE_STD_REGEX=1"
BMF_PYTHON_VERSION: ${{ env.BMF_PYTHON_VERSION }}
BMF_ARCHITECTURES: ${{ matrix.arch }}
run: |
sed -i '' '/sigma_gn /s/^/\/\//g' bmf/hml/third_party/benchmark/src/complexity.cc
wget https://www.python.org/ftp/python/3.9.13/python-3.9.13-macos11.pkg
sudo installer -pkg python-3.9.13-macos11.pkg -target /
./scripts/build_ffmpeg.sh --arch=${{ matrix.arch }}
./build_osx.sh
tar czf ${{ env.BINARY_NAME }}.tar.gz --directory=. output
- uses: actions/upload-artifact@v3
with:
path: ${{ env.BINARY_NAME }}.tar.gz
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ env.BINARY_NAME }}.tar.gz