I have a CI/CD workflow on GitHub Actions.
The pipeline performs tests and builds, and it should upload a release file if a tag was created.
However, there’s a problem: the size of the release.zip is 3.5GB (after the build process), and as it’s well-known, each file in GitHub Releases must be 2GB or less. The main reason for this large size is one file which is 3.3GB. This file must be available locally on every machine that installs the application.
Here are some details about the app:
-
It’s a Python application for Windows desktop.
-
The build process uses the PyInstaller library.
-
The build process includes the problematic file to be built into the app.
-
There is no server or cloud the app is connected to.
-
The problematic file was originally about 9GB, and after compression, its size is 3.3GB.
-
The problematic file is stored with LFS.
Here is the relevant job from the workflow:
build:
needs: test
runs-on: windows-latest
steps:
# Checkout
- uses: actions/checkout@v4
with:
lfs: true
# LFS
- name: Install Git LFS
run: |
choco install git-lfs
- name: Pull lfs files
run: |
git lfs pull
# Python install
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
# PyInstaller build
- name: Build
run: |
cd ..
mkdir build
cd build
python -m pip install --upgrade pip
pip install pyinstaller
python -m pip install -r ..requirements.txt
pyinstaller ..prod.spec
xcopy /E /I .distgui ..gui
cd ..
dir
# Release
- name: Extract Tag Name
id: extract_tag_name
run: |
$tagName = $Env:GITHUB_REF -replace 'refs/tags/', ''
Write-Host "::set-output name=tag_name::$tagName"
# Zip the output folder
- name: Zip folder
if: steps.extract_tag_name.outputs.tag_name != null && steps.extract_tag_name.outputs.tag_name != 'refs/heads/main'
run: |
7z a -r release.zip ./gui/
- name: Create Release
if: steps.extract_tag_name.outputs.tag_name != null && steps.extract_tag_name.outputs.tag_name != 'refs/heads/main'
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.extract_tag_name.outputs.tag_name }}
release_name: Release ${{ steps.extract_tag_name.outputs.tag_name }}
body: Release ${{ steps.extract_tag_name.outputs.tag_name }} created automatically by GitHub Actions.
token: ${{ secrets.ACTION_RELEASE }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.ACTION_RELEASE }}
- name: Upload Release Assets
if: steps.extract_tag_name.outputs.tag_name != null && steps.extract_tag_name.outputs.tag_name != 'refs/heads/main'
id: upload_asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release.zip
asset_name: release.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.ACTION_RELEASE }}
Several solutions have been attempted, but none have resolved the problem:
-
GitHub LFS: Attempted to upload the release.zip to LFS during workflow runtime. However, this approach was unsuccessful as it failed to push. Additionally, there are concerns about the feasibility of pushing LFS during the workflow.
-
Splitting the zip: Tried to split the zip file into partial zip files. Unfortunately, this failed during the workflow due to the actions/upload-release-asset@v1 not supporting multiple files. Moreover, attempting to split files in this manner on my local machine resulted in corrupted files.
-
Maximum compression: Utilized the zip -mx9 option for maximum compression, but this did not alleviate the issue. The output zip file still exceeded 3GB.
user25541605 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.