From 99d89895e03ab08ea601bff8dc14e9df25dc79f0 Mon Sep 17 00:00:00 2001 From: Cuda-Chen Date: Thu, 21 Dec 2023 22:10:29 +0800 Subject: [PATCH 1/6] Add RISC-V host CI --- .github/workflows/github_actions.yml | 22 ++++++++++++++++++---- Makefile | 18 ++++++++++-------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 973f938..0e8cda6 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -1,10 +1,7 @@ name: Github Actions on: - push: - branches: [main] - pull_request: - branches: [main] + [push, pull_request] jobs: cross_compile_tests: @@ -26,6 +23,23 @@ jobs: export ENABLE_TEST_ALL=true sh scripts/cross-test.sh + host_riscv: + runs-on: ubuntu-20.04 + steps: + - name: checkout code + uses: actions/checkout@v3.2.0 + - name: build artifact + uses: uraimo/run-on-arch-action@v2.5.0 + with: + arch: riscv64 + distro: ubuntu20.04 + install: | + apt-get update -q -y + apt-get install -q -y make gcc + apt-get install -q -y g++ + run: | + make test + check_test_cases: runs-on: ubuntu-22.04 steps: diff --git a/Makefile b/Makefile index 4f2fa53..d4bc060 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,10 @@ else endif ifndef CROSS_COMPILE - processor := $(shell uname -m) - ARCH_CFLAGS = -maes -mpclmul -mssse3 -msse4.2 + uname_result := $(shell uname -m) + ifeq ($(uname_result),$(filter $(uname_result),riscv64)) + processor = rv64 + endif else # CROSS_COMPILE was set CC = $(CROSS_COMPILE)gcc CXX = $(CROSS_COMPILE)g++ @@ -35,12 +37,6 @@ else # CROSS_COMPILE was set $(error Unsupported cross-compiler) endif - ifeq ($(processor),$(filter $(processor),i386 x86_64)) - ARCH_CFLAGS = -maes -mpclmul -mssse3 -msse4.2 - else - ARCH_CFLAGS = -march=$(processor)gcv_zba - endif - ifeq ($(SIMULATOR_TYPE), qemu) SIMULATOR += qemu-riscv64 SIMULATOR_FLAGS = -cpu $(processor),v=true,zba=true,vlen=128 @@ -51,6 +47,12 @@ else # CROSS_COMPILE was set endif endif +ifeq ($(processor),$(filter $(processor),i386 x86_64)) + ARCH_CFLAGS = -maes -mpclmul -mssse3 -msse4.2 +else + ARCH_CFLAGS = -march=$(processor)gcv_zba +endif + CXXFLAGS += -Wall -Wcast-qual -I. $(ARCH_CFLAGS) LDFLAGS += -lm OBJS = \ From e06db35e63b7102221689f52d14b623e73d6a1e9 Mon Sep 17 00:00:00 2001 From: Cuda-Chen Date: Mon, 1 Jan 2024 13:00:41 +0800 Subject: [PATCH 2/6] Use Ubuntu 22.04 --- .github/workflows/github_actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 0e8cda6..1b1d5fa 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -24,7 +24,7 @@ jobs: sh scripts/cross-test.sh host_riscv: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: checkout code uses: actions/checkout@v3.2.0 From 5ca297102df225670eb5e3c2ffe891c9342fa9df Mon Sep 17 00:00:00 2001 From: Cuda-Chen Date: Wed, 3 Jan 2024 10:24:27 +0800 Subject: [PATCH 3/6] Use Ubuntu 22.04 in client container --- .github/workflows/github_actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 1b1d5fa..454140a 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -32,7 +32,7 @@ jobs: uses: uraimo/run-on-arch-action@v2.5.0 with: arch: riscv64 - distro: ubuntu20.04 + distro: ubuntu22.04 install: | apt-get update -q -y apt-get install -q -y make gcc From fcd9f9f0c1158bcd2b6ddddaa180cb18230134a2 Mon Sep 17 00:00:00 2001 From: Cuda-Chen Date: Wed, 3 Jan 2024 10:31:49 +0800 Subject: [PATCH 4/6] Use GCC 13 --- .github/workflows/github_actions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 454140a..8615969 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -35,8 +35,8 @@ jobs: distro: ubuntu22.04 install: | apt-get update -q -y - apt-get install -q -y make gcc - apt-get install -q -y g++ + apt-get install -q -y make gcc-13 + apt-get install -q -y g++-13 run: | make test From 08f67243425c39ad6fdd09e50e7062369ede2b67 Mon Sep 17 00:00:00 2001 From: Cuda-Chen Date: Wed, 3 Jan 2024 10:35:18 +0800 Subject: [PATCH 5/6] Use ubuntu_devel --- .github/workflows/github_actions.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 8615969..8073a09 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -32,11 +32,11 @@ jobs: uses: uraimo/run-on-arch-action@v2.5.0 with: arch: riscv64 - distro: ubuntu22.04 + distro: ubuntu_devel install: | apt-get update -q -y - apt-get install -q -y make gcc-13 - apt-get install -q -y g++-13 + apt-get install -q -y make gcc + apt-get install -q -y g++ run: | make test From a6b84b88f43e042308f258114ac70b9ba4299aef Mon Sep 17 00:00:00 2001 From: Cuda-Chen Date: Wed, 3 Jan 2024 11:13:49 +0800 Subject: [PATCH 6/6] Use clang --- .github/workflows/github_actions.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml index 8073a09..bd4659f 100644 --- a/.github/workflows/github_actions.yml +++ b/.github/workflows/github_actions.yml @@ -33,10 +33,13 @@ jobs: with: arch: riscv64 distro: ubuntu_devel + env: | + CXX: clang++ + CC: clang install: | apt-get update -q -y - apt-get install -q -y make gcc - apt-get install -q -y g++ + apt-get install -q -y make clang + apt-get install -q -y clang++ run: | make test