feat(kernel): Add PR packaging and artifact upload for testing
All checks were successful
Build kernel module / build (1:6.18.34-1+rpt1, trixie) (pull_request) Successful in 49s
Build kernel module / build (1:6.12.93-1+rpt1, bookworm) (pull_request) Successful in 1m9s
Build kernel module / package (pull_request) Successful in 18s
Build kernel module / release (pull_request) Has been skipped

Enable packaging and artifact upload for pull requests to facilitate
testing. Package job generates a zip archive identical to release
artifacts, allowing smoke tests before final releases. Adjusted naming
for zip files to include PR reference or SHA for traceability.
This commit is contained in:
Christian Werner 2026-06-20 05:36:06 +02:00
parent dafcdfbd7b
commit a5406f503c

View File

@ -99,14 +99,14 @@ jobs:
path: kernel/out path: kernel/out
if-no-files-found: error if-no-files-found: error
# Release flow only: merges all built modules into one modules/ folder, wraps it # Merge all built modules into one modules/ folder, wrap it in a single
# in a single repo-named top folder alongside the helper scripts (selftest.sh, # repo-named top folder alongside the helper scripts (selftest.sh, launch.sh)
# launch.sh) and the iecpoc Python frontend (so launch.sh can pip-install it on # and the iecpoc Python frontend (so launch.sh can pip-install it on the Pi),
# the Pi), zips it and attaches it to the Gitea release for the pushed tag. # and zip it. Runs on BOTH triggers and uploads the zip as an artifact: on a PR
# Skipped entirely on pull requests. # this lets you download and smoke-test the exact archive a release would ship;
release: # on a tag the release job below republishes this same artifact unchanged.
package:
needs: build needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -116,10 +116,20 @@ jobs:
uses: https://github.com/christopherHX/gitea-download-artifact@v4 uses: https://github.com/christopherHX/gitea-download-artifact@v4
with: with:
path: dist path: dist
# Merge every artifact back into the shared modules/ folder. # Merge every per-kernel artifact back into the shared modules/ folder.
merge-multiple: true merge-multiple: true
- name: Assemble release package - name: Determine version label
id: ver
run: |
# Tags ship under the tag name; PR builds get a traceable pr<n>-<sha>.
case "${{ github.ref }}" in
refs/tags/*) v="${{ github.ref_name }}" ;;
*) v="pr${{ github.event.pull_request.number }}-$(echo "${{ github.sha }}" | cut -c1-7)" ;;
esac
echo "ver=$v" >> "$GITHUB_OUTPUT"
- name: Assemble package zip
run: | run: |
repo="${{ github.event.repository.name }}" repo="${{ github.event.repository.name }}"
root="package/$repo" root="package/$repo"
@ -133,11 +143,32 @@ jobs:
cp pyproject.toml README.md "$root"/ cp pyproject.toml README.md "$root"/
cp -r iecpoc "$root"/ cp -r iecpoc "$root"/
find "$root/iecpoc" -name __pycache__ -type d -prune -exec rm -rf {} + find "$root/iecpoc" -name __pycache__ -type d -prune -exec rm -rf {} +
(cd package && zip -r "../${repo}-${{ github.ref_name }}.zip" "$repo") (cd package && zip -r "../${repo}-${{ steps.ver.outputs.ver }}.zip" "$repo")
- name: Upload package zip
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ steps.ver.outputs.ver }}
path: ${{ github.event.repository.name }}-*.zip
if-no-files-found: error
# Release flow only: takes the zip the package job already built and attaches it
# to the Gitea release for the pushed tag. No re-assembly here. Skipped on PRs.
release:
needs: package
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Download package zip
uses: https://github.com/christopherHX/gitea-download-artifact@v4
with:
# The single artifact the package job produced for this tag.
name: ${{ github.event.repository.name }}-${{ github.ref_name }}
path: dist
- name: Publish to Gitea release - name: Publish to Gitea release
uses: https://gitea.com/actions/gitea-release-action@v1.3.6 uses: https://gitea.com/actions/gitea-release-action@v1.3.6
with: with:
api_key: ${{ secrets.GITEA_TOKEN }} api_key: ${{ secrets.GITEA_TOKEN }}
files: |- files: |-
*.zip dist/*.zip