From a0f0bfce42514a57f82c557c148624d7ad0e7532 Mon Sep 17 00:00:00 2001 From: Akash Kollipara Date: Thu, 1 Aug 2024 10:24:25 +0530 Subject: [PATCH] Add github action got tools build test --- .../{github_ci.yml => cyancore_build.yml} | 2 +- .github/workflows/cyancore_tools_build.yml | 44 +++++++++++++++++++ mk/ccache.mk | 8 +--- mk/picotool.mk | 14 +++--- mk/project.mk | 2 +- mk/qemu.mk | 8 +++- mk/tc_get.mk | 16 +++++-- 7 files changed, 70 insertions(+), 24 deletions(-) rename .github/workflows/{github_ci.yml => cyancore_build.yml} (98%) create mode 100644 .github/workflows/cyancore_tools_build.yml diff --git a/.github/workflows/github_ci.yml b/.github/workflows/cyancore_build.yml similarity index 98% rename from .github/workflows/github_ci.yml rename to .github/workflows/cyancore_build.yml index b96059d9..efa78529 100644 --- a/.github/workflows/github_ci.yml +++ b/.github/workflows/cyancore_build.yml @@ -1,4 +1,4 @@ -name: GitHub CI +name: Cyancore Build on: push: diff --git a/.github/workflows/cyancore_tools_build.yml b/.github/workflows/cyancore_tools_build.yml new file mode 100644 index 00000000..faca0ee0 --- /dev/null +++ b/.github/workflows/cyancore_tools_build.yml @@ -0,0 +1,44 @@ +name: Cyancore Tools Build + +on: + pull_request: + branches: [ stable, development ] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + statuses: write + + strategy: + fail-fast: true + + steps: + - uses: actions/checkout@v4 + + - name: Configure Git + env: + TOKEN: ${{ secrets.AKASH_VF }} + run: git config --global url."https://${TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/" + + - name: Fetch Dependencies + run: | + make setup_workspace + + - name: Init CodeQL + uses: github/codeql-action/init@v3 + + - name: Tools Build + run: | + # make get_qemu V=1 + make get_picotool V=1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + + - name: Clean Up + run: | + make clean_workspace diff --git a/mk/ccache.mk b/mk/ccache.mk index ab594f39..02f01de6 100644 --- a/mk/ccache.mk +++ b/mk/ccache.mk @@ -103,16 +103,10 @@ export CCACHE_UMASK ifeq ($(EN_BUILD_CACHE),1) -CCACHE := ccache +CCACHE := $(shell which ccache) T_ALLOWLIST += show_ccache_config show_ccache_stats clean_ccache -CHECK_CCACHE := $(shell which $(CCACHE)) -ifeq ($(CHECK_CCACHE),) -$(info < ! > ccache is not installed!) -$(error < x > Stopping build.) -endif - show_ccache_stats: ifneq ($(realpath $(CCACHE_LOGFILE)),) $(CCACHE) -s -x -v diff --git a/mk/picotool.mk b/mk/picotool.mk index 67e3476a..4ac90db1 100644 --- a/mk/picotool.mk +++ b/mk/picotool.mk @@ -8,8 +8,8 @@ # Organisation : Cyancore Core-Team # -PICO_SDK_GIT := git@github.com:raspberrypi/pico-sdk.git -PICO_TOOL_GIT := git@github.com:raspberrypi/picotool.git +PICO_SDK_GIT := https://github.com/raspberrypi/pico-sdk.git +PICO_TOOL_GIT := https://github.com/raspberrypi/picotool.git PICO_SDK_PATH := $(TOOLS_ROOT)/pico-sdk/ PICO_TOOL_PATH := $(TOOLS_ROOT)/picotool/ PICO_TOOL := $(MISC_TOOLS)/picotool @@ -18,10 +18,11 @@ ELF2UF2 := $(MISC_TOOLS)/elf2uf2 ifneq ($(V),1) SILENT_LOGS := > cbuild.log 2> /dev/null +PICOTOOL_QUIET := 2>/dev/null 1>/dev/null endif P_TARGETS += elf2uf2 -T_ALLOWLIST += get_picotool clean_picotool install_pt_dep +T_ALLOWLIST += get_picotool clean_picotool get_picotool: $(PICO_TOOL) $(ELF2UF2) @@ -41,7 +42,7 @@ $(ELF2UF2): $(PICO_SDK_PATH) @echo "< ! > Building elf2uf2 ..." mkdir -p $(MISC_TOOLS)/temp cd $(MISC_TOOLS)/temp; \ - cmake $(PICO_SDK_PATH)/tools/elf2uf2 2>/dev/null >/dev/null; \ + cmake $(PICO_SDK_PATH)/tools/elf2uf2 $(PICOTOOL_QUIET); \ make >/dev/null 2>/dev/null cp $(MISC_TOOLS)/temp/elf2uf2 $@ rm -rf $(MISC_TOOLS)/temp @@ -64,11 +65,6 @@ $(PICO_TOOL_PATH): git clone $(PICO_TOOL_GIT) --quiet $@ @echo "< / > Done!" -install_pt_dep: - @echo "< ! > Installing Dependencies ..." - @sudo apt-get install build-essential pkg-config libusb-1.0-0-dev -y -qq > /dev/null - @echo "< / > Done!" - clean_picotool: @echo "< ! > Removing picotools ..." rm -rf $(PICO_SDK_PATH) $(PICO_TOOL_PATH) $(PICO_TOOL) $(ELF2UF2) diff --git a/mk/project.mk b/mk/project.mk index 795fc940..09da769e 100644 --- a/mk/project.mk +++ b/mk/project.mk @@ -40,7 +40,7 @@ clean: $(info < ! > Removing $(PROJECT) binaries ...) rm -rf $(OUT) -setup_workspace: $(SIZE) get_qemu get_all_tc +setup_workspace: | --install_os_pkgs $(SIZE) get_all_tc clean_workspace: clean $(info < / > Cleaning up workspace ...) diff --git a/mk/qemu.mk b/mk/qemu.mk index a9a822bc..96c7645c 100644 --- a/mk/qemu.mk +++ b/mk/qemu.mk @@ -17,6 +17,10 @@ QEMU_OUT_PATH := $(TOOLS_ROOT)/cc_qemu QEMU_TLIST := avr-softmmu arm-softmmu aarch64-softmmu QEMU_TLIST += riscv32-softmmu riscv64-softmmu x86_64-softmmu +ifneq ($(V),1) +QEMU_QUIET := 2> /dev/null 1> /dev/null +endif + get_qemu: $(QEMU_OUT_PATH) $(TOOLS_ROOT)/qemu: @@ -34,8 +38,8 @@ c := , $(QEMU_OUT_PATH): $(QEMU_PATH) @echo "< ! > Building qemu ..." @echo "< ? > Please be patient as this might take a while ..." - cd $<; ./configure --prefix=$(QEMU_OUT_PATH) --target-list=$(subst $(s),$(c),$(QEMU_TLIST)) 2> /dev/null 1> /dev/null - make -j $(N_JOBS) -C $< install 2> /dev/null 1> /dev/null + cd $<; ./configure --prefix=$(QEMU_OUT_PATH) --target-list=$(subst $(s),$(c),$(QEMU_TLIST)) $(QEMU_QUIET) + make -j $(N_JOBS) -C $< install $(QEMU_QUIET) @echo "< ! > Cleaning up build space ..." rm -rf $(QEMU_PATH) @echo "< ! > Adding load_qemu alias to bashrc ..." diff --git a/mk/tc_get.mk b/mk/tc_get.mk index 7548ef2d..84e638ee 100644 --- a/mk/tc_get.mk +++ b/mk/tc_get.mk @@ -12,6 +12,10 @@ include mk/path.mk T_ALLOWLIST += get_all_tc get_avr_tc get_arm_tc get_riscv_tc +OSDEPPKGS := build-essential pkg-config libusb-1.0-0-dev cppcheck ccache +OSDEPPKGS += tree ninja-build libpixman-1-dev libcairo2-dev libpango1.0-dev +OSDEPPKGS += libjpeg8-dev libgif-dev libglib2.0-dev libgcrypt20-dev python3-venv + # GIT REPO RECOMMENDED # Provide git repo path for toolchains for better experience ESIZE_REPO := https://github.com/VisorFolks/cc_elf_size.git @@ -19,13 +23,17 @@ AVR_TC_REPO ?= https://github.com/VisorFolks/avr-toolchain RISC_V_TC_REPO ?= https://github.com/VisorFolks/risc-v-toolchain ARM_TC_REPO ?= https://github.com/VisorFolks/arm-toolchain -get_all_tc: --tc_clear get_avr_tc get_arm_tc get_riscv_tc +get_all_tc: get_avr_tc get_arm_tc get_riscv_tc ---tc_clear: - rm -rf $(TOOLS_ROOT) +--install_os_pkgs: + @echo "< ! > Installing workspace dependencies, it may take a while ..." + sudo apt-get install $(OSDEPPKGS) -y -qq > /dev/null + @echo "< / > Done!" SIZE := $(TOOLS_ROOT)/cc_elf_size/size -$(SIZE): + +.SECONDEXPANSION: +$(SIZE): | $$(@D)/ $(info < ! > Fetching ELF-Size utility ...) cd $(TOOLS_ROOT); git clone $(ESIZE_REPO) --quiet; $(MAKE) -C $(@D)