From 0bd985f07b76f2f333bcb729b076b2b798ec7f5a Mon Sep 17 00:00:00 2001 From: ChinYikMing Date: Mon, 9 Sep 2024 15:35:31 +0800 Subject: [PATCH 1/3] CI: build on macOS semu supports conditional compilation on both Linux and macOS. This can sometimes lead to compilation failures on one platform when only tested on another. To prevent such issues, automated CI checks ensure that the code compiles properly before being merged into upstream. --- .github/workflows/main.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 627525b..7fbdcb4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,14 +3,27 @@ name: CI on: [push, pull_request] jobs: - rv32emu: + semu-linux: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - name: install-dependencies - run: | - sudo apt-get install build-essential device-tree-compiler - sudo apt-get install expect + run: | + sudo apt-get install build-essential device-tree-compiler expect + - name: default build + run: make + shell: bash + - name: automated test + run: .ci/autorun.sh + shell: bash + + semu-macOS: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: install-dependencies + run: | + brew install make dtc expect e2fsprogs - name: default build run: make shell: bash From e438c1b412316b7032459f40f873f39a49ee1680 Mon Sep 17 00:00:00 2001 From: ChinYikMing Date: Mon, 9 Sep 2024 15:46:32 +0800 Subject: [PATCH 2/3] Fix shasum format --- mk/external.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mk/external.mk b/mk/external.mk index 65499b4..0ec803a 100644 --- a/mk/external.mk +++ b/mk/external.mk @@ -19,9 +19,9 @@ define download $($(T)_DATA): $(VECHO) " GET\t$$@\n" $(Q)curl --progress-bar -O -L -C - "$(strip $($(T)_DATA_URL))" - $(Q)echo "$(strip $$($(T)_DATA_SHA1)) $$@.bz2" | $(SHA1SUM) -c + $(Q)echo "$(strip $$($(T)_DATA_SHA1)) $$@.bz2" | $(SHA1SUM) -c $(Q)bunzip2 $$@.bz2 endef EXTERNAL_DATA = KERNEL INITRD -$(foreach T,$(EXTERNAL_DATA),$(eval $(download))) +$(foreach T,$(EXTERNAL_DATA),$(eval $(download))) From d05f39528e24f80f13583daf9118a8b1251c821e Mon Sep 17 00:00:00 2001 From: ChinYikMing Date: Fri, 13 Sep 2024 02:00:04 +0800 Subject: [PATCH 3/3] Select appropriate timeout for each Github runner Testing shows 600 seconds is sufficient to boot Linux on macOS runners, while 90 seconds works for Linux runners. This commit sets the timeout for each platform accordingly. The varying timeout requirements will be tracked in an issue. --- .ci/autorun.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.ci/autorun.sh b/.ci/autorun.sh index d07494b..6df16cd 100755 --- a/.ci/autorun.sh +++ b/.ci/autorun.sh @@ -16,8 +16,18 @@ function ASSERT { cleanup +# macOS needs more time to boot compared to Linux, so the timeout is set to +# 600 seconds for macOS to handle the longer startup. For Linux, 90 seconds +# is sufficient due to its faster boot process. +UNAME_S=$(uname -s) +if [[ ${UNAME_S} == "Darwin" ]]; then + TIMEOUT=600 +else # Linux + TIMEOUT=90 +fi + ASSERT expect <