]> jfr.im git - yt-dlp.git/blobdiff - .github/workflows/build.yml
[build] Make linux binary truly standalone using `conda` (#5423)
[yt-dlp.git] / .github / workflows / build.yml
index 46a775b4db8f621aebd392a5680025e795f7b225..49b9411fddb61114525421cf8f732b773f01aa57 100644 (file)
@@ -50,26 +50,43 @@ jobs:
 
   build_unix:
     needs: prepare
-    runs-on: ubuntu-18.04  # Standalone executable should be built on minimum supported OS
+    runs-on: ubuntu-latest
 
     steps:
     - uses: actions/checkout@v3
     - uses: actions/setup-python@v4
       with:
           python-version: '3.10'
+    - uses: conda-incubator/setup-miniconda@v2
+      with:
+          miniforge-variant: Mambaforge
+          use-mamba: true
+          channels: conda-forge
+          auto-update-conda: true
+          activate-environment: ''
+          auto-activate-base: false
     - name: Install Requirements
       run: |
-          sudo apt-get -y install zip pandoc man
-          python -m pip install --upgrade pip setuptools wheel twine
-          python -m pip install Pyinstaller -r requirements.txt
+          sudo apt-get -y install zip pandoc man sed
+          python -m pip install -U pip setuptools wheel twine
+          python -m pip install -U Pyinstaller -r requirements.txt
+          reqs=$(mktemp)
+          echo -e 'python=3.10.*\npyinstaller' >$reqs
+          sed 's/^brotli.*/brotli-python/' <requirements.txt >>$reqs
+          mamba create -n build --file $reqs
 
     - name: Prepare
       run: |
           python devscripts/update-version.py ${{ needs.prepare.outputs.version_suffix }}
           python devscripts/make_lazy_extractors.py
-    - name: Build Unix executables
+    - name: Build Unix platform-independent binary
       run: |
           make all tar
+    - name: Build Unix standalone binary
+      shell: bash -l {0}
+      run: |
+          unset LD_LIBRARY_PATH  # Harmful; set by setup-python
+          conda activate build
           python pyinst.py --onedir
           (cd ./dist/yt-dlp_linux && zip -r ../yt-dlp_linux.zip .)
           python pyinst.py