Skip to content

ci: add squashfs build jobs #95

ci: add squashfs build jobs

ci: add squashfs build jobs #95

Workflow file for this run

name: Release CI
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
# NOTE(20241016): this is a workaround for PR with head
# updated by gen_requirements_txt workflow
- review_requested
- assigned
# allow manually triggering the build
workflow_dispatch:
jobs:
build_python_packages:
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
OTACLIENT_WHL: ${{ steps.set_env.outputs.OTACLIENT_WHL }}
OTACLIENT_VERSION: ${{ steps.set_env.outputs.OTACLIENT_VERSION }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
# use the minimum py ver we support to generate the wheel
python-version: 3.8
- name: install build deps
run: |
python -m pip install -U pip
python -m pip install -U hatch
- name: build otaclient package
run: |
hatch build -t wheel
- name: set environment variables
id: set_env
run: |
OTACLIENT_WHL=$(basename $(ls dist/otaclient-*.whl))
OTACLIENT_VERSION=$(echo $OTACLIENT_WHL | sed -E 's/otaclient-([0-9]+\.[0-9]+(\.[0-9]+)?).*\.whl/\1/')
echo "::set-output name=OTACLIENT_WHL::${OTACLIENT_WHL}"
echo "::set-output name=OTACLIENT_VERSION::${OTACLIENT_VERSION}"
- name: build otaclient service API python package
run: |
pushd proto
hatch build -t wheel
popd
cp proto/dist/*.whl dist/
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-python-packages
path: dist/*.whl
build_squashfs_image_amd64:
runs-on: ubuntu-latest
needs: build_python_packages
steps:
- name: checkout
uses: actions/checkout@v4
- name: build squashfs image for amd64
uses: ./.github/actions/build_squashfs_image
with:
platform: linux/amd64
platform_suffix: amd64
base_image: ubuntu:22.04
whl: ${{ needs.build_python_packages.outputs.OTACLIENT_WHL }}
version: ${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}
squashfs: dist/ota-client-amd64-v${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}.squashfs
- name: build patches
uses: ./.github/actions/build_patches
with:
platform_suffix: amd64
version: ${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}
squashfs: dist/ota-client-amd64-v${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}.squashfs
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-squashfs_amd64
path: dist/*.squashfs
build_squashfs_image_arm64:
runs-on: ubuntu-latest
needs: build_python_packages
steps:
- name: checkout
uses: actions/checkout@v4
- name: build squashfs image for arm64
uses: ./.github/actions/build_squashfs_image
with:
platform: linux/arm64
platform_suffix: arm64
base_image: arm64v8/ubuntu:22.04
whl: ${{ needs.build_python_packages.outputs.OTACLIENT_WHL }}
version: ${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}
squashfs: dist/ota-client-arm64-v${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}.squashfs
- name: build paches
uses: ./.github/actions/build_patches
with:
platform_suffix: arm64
version: ${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}
squashfs: dist/ota-client-arm64-v${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}.squashfs
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-squashfs_arm64
path: |
dist/*.squashfs
dist/*.patch
post_build:
runs-on: ubuntu-latest
needs: [build_python_packages, build_squashfs_image_amd64, build_squashfs_image_arm64]
steps:
- name: download python packages artifact
uses: actions/download-artifact@v4
with:
name: artifacts-python-packages
path: dist
- name: download squashfs amd64 artifact
uses: actions/download-artifact@v4
with:
name: artifacts-squashfs_amd64
path: dist
- name: download squashfs arm64 artifact
uses: actions/download-artifact@v4
with:
name: artifacts-squashfs_arm64
path: dist
- name: calculate checksum
run: |
for FILE in dist/*.{whl,squashfs,patch}; do
sha256sum ${FILE} | sed -E "s@(\w+)\s+.*@sha256:\1@" > ${FILE}.checksum
done
- name: debug
run: |
ls -l dist