cuda-mtが非推奨であると追記。 ( #734 ) #600
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Linux Packages | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - linux | |
| - ffmpeg5 | |
| tags: | |
| - '*' | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - dockerimg: ubuntu2004_cuda11 | |
| pkgtype: deb | |
| arch: x86_64 | |
| - dockerimg: fedora39_cuda12 | |
| pkgtype: rpm | |
| arch: x86_64 | |
| #- dockerimg: ubuntu2204_cuda11_aarch64 | |
| # pkgtype: deb | |
| # arch: arm64 | |
| env: | |
| DOCKER_IMAGE: ${{ matrix.dockerimg }} | |
| PKG_TYPE: ${{ matrix.pkgtype }} | |
| BASE_IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/nvenc-build | |
| FFMPEG_PREFIX: /opt/build_scripts/ffmpeg_dll/build_dll/x64/build | |
| 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") | |
| NPROC=$(grep 'processor' /proc/cpuinfo | wc -l) | |
| OUTPUT_DIR=`pwd`/output | |
| LOCAL_USER_ID=$(id -u) | |
| LOCAL_GROUP_ID=$(id -g) | |
| BASE_IMAGE="${{ env.BASE_IMAGE_REPO }}:${{ env.DOCKER_IMAGE }}" | |
| echo "base_image=${BASE_IMAGE}" >> $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: Verify tag matches VER_STR_FILEVERSION | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| cd ${{ github.workspace }} | |
| TAG=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g") | |
| VER=$(sed -n 's/^#define VER_STR_FILEVERSION[ \t]*"\([^"]*\)".*$/\1/p' NVEncCore/rgy_version.h | tr -d '\r\n') | |
| if [ "$TAG" = "$VER" ] || [ "${TAG#v}" = "$VER" ]; then | |
| echo "Version OK: tag=${TAG}, header=${VER}" | |
| else | |
| echo "ERROR: Tag version (${TAG}) does not match VER_STR_FILEVERSION (${VER})" >&2 | |
| exit 1 | |
| fi | |
| - name: Checkout dependencies | |
| run: | | |
| git clone --depth 1 https://github.com/AviSynth/AviSynthPlus.git AviSynthPlus | |
| git clone -b R72 --depth 1 https://github.com/vapoursynth/vapoursynth.git vapoursynth | |
| - name: Pull base image | |
| run: docker pull ${{ steps.prep.outputs.base_image }} | |
| - 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 run -dit --rm \ | |
| -v ${{ github.workspace }}:/work \ | |
| -v ${{ steps.prep.outputs.output_dir }}:/output \ | |
| -u "$(id -u):$(id -g)" \ | |
| --workdir /work \ | |
| --name build_pkg ${{ steps.prep.outputs.base_image }} | |
| docker exec build_pkg bash -lc ' | |
| FFPKG="${{ env.FFMPEG_PREFIX }}/lib/pkgconfig:${{ env.FFMPEG_PREFIX }}/lib/x86_64-linux-gnu/pkgconfig" | |
| export PKG_CONFIG_PATH="${FFPKG}${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}" | |
| meson setup ./build . --buildtype=release -Db_lto=true -Dcpp_args="['\''-I/work/AviSynthPlus/avs_core/include'\'','\''-I/work/vapoursynth/include'\'']" | |
| ' | |
| docker exec build_pkg bash -lc "meson compile -C ./build -j${{ steps.prep.outputs.nproc }}" | |
| docker exec build_pkg bash -lc ' | |
| set -e | |
| ldd ./build/nvencc | tee /tmp/nvencc.ldd | |
| if grep -F "=> not found" /tmp/nvencc.ldd | grep -Fv "libcuda.so.1 => not found" >/dev/null; then | |
| echo "Unexpected missing shared libraries detected." >&2 | |
| exit 1 | |
| fi | |
| ' | |
| docker exec build_pkg bash -lc ' | |
| set -e | |
| if [[ "${{ matrix.dockerimg }}" == ubuntu* ]]; then | |
| mkdir -p /tmp/nvenc-cuda-stubs | |
| ln -sf /usr/local/cuda/targets/x86_64-linux/lib/stubs/libcuda.so /tmp/nvenc-cuda-stubs/libcuda.so.1 | |
| export LD_LIBRARY_PATH="/tmp/nvenc-cuda-stubs:/usr/local/cuda/targets/x86_64-linux/lib/stubs${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" | |
| fi | |
| ./build/nvencc --version | |
| ./check_options.py -exe ./build/nvencc | |
| ' | |
| docker exec build_pkg cp ./build/nvencc ./nvencc | |
| docker exec build_pkg ./build_${{ env.PKG_TYPE }}.sh | |
| docker exec build_pkg bash -lc "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 }} |