Skip to content

Commit

Permalink
Merge pull request #318 from VisorFolks/feature/akashkollipara/tools_…
Browse files Browse the repository at this point in the history
…build_githubCI

<GitHub Actions> Add tools build test
  • Loading branch information
akashkollipara authored Aug 1, 2024
2 parents a567dd7 + 020f790 commit ecbbe95
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GitHub CI
name: Cyancore Build

on:
push:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/cyancore_tools_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Cyancore Tools Build

on:
pull_request:
branches: [ stable ]

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}:[email protected]/".insteadOf "https://github.com/"

- name: Fetch Dependencies
run: |
make setup_workspace
- name: Tools Build
run: |
# make get_qemu V=1
make get_picotool V=1
- name: Clean Up
run: |
make clean_workspace
8 changes: 1 addition & 7 deletions mk/ccache.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 5 additions & 9 deletions mk/picotool.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand All @@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion mk/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...)
Expand Down
8 changes: 6 additions & 2 deletions mk/qemu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 ..."
Expand Down
16 changes: 12 additions & 4 deletions mk/tc_get.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,28 @@ 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
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)
Expand Down

0 comments on commit ecbbe95

Please sign in to comment.