From 51bce449b4fa046c89a58baf555d8f694ad13f16 Mon Sep 17 00:00:00 2001 From: Earle Lowe <30607889+emlowe@users.noreply.github.com> Date: Fri, 1 Sep 2023 12:06:16 -0700 Subject: [PATCH 01/19] Compile with no asm on riscv64 --- src/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3736e80ca..1a3c0360f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,6 +45,12 @@ target_include_directories(bls PUBLIC ${blst_SOURCE_DIR} ) target_compile_definitions(bls PRIVATE __BLST_PORTABLE__ BLSALLOC_SODIUM=1) + +if(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") + list(REMOVE-ITEM bls_sources ${blst_SOURCE_DIR}/build/assembly.S) + target_compile_definitions(bls PRIVATE __BLST_NO_ASM__) +endif() + target_link_libraries(bls PUBLIC sodium) if(WITH_COVERAGE) From bec8e751a457d5d8e04bd1ae572fad8b0ac11860 Mon Sep 17 00:00:00 2001 From: Earle Lowe <30607889+emlowe@users.noreply.github.com> Date: Fri, 1 Sep 2023 12:26:41 -0700 Subject: [PATCH 02/19] Typo --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1a3c0360f..490d734b5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,7 +47,7 @@ target_include_directories(bls PUBLIC target_compile_definitions(bls PRIVATE __BLST_PORTABLE__ BLSALLOC_SODIUM=1) if(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") - list(REMOVE-ITEM bls_sources ${blst_SOURCE_DIR}/build/assembly.S) + list(REMOVE_ITEM bls_sources ${blst_SOURCE_DIR}/build/assembly.S) target_compile_definitions(bls PRIVATE __BLST_NO_ASM__) endif() From 69bef940b35260da3325f0a53cfc750b8d1cdfe0 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 15:13:05 -0700 Subject: [PATCH 03/19] Attempt to QEMU test riscv64 compile --- .github/workflows/build-test-riscv64.yml | 49 ++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/build-test-riscv64.yml diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml new file mode 100644 index 000000000..73cf9719a --- /dev/null +++ b/.github/workflows/build-test-riscv64.yml @@ -0,0 +1,49 @@ +name: Build ARM64 wheels on ubuntu-latest + +on: + push: + branches: + - main + - dev + tags: + - '**' + pull_request: + branches: + - '**' + +jobs: + build_wheels: + name: QEMU rixcv64 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 Python wheels + run: | + docker run --rm \ + -v ${{ github.workspace }}:/ws --workdir=/ws \ + davidburela/riscv-emulator \ + bash -exc '\ + apt-get install -y cmake \ + mkdir -p build \ + cd build \ + cmake ../ \ + cmake --build . -- -j 6 \ + echo "Running ./src/runtest" \ + ./src/runtest \ + ' From 425b7a3820c705e4f7916ce8936bed80aa30dcef Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 15:17:24 -0700 Subject: [PATCH 04/19] Actually branch first - sorry Earle --- .github/workflows/build-test-riscv64.yml | 49 ------------------------ 1 file changed, 49 deletions(-) delete mode 100644 .github/workflows/build-test-riscv64.yml diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml deleted file mode 100644 index 73cf9719a..000000000 --- a/.github/workflows/build-test-riscv64.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Build ARM64 wheels on ubuntu-latest - -on: - push: - branches: - - main - - dev - tags: - - '**' - pull_request: - branches: - - '**' - -jobs: - build_wheels: - name: QEMU rixcv64 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 Python wheels - run: | - docker run --rm \ - -v ${{ github.workspace }}:/ws --workdir=/ws \ - davidburela/riscv-emulator \ - bash -exc '\ - apt-get install -y cmake \ - mkdir -p build \ - cd build \ - cmake ../ \ - cmake --build . -- -j 6 \ - echo "Running ./src/runtest" \ - ./src/runtest \ - ' From 3256b1783cf9788dac14dba0c9456f4dcda53864 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 15:20:03 -0700 Subject: [PATCH 05/19] Build and test in a riscv64 QEMU container --- .github/workflows/build-test-riscv64.yml | 49 ++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/build-test-riscv64.yml diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml new file mode 100644 index 000000000..9f591de99 --- /dev/null +++ b/.github/workflows/build-test-riscv64.yml @@ -0,0 +1,49 @@ +name: Build and test riscv64 on ubuntu-latest + +on: + push: + branches: + - main + - dev + tags: + - '**' + pull_request: + branches: + - '**' + +jobs: + build_wheels: + name: QEMU rixcv64 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 Python wheels + run: | + docker run --rm \ + -v ${{ github.workspace }}:/ws --workdir=/ws \ + davidburela/riscv-emulator \ + bash -exc '\ + apt-get install -y cmake \ + mkdir build \ + cd build \ + cmake ../ \ + cmake --build . -- -j 6 \ + echo "Running ./src/runtest" \ + ./src/runtest \ + ' From 3be9bcb1563b6fd7dec55b96ccf0297ad95d72a6 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 15:29:25 -0700 Subject: [PATCH 06/19] Add in the correct ampersands --- .github/workflows/build-test-riscv64.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index 9f591de99..5dd8d304d 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -33,17 +33,17 @@ jobs: platforms: riscv64 image: tonistiigi/binfmt:latest - - name: Build Python wheels + - name: Build and Test run: | docker run --rm \ -v ${{ github.workspace }}:/ws --workdir=/ws \ davidburela/riscv-emulator \ bash -exc '\ - apt-get install -y cmake \ - mkdir build \ - cd build \ - cmake ../ \ - cmake --build . -- -j 6 \ - echo "Running ./src/runtest" \ + apt-get install -y cmake && \ + mkdir -p build && \ + cd build && \ + cmake ../ && \ + cmake --build . -- -j 6 && \ + echo "Running ./src/runtest" && \ ./src/runtest \ ' From a4e3731b02e805d4612be15684413765f2e72d85 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 15:52:34 -0700 Subject: [PATCH 07/19] Try the debian/latest image --- .github/workflows/build-test-riscv64.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index 5dd8d304d..5a84fc13e 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -37,8 +37,10 @@ jobs: run: | docker run --rm \ -v ${{ github.workspace }}:/ws --workdir=/ws \ - davidburela/riscv-emulator \ + riscv64/debian:latest \ bash -exc '\ + cmake --version && \ + apt-get update && \ apt-get install -y cmake && \ mkdir -p build && \ cd build && \ From 06838f929eda30fffb6eb8be47abbd57ac4b26d3 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 15:54:31 -0700 Subject: [PATCH 08/19] Pause some other CI and fix image type --- .github/workflows/build-test-riscv64.yml | 2 +- .github/workflows/build-test.yaml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index 5a84fc13e..ab3b1f061 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -37,7 +37,7 @@ jobs: run: | docker run --rm \ -v ${{ github.workspace }}:/ws --workdir=/ws \ - riscv64/debian:latest \ + riscv64/debian \ bash -exc '\ cmake --version && \ apt-get update && \ diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 41fdf7a60..3a61e17ad 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -6,9 +6,9 @@ on: - main tags: - '**' - pull_request: - branches: - - '**' +# pull_request: +# branches: +# - '**' concurrency: # SHA is added to the end if on `main` to let all main workflows run From 10b3dc2f40867ba0c96447f5407c1e5a442e54b4 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 16:02:53 -0700 Subject: [PATCH 09/19] try stable debian and pause more other CI --- .github/workflows/build-test-riscv64.yml | 2 +- .github/workflows/build-wheels.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index ab3b1f061..f5796fd37 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -37,7 +37,7 @@ jobs: run: | docker run --rm \ -v ${{ github.workspace }}:/ws --workdir=/ws \ - riscv64/debian \ + riscv64/debian:stable \ bash -exc '\ cmake --version && \ apt-get update && \ diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 4f33b7167..a542e5228 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -6,9 +6,9 @@ on: - main release: types: [published] - pull_request: - branches: - - '**' +# pull_request: +# branches: +# - '**' concurrency: # SHA is added to the end if on `main` to let all main workflows run From e6288b9a07899284c18d9885f5a80b6b878d901d Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 16:04:48 -0700 Subject: [PATCH 10/19] Apparently it's rc-buggy --- .github/workflows/build-test-riscv64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index f5796fd37..ea828ff94 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -37,7 +37,7 @@ jobs: run: | docker run --rm \ -v ${{ github.workspace }}:/ws --workdir=/ws \ - riscv64/debian:stable \ + riscv64/debian:rc-buggy \ bash -exc '\ cmake --version && \ apt-get update && \ From e6ec5682baea215b693594ce95de1ec0675d8c86 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 16:07:25 -0700 Subject: [PATCH 11/19] Gotta install cmake before you use it... --- .github/workflows/build-test-riscv64.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index ea828ff94..53e45880b 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -13,7 +13,7 @@ on: jobs: build_wheels: - name: QEMU rixcv64 via Debian on ubuntu-latest + name: QEMU riscv64 via Debian on ubuntu-latest runs-on: ${{ matrix.os }} strategy: matrix: @@ -39,9 +39,9 @@ jobs: -v ${{ github.workspace }}:/ws --workdir=/ws \ riscv64/debian:rc-buggy \ bash -exc '\ - cmake --version && \ apt-get update && \ apt-get install -y cmake && \ + cmake --version && \ mkdir -p build && \ cd build && \ cmake ../ && \ From d2df8cf0b6deaad1ec2ce2e4b2b5e81942303646 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 16:22:48 -0700 Subject: [PATCH 12/19] Add build-essential --- .github/workflows/build-test-riscv64.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index 53e45880b..4104ef29b 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -31,7 +31,7 @@ jobs: uses: docker/setup-qemu-action@v2 with: platforms: riscv64 - image: tonistiigi/binfmt:latest +# image: tonistiigi/binfmt:latest - name: Build and Test run: | @@ -40,8 +40,9 @@ jobs: riscv64/debian:rc-buggy \ bash -exc '\ apt-get update && \ - apt-get install -y cmake && \ + apt-get install -y cmake build-essential && \ cmake --version && \ + uname -a && \ mkdir -p build && \ cd build && \ cmake ../ && \ From b11e23b290766a5145f03208050c024dab64197e Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 16:27:57 -0700 Subject: [PATCH 13/19] Surprisingly, build-essential doesn't install git --- .github/workflows/build-test-riscv64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index 4104ef29b..1b92d4d15 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -40,7 +40,7 @@ jobs: riscv64/debian:rc-buggy \ bash -exc '\ apt-get update && \ - apt-get install -y cmake build-essential && \ + apt-get install -y cmake build-essential git && \ cmake --version && \ uname -a && \ mkdir -p build && \ From b0768f58b0010bbdf46c9204b4cd7ad963d1cdeb Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 16:37:31 -0700 Subject: [PATCH 14/19] Can we just get python3? --- .github/workflows/build-test-riscv64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index 1b92d4d15..e242819f4 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -40,7 +40,7 @@ jobs: riscv64/debian:rc-buggy \ bash -exc '\ apt-get update && \ - apt-get install -y cmake build-essential git && \ + apt-get install -y cmake build-essential git python3 && \ cmake --version && \ uname -a && \ mkdir -p build && \ From b8355b5511bb7e800310a81131f5bc95a9f45b1b Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 16:46:33 -0700 Subject: [PATCH 15/19] Need python3-dev too --- .github/workflows/build-test-riscv64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index e242819f4..c2e648587 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -40,7 +40,7 @@ jobs: riscv64/debian:rc-buggy \ bash -exc '\ apt-get update && \ - apt-get install -y cmake build-essential git python3 && \ + apt-get install -y cmake build-essential git python3 python3-dev && \ cmake --version && \ uname -a && \ mkdir -p build && \ From acee2bbeb42fc76c5f64bc31de49ea61dcdf4b43 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Fri, 1 Sep 2023 17:05:06 -0700 Subject: [PATCH 16/19] Re-enable other CI --- .github/workflows/build-test.yaml | 6 +++--- .github/workflows/build-wheels.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 3a61e17ad..41fdf7a60 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -6,9 +6,9 @@ on: - main tags: - '**' -# pull_request: -# branches: -# - '**' + pull_request: + branches: + - '**' concurrency: # SHA is added to the end if on `main` to let all main workflows run diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index a542e5228..4f33b7167 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -6,9 +6,9 @@ on: - main release: types: [published] -# pull_request: -# branches: -# - '**' + pull_request: + branches: + - '**' concurrency: # SHA is added to the end if on `main` to let all main workflows run From 55092b6ac8855655cd0ddfaa63804adc6c760717 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Tue, 5 Sep 2023 17:36:42 -0500 Subject: [PATCH 17/19] Build the wheel and upload the artifact if successful --- .github/workflows/build-test-riscv64.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index c2e648587..cdbaba380 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -31,11 +31,10 @@ jobs: uses: docker/setup-qemu-action@v2 with: platforms: riscv64 -# image: tonistiigi/binfmt:latest - name: Build and Test run: | - docker run --rm \ + docker run --rm --platform linux/riscv64 \ -v ${{ github.workspace }}:/ws --workdir=/ws \ riscv64/debian:rc-buggy \ bash -exc '\ @@ -43,10 +42,11 @@ jobs: apt-get install -y cmake build-essential git python3 python3-dev && \ cmake --version && \ uname -a && \ - mkdir -p build && \ - cd build && \ - cmake ../ && \ - cmake --build . -- -j 6 && \ - echo "Running ./src/runtest" && \ - ./src/runtest \ + pip wheel -w dist . \ ' + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: packages + path: ./dist From 15e1228438f6fa8ebea3adf06e82c2fd12ea50f1 Mon Sep 17 00:00:00 2001 From: Chris Marslender Date: Tue, 5 Sep 2023 17:42:53 -0500 Subject: [PATCH 18/19] Need pip --- .github/workflows/build-test-riscv64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index cdbaba380..cbb6494c1 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -39,7 +39,7 @@ jobs: riscv64/debian:rc-buggy \ bash -exc '\ apt-get update && \ - apt-get install -y cmake build-essential git python3 python3-dev && \ + apt-get install -y cmake build-essential git python3 python3-dev python3-pip && \ cmake --version && \ uname -a && \ pip wheel -w dist . \ From 704d160abc43e55cd50bd2379e2c8a293ea87b3b Mon Sep 17 00:00:00 2001 From: Earle Lowe <30607889+emlowe@users.noreply.github.com> Date: Thu, 7 Sep 2023 10:46:54 -0700 Subject: [PATCH 19/19] Install wheel and run python tests --- .github/workflows/build-test-riscv64.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-riscv64.yml b/.github/workflows/build-test-riscv64.yml index cbb6494c1..378896585 100644 --- a/.github/workflows/build-test-riscv64.yml +++ b/.github/workflows/build-test-riscv64.yml @@ -39,10 +39,14 @@ jobs: riscv64/debian:rc-buggy \ bash -exc '\ apt-get update && \ - apt-get install -y cmake build-essential git python3 python3-dev python3-pip && \ + apt-get install -y cmake build-essential git python3-full python3-dev python3-pip && \ cmake --version && \ uname -a && \ - pip wheel -w dist . \ + 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 -v python-bindings/test.py ' - name: Upload artifacts