Skip to content

Commit

Permalink
Add riscv64 info and simplify macos (#394)
Browse files Browse the repository at this point in the history
Simplify macos checks by just using CMAKE_SYSTME_PROCESSOR and add in
riscv64

---------

Co-authored-by: Chris Marslender <chrismarslender@gmail.com>
  • Loading branch information
emlowe and cmmarslender committed Sep 7, 2023
1 parent 7f1f011 commit f569a99
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 10 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build-test-riscv64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build and test riscv64 on ubuntu-latest

on:
push:
branches:
- main
- dev
tags:
- '**'
pull_request:
branches:
- '**'

jobs:
build:
timeout-minutes: 60
name: QEMU riscv64 via Debian on ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Set up QEMU on x86_64
if: startsWith(matrix.os, 'ubuntu-latest')
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: riscv64
# image: tonistiigi/binfmt:latest

- name: Build and Test
run: |
docker run --rm --platform linux/riscv64 \
-v ${{ github.workspace }}:/ws --workdir=/ws \
riscv64/debian:rc-buggy \
bash -exc '\
apt-get update && \
apt-get install -y cmake build-essential git python3-full python3-pip python3-dev && \
cmake --version && \
uname -a && \
export CP_USE_GREEN_REAPER=0 && \
pip wheel -w dist . && \
python3 -m venv venv && \
./venv/bin/python -m pip install dist/*.whl && \
./venv/bin/python -m pip install pytest && \
./venv/bin/python -m pytest -k "not k_21" -v tests/
'
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: packages
path: ./dist
11 changes: 1 addition & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,6 @@ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -fno-omit-frame-pointer -fsanitize=thre
set (CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=thread")
ENDIF()

IF (APPLE)
# on macOS "uname -m" returns the architecture (x86_64 or arm64)
execute_process(
COMMAND uname -m
RESULT_VARIABLE result
OUTPUT_VARIABLE OSX_NATIVE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDIF()

IF (WIN32)
set(BLAKE3_SRC
src/b3/blake3.c
Expand All @@ -141,7 +132,7 @@ set(BLAKE3_SRC
src/b3/blake3_avx512.c
src/b3/blake3_sse41.c
)
ELSEIF(OSX_NATIVE_ARCHITECTURE STREQUAL "arm64")
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64|arm64")
set(BLAKE3_SRC
src/b3/blake3.c
src/b3/blake3_portable.c
Expand Down

0 comments on commit f569a99

Please sign in to comment.