Skip to content

Commit

Permalink
chore: split asset files bigger than 2GB in the release into chunks o…
Browse files Browse the repository at this point in the history
…f 2GB.
  • Loading branch information
sassanh committed Mar 9, 2024
1 parent 4361e5d commit 29856ba
Show file tree
Hide file tree
Showing 31 changed files with 235 additions and 173 deletions.
89 changes: 56 additions & 33 deletions .github/workflows/integration_delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ jobs:
- uses: actions/checkout@v4
name: Checkout

- name: Save Cached Poetry
id: cached-poetry
uses: actions/cache@v4
with:
path: |
~/.cache
~/.local
key: poetry-${{ hashFiles('poetry.lock') }}

- uses: actions/setup-python@v5
name: Setup Python
with:
Expand All @@ -30,15 +39,6 @@ jobs:
- name: Install dependencies
run: poetry install --extras=dev --with dev

- name: Save Cached Poetry
id: cached-poetry
uses: actions/cache/save@v4
with:
path: |
~/.cache
~/.local
key: poetry-${{ hashFiles('pyproject.toml', 'poetry.lock') }}

type-check:
name: Type Check
needs:
Expand All @@ -61,7 +61,7 @@ jobs:
path: |
~/.cache
~/.local
key: poetry-${{ hashFiles('pyproject.toml', 'poetry.lock') }}
key: poetry-${{ hashFiles('poetry.lock') }}

- name: Create stub files
run: poetry run pyright --createstub kivy
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
path: |
~/.cache
~/.local
key: poetry-${{ hashFiles('pyproject.toml', 'poetry.lock') }}
key: poetry-${{ hashFiles('poetry.lock') }}

- name: Lint
run: poetry run poe lint
Expand All @@ -102,7 +102,8 @@ jobs:
- dependencies
runs-on: ubuntu-latest
outputs:
ubo_app_version: ${{ steps.extract_version.outputs.ubo_app_version }}
version: ${{ steps.extract_version.outputs.version }}
name: ${{ steps.extract_version.outputs.name }}
steps:
- uses: actions/checkout@v4
name: Checkout
Expand All @@ -122,16 +123,16 @@ jobs:
path: |
~/.cache
~/.local
key: poetry-${{ hashFiles('pyproject.toml', 'poetry.lock') }}
key: poetry-${{ hashFiles('poetry.lock') }}

- name: Build
run: poetry build

- name: Extract Version
id: extract_version
run: |
echo "ubo_app_version=$(poetry run python scripts/print_version.py)" >> "$GITHUB_OUTPUT"
echo "ubo_app_version=$(poetry run python scripts/print_version.py)"
echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT"
echo "name=$(poetry version | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: Upload wheel
uses: actions/upload-artifact@v4
Expand All @@ -157,8 +158,8 @@ jobs:
- build
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/p/ubo-app
name: release
url: https://pypi.org/p/${{ needs.build.outputs.name }}
permissions:
id-token: write
steps:
Expand All @@ -177,6 +178,7 @@ jobs:
with:
packages-dir: dist
verbose: true
skip-existing: true

images:
name: Create Images
Expand Down Expand Up @@ -231,7 +233,7 @@ jobs:
- name: Build Artifact
env:
PKR_VAR_ubo_app_version: ${{ needs.build.outputs.ubo_app_version }}
PKR_VAR_ubo_app_version: ${{ needs.build.outputs.version }}
PKR_VAR_image_url: ${{ steps.generate_image_url.outputs.image_url }}
PKR_VAR_image_checksum:
${{ steps.generate_image_url.outputs.image_checksum }}
Expand All @@ -257,8 +259,8 @@ jobs:
uses: actions/upload-artifact@v4
with:
name:
ubo_app-bookworm${{
steps.generate_image_url.outputs.dashed_suffix}}.img.gz
ubo_app-${{ needs.build.outputs.version }}-bookworm${{
steps.generate_image_url.outputs.dashed_suffix}}-arm64.img.gz
path:
/ubo_app-bookworm${{ steps.generate_image_url.outputs.dashed_suffix
}}.img.gz
Expand All @@ -273,30 +275,34 @@ jobs:
- pypi-publish
- images
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/p/${{ needs.build.outputs.name }}
permissions:
contents: write
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Procure Lite Image
uses: actions/download-artifact@v4
with:
name: ubo_app-bookworm-lite.img.gz
name:
ubo_app-${{ needs.build.outputs.version
}}-bookworm-lite-arm64.img.gz
path: artifacts

- name: Procure Default Image
uses: actions/download-artifact@v4
with:
name: ubo_app-bookworm.img.gz
name: ubo_app-${{ needs.build.outputs.version }}-bookworm-arm64.img.gz
path: artifacts

# TODO
# It is larger than 2GB, so it is not possible to upload it to GitHub
# Looking for a solution to this problem
# - name: Procure Full Image
# uses: actions/download-artifact@v4
# with:
# name: ubo_app-bookworm-full.img.gz
# path: artifacts
- name: Procure Full Image
uses: actions/download-artifact@v4
with:
name:
ubo_app-${{ needs.build.outputs.version
}}-bookworm-full-arm64.img.gz
path: artifacts

- name: Procure Wheel
uses: actions/download-artifact@v4
Expand All @@ -310,13 +316,30 @@ jobs:
name: binary
path: artifacts

- name:
Split Large Files into 2GB chunks in a for loop only if they are
bigger than 2GB
run: |
for file in artifacts/*; do
if [ $(stat -c%s "$file") -gt 2000000000 ]; then
split -b 2000000000 "$file" "$file"_
rm "$file"
fi
done
- name: Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/*
tag_name: ${{ needs.build.outputs.ubo_app_version }}
tag_name: ${{ needs.build.outputs.version }}
body: |
Release of version ${{ needs.build.outputs.ubo_app_version }}
PyPI package: https://pypi.org/project/ubo-app/${{ needs.build.outputs.ubo_app_version }}
Release of version ${{ needs.build.outputs.version }}
PyPI package: https://pypi.org/project/${{ needs.build.outputs.name }}/${{ needs.build.outputs.version }}
Note than GitHub doesn't allow assets bigger than 2GB in a release. Due to this, the files bigger than 2GB have been split into 2GB chunks. You can join them using the following command:
```bash
cat [[filename]]_* > [[filename]]
```
prerelease: false
draft: false
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Version 0.10.7

- chore: split asset files bigger than 2GB in the release into chunks of 2GB.
- refactor: general housekeeping

## Version 0.10.6

- fix: wireless module now has sufficient privileges
Expand Down
68 changes: 41 additions & 27 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ubo-app"
version = "0.10.6"
version = "0.10.7"
description = "Ubo main app, running on device initialization. A platform for running other apps."
authors = ["Sassan Haradji <sassanh@gmail.com>"]
license = "Apache-2.0"
Expand All @@ -25,7 +25,7 @@ ubo-gui = [
'dev',
] },
]
python-redux = "^0.9.24"
python-redux = "==0.10.4"
pyzbar = "^0.1.9"
sdbus-networkmanager = { version = "^2.0.0", markers = "platform_machine=='aarch64'" }
rpi_ws281x = { version = "^5.0.0", markers = "platform_machine=='aarch64'" }
Expand All @@ -45,6 +45,7 @@ optional = true
pyright = "^1.1.349"
ruff = "^0.2.1"
toml = "^0.10.2"
python-dotenv = "^1.0.1"

[tool.poetry.extras]
default = ['ubo-gui', 'headless-kivy-pi']
Expand Down
Loading

0 comments on commit 29856ba

Please sign in to comment.