Skip to content

Commit

Permalink
add test ci
Browse files Browse the repository at this point in the history
- [] initrd-amd64
- [x] kernel-arm64

Signed-off-by: Kevin Cui <bh@bugs.cc>
  • Loading branch information
BlackHole1 committed Feb 22, 2024
1 parent 90d4f7d commit d99322c
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 62 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/call-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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 }}
62 changes: 0 additions & 62 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,62 +0,0 @@
name: Test

on:
pull_request:
types:
labeled

# concurrency:
# group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: true

jobs:
pre-test:
runs-on: ubuntu-latest
# outputs:
# target: ${{ steps.set-target.outputs.target }}
# arch: ${{ steps.set-arch.outputs.arch }}

steps:
- id: set-target
run: |
echo ${{ github.event.label.name }}
- run: |
echo ${{ join(github.event.pull_request.labels) }}
- run: |
echo ${{ toJSON(github.event.pull_request) }}
- run: |
echo ${{ toJSON(github) }}
# test:
# runs-on: ubuntu-latest
# needs: pre-test
# strategy:
# fail-fast: true
# matrix:
# target: ${{ fromJSON(needs.pre-test.outputs.target) }}
# arch: ${{ fromJSON(needs.pre-test.outputs.arch) }}

# steps:
# - name: Checkout
# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

# - name: Update kernel submodules
# if: ${{ matrix.target == 'kernel'}}
# run: git submodule update --init kernel

# - name: Update buildroot submodules
# if: ${{ matrix.target != '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 == 'kernel' && matrix.arch == 'arm64'}}
# run: sudo apt-get install -y gcc-aarch64-linux-gnu

# - name: Defconfig
# run: make defconfig-${{ matrix.target }}-${{ matrix.arch }}

# - name: Build
# run: make build-${{ matrix.target }}-${{ matrix.arch }}

0 comments on commit d99322c

Please sign in to comment.