Skip to content

ci: add squashfs build jobs #68

ci: add squashfs build jobs

ci: add squashfs build jobs #68

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_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-directory
path: dist/*.whl
build_squashfs_image_amd64:
runs-on: ubuntu-latest
needs: build_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_packages.outputs.OTACLIENT_WHL }}
version: ${{ needs.build_packages.outputs.OTACLIENT_VERSION }}
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-directory
path: dist/*.squashfs
build_squashfs_image_arm64:
runs-on: ubuntu-latest
needs: build_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_packages.outputs.OTACLIENT_WHL }}
version: ${{ needs.build_packages.outputs.OTACLIENT_VERSION }}
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-directory
path: dist/*.squashfs
calculate_checksum:
runs-on: ubuntu-latest
needs: [build_squashfs_image_amd64, build_squashfs_image_arm64]
steps:
- name: download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts-directory
path: dist
- name: calculate checksum
run: |
for WHL in dist/*.whl; \
do \
sha256sum ${WHL} | sed -E "s@(\w+)\s+.*@sha256:\1@" > \
${WHL}.checksum; \
done
for SQUASHFS in dist/*.squashfs; \
do \
sha256sum ${SQUASHFS} | sed -E "s@(\w+)\s+.*@sha256:\1@" > \
${SQUASHFS}.checksum; \
done
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-directory
path: dist/*.checksum
publish_release_artifacts:
runs-on: ubuntu-latest
needs: calculate_checksum
steps:
- name: download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts-directory
path: dist
- name: debug
run: |
ls -l dist