-
Notifications
You must be signed in to change notification settings - Fork 113
120 lines (108 loc) · 4.5 KB
/
build_packages.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
name: Build Linux Packages
on:
push:
branches:
- master
- linux
- ffmpeg5
tags:
- '*'
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- dockerimg: ubuntu2404_cuda12
pkgtype: deb
arch: x86_64
- dockerimg: ubuntu2204_cuda11
pkgtype: deb
arch: x86_64
- dockerimg: ubuntu2004_cuda11
pkgtype: deb
arch: x86_64
- dockerimg: ubuntu1804_cuda10
pkgtype: deb
arch: x86_64
- dockerimg: fedora37_cuda12
pkgtype: rpm
arch: x86_64
- dockerimg: fedora39_cuda12
pkgtype: rpm
arch: x86_64
#- dockerimg: ubuntu2204_cuda11_aarch64
# pkgtype: deb
# arch: arm64
env:
DOCKER_FILE: docker/docker_${{ matrix.dockerimg }}
DOCKER_IMAGE: ${{ matrix.dockerimg }}
PKG_TYPE: ${{ matrix.pkgtype }}
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Prepare
id: prep
run: |
REPOSITORY=$(echo ${{ github.repository }} | sed -e "s#.*/##")
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
IMAGE="build_nvencc_"${{ env.DOCKER_IMAGE }}
TAG=$(echo $GITHUB_SHA | head -c7)
NPROC=$(grep 'processor' /proc/cpuinfo | wc -l)
OUTPUT_DIR=`pwd`/output
LOCAL_USER_ID=$(id -u)
LOCAL_GROUP_ID=$(id -g)
echo "tagged_image=${IMAGE}:${TAG}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "nproc=${NPROC}" >> $GITHUB_OUTPUT
echo "output_dir=${OUTPUT_DIR}" >> $GITHUB_OUTPUT
echo "local_user_id=${LOCAL_USER_ID}" >> $GITHUB_OUTPUT
echo "local_group_id=${LOCAL_GROUP_ID}" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Checkout dependencies
run: |
git clone https://github.com/AviSynth/AviSynthPlus.git AviSynthPlus
git clone https://github.com/vapoursynth/vapoursynth.git vapoursynth
- name: Create Output Dir
run: |
mkdir -p ${{ steps.prep.outputs.output_dir }}
- name: Set up QEMU
if: matrix.arch != 'x86_64'
uses: docker/setup-qemu-action@v3
- name: Build Exec
id: build_exec
run: |
docker build --build-arg LOCAL_USER_ID=${{ steps.prep.outputs.local_user_id }} --build-arg LOCAL_GROUP_ID=${{ steps.prep.outputs.local_group_id }} --tag ${{ steps.prep.outputs.tagged_image }} --platform linux/${{ matrix.arch }} --file ${{ env.DOCKER_FILE }} ./
docker run -dit --rm -v ${{ steps.prep.outputs.output_dir }}:/output -u "$(id -u):$(id -g)" --name build_pkg ${{ steps.prep.outputs.tagged_image }}
docker exec build_pkg sh -c "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal && . ~/.cargo/env && cargo install cargo-c"
docker exec build_pkg sh -c '. ~/.cargo/env && ./configure --extra-cxxflags="-I./AviSynthPlus/avs_core/include -I./vapoursynth/include" --extra-cudaldflags="-L/usr/local/cuda/targets/${{ matrix.arch }}-linux/lib/stubs"'
docker exec build_pkg make -j${{ steps.prep.outputs.nproc }}
# docker exec build_pkg ldd ./nvencc
# docker exec build_pkg ./nvencc --version
# docker exec build_pkg ./check_options.py
docker exec build_pkg ./build_${{ env.PKG_TYPE }}.sh
docker exec build_pkg sh -c "cp -v ./*.${{ env.PKG_TYPE }} /output/"
PKGFILE=`ls ${{ steps.prep.outputs.output_dir }}/*.${{ env.PKG_TYPE }}`
echo ${PKGFILE}
echo "pkgfile=${PKGFILE}" >> $GITHUB_OUTPUT
- name: Calc hash
id: calc_hash
run: |
7z h -scrc* ${{ steps.build_exec.outputs.pkgfile }}
- name: Upload Release Asset
id: upload-release-asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ steps.build_exec.outputs.pkgfile }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nvencc_${{ matrix.dockerimg }}_${{ matrix.pkgtype }}
path: ${{ steps.build_exec.outputs.pkgfile }}