From 052f73e4e5c7f6266bf80f392ac593046e2d8d2c Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 26 Aug 2024 10:34:20 +0200 Subject: Add CI job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will ensure that the code style is preserved and that commits being pushed at least build successfully. Signed-off-by: Miquel Sabaté Solà --- .github/workflows/ci.yml | 29 +++++++++++++++++++++++++++++ Makefile | 8 ++++++-- README.md | 4 ++-- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e278d5f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + CROSS_COMPILE: riscv64-linux-gnu- + CC_SUFFIX: -14 + +jobs: + test: + name: Continuous Integration + runs-on: ubuntu-24.04 + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Install dependencies from Ubuntu sources + run: sudo apt-get install clang-format gcc-14-riscv64-linux-gnu + + - name: Lint + run: make lint V=1 + + - name: Check that it builds + run: make V=1 diff --git a/Makefile b/Makefile index f969a1c..611ee48 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,8 @@ endif # I did not go too much into the rabbit hole of platform-specific flags. Hence # no `-mcpu`, no `-mtune`, no funny business. -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)ld +CC = $(CROSS_COMPILE)gcc$(CC_SUFFIX) +LD = $(CROSS_COMPILE)ld QEMU ?= qemu-system-riscv64 ISA ?= rv64imafdc_zicntr_zicsr_zifencei_zihpm_zca_zcd_zba_zbb @@ -88,3 +88,7 @@ gdb: .PHONY: clean clean: $(Q) rm -f $(OBJ) $(KRNL) $(LINKER) + +.PHONY: lint +lint: + $(Q) git ls-files *.c *.h | xargs clang-format --dry-run --Werror diff --git a/README.md b/README.md index 532584b..da92c98 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ In order to build `fbos` you only need GCC. That being said, if you are not on a RISC-V system you will also need cross compilation tools for it (check your distribution for this, on openSUSE I simply installed `cross-riscv64-gcc14`). With that installed, simply set the `CROSS_COMPILE` environment variable as -you'd do for building the kernel (e.g. in my case, using openSUSE, I set it to -`riscv64-suse-linux-`). After all of that, just: +you'd do for building the Linux kernel (e.g. in my case, using openSUSE, I set +it to `riscv64-suse-linux-`). After all of that, just: ``` $ make -- cgit v1.2.3