Skip to content

add test ci

add test ci #1

Workflow file for this run

name: Test
on:
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-test:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
need_to_run: ${{ steps.set-matrix.outputs.need_to_run }}
steps:
- name: generate matrix from PR body
id: set-matrix
env:
RAW_BODY: ${{ github.event.pull_request.body }}
run: |
RESULT=`echo $RAW_BODY | grep -o '\- \[x\] .*$' | sed 's/- \[x\] //' | awk 'BEGIN{printf "["}{printf "\"%s\", ", $0}END{printf "\b\b]"}'`
echo "matrix=$RESULT" >> $GITHUB_OUTPUT
if [ $(echo $RESULT | wc -L) -gt 6 ]; then
echo "need_to_run=true" >> $GITHUB_OUTPUT
else
echo "need_to_run=false" >> $GITHUB_OUTPUT
fi
test:
runs-on: ubuntu-latest
needs: pre-test
if: ${{ needs.pre-test.outputs.need_to_run == 'true' }}
strategy:
fail-fast: true
matrix:
target-arch: ${{ fromJSON(needs.pre-test.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Update kernel submodules
if: ${{ startsWith(matrix.target-arch, 'kernel') }}
run: git submodule update --init kernel
- name: Update buildroot submodules
if: ${{ startsWith(matrix.target-arch, 'kernel') }}
run: git submodule update --init buildroot
- name: Install deps
run: sudo apt-get install -y build-essential flex bison libssl-dev libelf-dev bc
- name: Install kernel arm64 deps
if: ${{ matrix.target-arch == 'kernel-arm64' }}
run: sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Defconfig
run: make defconfig-${{ matrix.target-arch }}
- name: Build
run: make build-${{ matrix.target-arch }}