From 72f19306e1dee0911f5819a873ec406f7c8fa9b0 Mon Sep 17 00:00:00 2001 From: Kevin Cui Date: Fri, 2 Feb 2024 17:08:21 +0800 Subject: [PATCH] chore(ci): add ci Signed-off-by: Kevin Cui --- .editorconfig | 8 +++++++ .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ Makefile | 26 +++++++++++++++++++- 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 .editorconfig create mode 100644 .github/workflows/release.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..33389f3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +charset = utf-8 + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7bb972f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release + +on: + push: + branches: + - add-ci + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + release: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + target: + - initrd + - rootfs + - kernel + arch: + - arm64 + - amd64 + + 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: Defconfig + run: make ${{ matrix.target }}-${{ matrix.arch }}-defconfig + + - name: Build + run: make ${{ matrix.target }}-${{ matrix.arch }}-build + + - name: List file + run: make print-outpath-${{ matrix.target }}-${{ matrix.arch }} diff --git a/Makefile b/Makefile index c1fde02..1b1cb37 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: %-build build rootfs-%-defconfig rootfs-%-savedefconfig %-nconfig %-menuconfig %-clean clean help rootfs-% initrd-% kernel-% +.PHONY: %-build build rootfs-%-defconfig rootfs-%-savedefconfig %-nconfig %-menuconfig %-clean clean help rootfs-% initrd-% kernel-% print-outpath-% ROOTDIR := $(realpath .) @@ -234,6 +234,30 @@ clean: ##@ Clean all build files ##@ Misc commands ##@ +print-outpath-%: ##@ Print out path of specified architecture + $(eval _TARGET := $(firstword $(subst -, ,$*))) + $(eval _ARCH := $(word 2, $(subst -, ,$*))) + + @case $(_TARGET) in \ + rootfs) \ + echo -n $(ROOTDIR)/out/rootfs/$(_ARCH)/images/rootfs.erofs; \ + ;; \ + initrd) \ + echo -n $(ROOTDIR)/out/initrd/$(_ARCH)/images/initrd.gz; \ + ;; \ + kernel) \ + if [ $(_ARCH) == arm64 ]; then \ + echo -n $(ROOTDIR)/out/kernel/arm64/arch/arm64/boot/Image; \ + else \ + echo -n $(ROOTDIR)/out/kernel/amd64/arch/x86/boot/bzImage; \ + fi; \ + ;; \ + *) \ + printf "Please specify a print-outpath command\n" \ + exit 1 \ + ;; \ + esac \ + help: ##@ (Default) Print listing of key targets with their descriptions @printf "\nUsage: make \n" @grep -F -h "##@" $(MAKEFILE_LIST) | grep -F -v grep -F | sed -e 's/\\$$//' | awk 'BEGIN {FS = ":*[[:space:]]*##@[[:space:]]*"}; \