Skip to content

Minimal BPI-R4 test · sd · 24.10 #2

Minimal BPI-R4 test · sd · 24.10

Minimal BPI-R4 test · sd · 24.10 #2

name: BPI-R4-Minimal-MTK-Bootloader-Test
run-name: Minimal BPI-R4 test · ${{ inputs.media }} · ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
media:
description: "Boot medium to validate (sd or emmc)"
required: false
type: string
default: "sd"
upload_source:
description: "Upload source archive before build"
required: false
type: boolean
default: false
permissions:
contents: read
concurrency:
group: bpi-r4-minimal-${{ github.ref }}-${{ inputs.media }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-24.04
if: github.event.repository.owner.id == github.event.sender.id
env:
seed: BPI-R4-MINIMAL
steps:
- name: Resolve media-specific variables
shell: bash
run: |
media=$(echo "${{ inputs.media }}" | tr 'A-Z' 'a-z' | xargs)
case "$media" in
sd)
echo "bundle_kind=sd" >> "$GITHUB_ENV"
echo "gpt_layout=bpi-r4-sd-ab.json" >> "$GITHUB_ENV"
;;
emmc)
echo "bundle_kind=emmc" >> "$GITHUB_ENV"
echo "gpt_layout=bpi-r4-emmc-8g-ab.json" >> "$GITHUB_ENV"
;;
*)
echo "Unsupported media: $media" >&2
exit 2
;;
esac
echo "media=$media" >> "$GITHUB_ENV"
- name: Show system info
run: |
echo -e "Total CPU cores\t: $(nproc)"
grep 'model name' /proc/cpuinfo | head -n 4
df -h
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
swap-size-mb: 2048
temp-reserve-mb: 128
root-reserve-mb: 1024
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
- name: Checkout
uses: actions/checkout@v4
- name: Init build dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo rm -rf /var/lib/apt/lists/* || true
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL || true
sudo -E apt-get -o Acquire::Languages=none -qq update
sudo -E apt-get -y -qq --no-install-recommends install asciidoc bash bin86 binutils bison bzip2 clang llvm file flex g++ g++-multilib gawk gcc-multilib gettext git gzip help2man intltool jq libbpf-dev libelf-dev libncurses-dev libssl-dev libthread-queue-any-perl libusb-dev libxml-parser-perl make patch perl-modules pkg-config python3-dev python3-pip python3-pyelftools python3-setuptools rsync sharutils swig time unzip util-linux wget xsltproc xz-utils zlib1g-dev zip zstd dwarves dos2unix npm quilt
sudo -E npm install -g pnpm
pip3 install --user -U pylibfdt --break-system-packages
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo -E git config --global user.name 'GitHub Actions'
sudo -E git config --global user.email 'noreply@github.com'
df -h
- name: Prepare minimal sources
run: |
sudo chown -R runner:runner "$(dirname "$GITHUB_WORKSPACE")"
cp -r ./SCRIPTS/BPI-R4/. ./SCRIPTS/
cp -r ./SCRIPTS/. ./
/bin/bash 01_get_ready_minimal.sh
- name: Prepare minimal package set
working-directory: ${{ github.workspace }}/openwrt
env:
BPI_R4_GPT_LAYOUT: ${{ env.gpt_layout }}
run: |
cp -r ../SCRIPTS/. ./
/bin/bash 02_prepare_package_minimal.sh
/bin/bash 02_target_only_minimal.sh
- name: Seed minimal config
working-directory: ${{ github.workspace }}/openwrt
run: |
cp -rf ../SEED/${{ env.seed }}/config.seed .config
- name: Make defconfig
working-directory: ${{ github.workspace }}/openwrt
run: make defconfig
- name: Archive source
if: inputs.upload_source
run: tar -cf openwrt-source-minimal-${{ env.media }}-${{ github.run_id }}.tar openwrt
- name: Upload source archive
if: inputs.upload_source
uses: actions/upload-artifact@v4
with:
name: openwrt-source-minimal-${{ env.media }}-${{ github.run_id }}
path: openwrt-source-minimal-${{ env.media }}-${{ github.run_id }}.tar
retention-days: 5
- name: Make download
working-directory: ${{ github.workspace }}/openwrt
run: make download -j$(($(nproc) + 1))
- name: Compile minimal OpenWrt
working-directory: ${{ github.workspace }}/openwrt
id: compile
continue-on-error: true
run: IGNORE_ERRORS=1 make -j$(($(nproc) + 1))
- name: Print verbose failure log
if: steps.compile.outcome == 'failure'
working-directory: ${{ github.workspace }}/openwrt
run: |
cat .config
echo '================================================================'
make -j1 V=s
- name: Upload build artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: bpi-r4-minimal-${{ env.media }}-${{ github.run_id }}
path: |
openwrt/.config
openwrt/bin/targets/mediatek/filogic/*
if-no-files-found: warn
retention-days: 7