Build misc packages #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build misc packages | |
on: | |
# Allow manual runs of workflow from Actions tab | |
workflow_dispatch: | |
inputs: | |
packages: | |
description: Packages to build | |
required: true | |
type: choice | |
options: | |
- all | |
- iw | |
- wlanpi-linux-firmware | |
- iperf2 | |
- iperf3 | |
- wavemon | |
- wpasupplicant | |
- hostapd | |
default: all | |
jobs: | |
matrix-prep: | |
runs-on: ubuntu-24.04-arm | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- id: set-matrix | |
run: | | |
if [ "${{ github.event.inputs.packages }}" = "all" ]; then | |
echo 'matrix={"package": ["iw", "wlanpi-linux-firmware", "iperf2", "iperf3", "wavemon", "wpasupplicant", "hostapd"], "distro": ["bullseye", "bookworm"], "arch": ["arm64"]}' >> $GITHUB_OUTPUT | |
else | |
echo 'matrix={"package": ["${{ github.event.inputs.packages }}"], "distro": ["bullseye", "bookworm"], "arch": ["arm64"]}' >> $GITHUB_OUTPUT | |
fi | |
build: | |
needs: matrix-prep | |
name: Build package ${{ matrix.package }}+${{ matrix.distro }}+${{ matrix.arch }} | |
runs-on: ubuntu-24.04-arm | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.matrix-prep.outputs.matrix)}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9 | |
sudo apt-get update -yqq | |
sudo apt-get install -yqq --no-install-recommends \ | |
git bc bison flex libssl-dev make libc6-dev libncurses5-dev devscripts \ | |
libdistro-info-perl | |
sudo apt-get install -yqq --no-install-recommends \ | |
crossbuild-essential-armhf crossbuild-essential-arm64 | |
- name: Build package ${{ matrix.package }} | |
id: build-package | |
run: | | |
./package.sh --arch=${{ matrix.arch }} --package=${{ matrix.package }} --distro=${{ matrix.distro }} | |
- name: Check debootstrap logs | |
if: failure() | |
run: | | |
for distro in bullseye bookworm; do | |
logfile="/srv/chroot/${distro}-${{ matrix.arch }}-sbuild/debootstrap/debootstrap.log" | |
if [ -f "$logfile" ]; then | |
echo "=== $distro logs ===" | |
cat "$logfile" | |
fi | |
done | |
- name: Upload debootstrap logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debootstrap-${{ matrix.package }}-${{ matrix.distro }}-${{ matrix.arch }}-logs | |
path: /srv/chroot/${{ matrix.distro }}-${{ matrix.arch }}-sbuild/debootstrap/debootstrap.log | |
- name: Upload package ${{ matrix.package }} to GitHub | |
uses: actions/upload-artifact@v4 | |
if: ${{ steps.build-package.outputs.deb-package != '' }} | |
with: | |
name: ${{ matrix.package }}-${{ matrix.arch }}-${{ matrix.distro }}-${{ steps.build-package.outputs.package-version }} | |
path: ${{ steps.build-package.outputs.deb-package }} | |
- name: Upload arm64 package to packagecloud debian/${{ matrix.distro }} | |
if: ${{ matrix.arch == 'arm64' && (github.repository_owner == 'WLAN-Pi') && (! github.event.pull_request.head.repo.fork) }} | |
uses: danielmundi/upload-packagecloud@main | |
with: | |
package-name: ${{ steps.build-package.outputs.deb-package }} | |
packagecloud-username: wlanpi | |
packagecloud-repo: dev | |
packagecloud-distrib: debian/${{ matrix.distro }} | |
packagecloud-token: ${{ secrets.PACKAGECLOUD_TOKEN }} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
if: ${{ steps.build-package.outputs.deb-package != '' && (github.repository_owner == 'WLAN-Pi') && (! github.event.pull_request.head.repo.fork) }} | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
add-paths: debians | |
branch: update-changelog | |
branch-suffix: timestamp | |
delete-branch: true | |
title: Update changelog for ${{ matrix.package }} version ${{ steps.build-package.outputs.package-version }} | |
body: Package ${{ matrix.package }} built on version ${{ steps.build-package.outputs.package-version }}. | |
assignees: danielmundi | |
slack-workflow-status: | |
if: ${{ always() && (github.repository_owner == 'WLAN-Pi') && (! github.event.pull_request.head.repo.fork) }} | |
name: Post Workflow Status to Slack | |
needs: | |
- build | |
runs-on: ubuntu-24.04-arm | |
steps: | |
- name: Slack Workflow Notification | |
uses: Gamesight/slack-workflow-status@master | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} |