Build and archive WLAN Pi kernel package #5
This file contains hidden or 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 and archive WLAN Pi kernel package | |
| on: | |
| push: | |
| branches: | |
| - 6.12-bookworm | |
| paths: | |
| - 'patches/**' | |
| - 'wlanpi_*_defconfig' | |
| - 'build-kernel*.sh' | |
| workflow_dispatch: | |
| inputs: | |
| build_target: | |
| description: 'Kernel variant to build' | |
| required: true | |
| default: 'both' | |
| type: choice | |
| options: | |
| - both | |
| - v8 | |
| - 2712 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04-arm | |
| env: | |
| DISTRO: bookworm | |
| VERSION_CODENAME: bookworm | |
| KERNEL_TARGET_DISTRO: Debian | |
| KERNEL_TARGET_VERSION: bookworm | |
| # Set BUILD_TARGET from workflow input, default to 'both' for push events | |
| BUILD_TARGET: ${{ github.event.inputs.build_target || 'both' }} | |
| steps: | |
| # Step 1: Checkout the repository | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Step 2: Restore APT cache | |
| - name: Restore APT cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: cache-apt | |
| key: ${{ runner.os }}-apt-${{ hashFiles('**/build-kernel.sh') }} | |
| restore-keys: | | |
| ${{ runner.os }}-apt- | |
| # Step 3: Prepare APT cache for caching | |
| - name: Prepare APT cache for caching | |
| run: | | |
| mkdir -p cache-apt | |
| find /var/cache/apt/archives -path /var/cache/apt/archives/partial -prune -o -type f -name '*.deb' -exec cp {} cache-apt/ \; | |
| # Step 4: Install dependencies | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential git libncurses-dev flex bison libssl-dev \ | |
| bc libelf-dev libudev-dev libpci-dev libiberty-dev autoconf automake libtool \ | |
| libpython3-dev crossbuild-essential-arm64 dpkg-dev gcc-aarch64-linux-gnu | |
| # Step 5: Cache kernel build directory | |
| - name: Cache kernel build directory | |
| uses: actions/cache@v3 | |
| with: | |
| path: linux | |
| key: ${{ runner.os }}-kernel-${{ env.BUILD_TARGET }}-${{ hashFiles('**/build-kernel.sh') }} | |
| restore-keys: | | |
| ${{ runner.os }}-kernel-${{ env.BUILD_TARGET }}- | |
| ${{ runner.os }}-kernel- | |
| # Step 6: Verify Custom Config Files Presence | |
| - name: Verify Custom Config Files Presence | |
| run: | | |
| echo "Verifying presence of kernel config files..." | |
| echo "Build target: $BUILD_TARGET" | |
| # Check which configs are needed based on build target | |
| if [[ "$BUILD_TARGET" == "v8" || "$BUILD_TARGET" == "both" ]]; then | |
| if [ -f wlanpi_v8_defconfig ]; then | |
| echo "✓ wlanpi_v8_defconfig found" | |
| else | |
| echo "ERROR: wlanpi_v8_defconfig not found" | |
| exit 1 | |
| fi | |
| fi | |
| if [[ "$BUILD_TARGET" == "2712" || "$BUILD_TARGET" == "both" ]]; then | |
| if [ -f wlanpi_2712_defconfig ]; then | |
| echo "✓ wlanpi_2712_defconfig found" | |
| else | |
| echo "ERROR: wlanpi_2712_defconfig not found" | |
| exit 1 | |
| fi | |
| fi | |
| # Step 7: Make the build script executable | |
| - name: Make build script executable | |
| run: chmod +x build-kernel.sh | |
| # Step 8: Execute the build script | |
| - name: Execute build script | |
| id: build-kernel | |
| env: | |
| CI: true | |
| run: ./build-kernel.sh | |
| # Step 9: List built packages | |
| - name: List built packages | |
| id: list-packages | |
| run: | | |
| echo "Files in output directory:" | |
| ls -lh output/ | |
| echo "" | |
| echo "Built packages:" | |
| find output -name '*.deb' -type f -exec basename {} \; | |
| # Step 10: Upload v8 kernel package | |
| - name: Upload v8 kernel package | |
| if: ${{ env.BUILD_TARGET == 'v8' || env.BUILD_TARGET == 'both' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wlanpi-kernel-bookworm-v8 | |
| path: output/wlanpi-kernel-bookworm-v8_*.deb | |
| if-no-files-found: warn | |
| # Step 11: Upload v8 headers package | |
| - name: Upload v8 headers package | |
| if: ${{ env.BUILD_TARGET == 'v8' || env.BUILD_TARGET == 'both' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wlanpi-kernel-headers-bookworm-v8 | |
| path: output/wlanpi-kernel-headers-bookworm-v8_*.deb | |
| if-no-files-found: warn | |
| # Step 12: Upload 2712 kernel package | |
| - name: Upload 2712 Kernel Package | |
| if: ${{ env.BUILD_TARGET == '2712' || env.BUILD_TARGET == 'both' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wlanpi-kernel-bookworm-2712 | |
| path: output/wlanpi-kernel-bookworm-2712_*.deb | |
| if-no-files-found: warn | |
| # Step 13: Upload 2712 headers package | |
| - name: Upload 2712 headers package | |
| if: ${{ env.BUILD_TARGET == '2712' || env.BUILD_TARGET == 'both' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wlanpi-kernel-headers-bookworm-2712 | |
| path: output/wlanpi-kernel-headers-bookworm-2712_*.deb | |
| if-no-files-found: warn | |
| # Step 14: Upload dual kernel package | |
| - name: Upload dual kernel package | |
| if: ${{ env.BUILD_TARGET == 'both' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wlanpi-kernel-bookworm-dual | |
| path: output/wlanpi-kernel-bookworm_*.deb | |
| if-no-files-found: warn | |
| 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: "${{ vars.RUNS_ON || 'ubuntu-22.04' }}" | |
| steps: | |
| - name: Slack Workflow Notification | |
| uses: Gamesight/slack-workflow-status@master | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} |