Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into wallentx/update-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
emlowe committed Jan 23, 2024
2 parents ea91c35 + f28916f commit cb53da9
Show file tree
Hide file tree
Showing 26 changed files with 1,095 additions and 10,117 deletions.
93 changes: 93 additions & 0 deletions .github/actions/fetch_bladebit_harvester.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/usr/bin/env bash
set -eo pipefail
_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
cd "$_dir/../.."

##
# Usage: fetch_bladebit_harvester.sh <linux|macos|windows> <arm64|x86-64>
#
# Use gitbash or similar under Windows.
##
host_os=$1
host_arch=$2

if [[ "${host_os}" != "linux" ]] && [[ "${host_os}" != "macos" ]] && [[ "${host_os}" != "windows" ]]; then
echo >&2 "Unkonwn OS '${host_os}'"
exit 1
fi

if [[ "${host_arch}" != "arm64" ]] && [[ "${host_arch}" != "x86-64" ]]; then
echo >&2 "Unkonwn Architecture '${host_arch}'"
exit 1
fi

## Change this if including a new bladebit release
artifact_ver="v3.1.0"
artifact_base_url="https://github.com/Chia-Network/bladebit/releases/download/${artifact_ver}"

linux_arm_sha256="e8fc09bb5862ce3d029b78144ea46791afe14a2d640390605b6df28fb420e782"
linux_x86_sha256="e31e5226d1e4a399f4181bb2cca243d46218305a8b54912ef29c791022ac079d"
macos_arm_sha256="03958b94ad9d01de074b5a9a9d86a51bd2246c0eab5529c5886bb4bbc4168e0b"
macos_x86_sha256="14975aabfb3d906e22e04cd973be4265f9c5c61e67a92f890c8e51cf9edf0c87"
windows_sha256="ccf115ebec18413c3134f9ca37945f30f4f02d6766242c7e84a6df0d1d989a69"
## End changes

artifact_ext="tar.gz"
sha_bin="sha256sum"
expected_sha256=

if [[ "$OSTYPE" == "darwin"* ]]; then
sha_bin="shasum -a 256"
fi

case "${host_os}" in
linux)
if [[ "${host_arch}" == "arm64" ]]; then
expected_sha256=$linux_arm_sha256
else
expected_sha256=$linux_x86_sha256
fi
;;
macos)
if [[ "${host_arch}" == "arm64" ]]; then
expected_sha256=$macos_arm_sha256
else
expected_sha256=$macos_x86_sha256
fi
;;
windows)
expected_sha256=$windows_sha256
artifact_ext="zip"
;;
*)
echo >&2 "Unexpected OS '${host_os}'"
exit 1
;;
esac

# Download artifact
artifact_name="green_reaper.${artifact_ext}"
curl -L "${artifact_base_url}/green_reaper-${artifact_ver}-${host_os}-${host_arch}.${artifact_ext}" >"${artifact_name}"

# Validate sha256, if one was given
if [ -n "${expected_sha256}" ]; then
gr_sha256="$(${sha_bin} ${artifact_name} | cut -d' ' -f1)"

if [[ "${gr_sha256}" != "${expected_sha256}" ]]; then
echo >&2 "GreenReaper SHA256 mismatch!"
echo >&2 " Got : '${gr_sha256}'"
echo >&2 " Expected: '${expected_sha256}'"
exit 1
fi
fi

# Unpack artifact
dst_dir="libs/green_reaper"
mkdir -p "${dst_dir}"
if [[ "${artifact_ext}" == "zip" ]]; then
unzip -d "${dst_dir}" "${artifact_name}"
else
pushd "${dst_dir}"
tar -xzvf "../../${artifact_name}"
popd
fi
47 changes: 32 additions & 15 deletions .github/workflows/build-test-cplusplus.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Build and Test C++

on: [push, pull_request]
on:
push:
branches:
- main
release:
types: [published]
pull_request:
branches:
- '**'

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}--${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }}
Expand All @@ -9,10 +17,10 @@ concurrency:
jobs:
valgrind:
name: valgrind ubuntu
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: cmake, RunTests, and valgrind on ubuntu-20.04
run: |
Expand All @@ -27,46 +35,55 @@ jobs:
asan:
name: ASAN ubuntu
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: cmake, RunTests with address- and undefined sanitizer on Ubuntu
run: |
sudo fallocate -l 16G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
swapon -s
mkdir build-asan
cd build-asan
cmake -DCMAKE_BUILD_TYPE=ASAN ../
cmake --build . -- -j 6
swapon -s
./RunTests
tsan:
name: TSAN ubuntu
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: cmake, RunTests with thread sanitizer on Ubuntu
run: |
mkdir build-tsan
cd build-tsan
cmake -DCMAKE_BUILD_TYPE=TSAN ../
cmake --build . -- -j 6
TSAN_OPTIONS="memory_limit_mb=6000" ./RunTests
./RunTests
mac:
name: MacOS
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: cmake, RunTests on Mac
run: |
mkdir build
cd build
cmake ..
cmake --build . --config Release -j 6
./RunTests
windows:
name: Windows Latest
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: cmake, RunTests with Windows
run: |
Expand Down
126 changes: 126 additions & 0 deletions .github/workflows/build-test-riscv64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Build and test riscv64 on ubuntu-latest

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

jobs:
build_wheels:
timeout-minutes: 60
name: ${{ matrix.os }} 📦 Build ${{ matrix.python.major-dot-minor }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python:
- major-dot-minor: "3.8"
matrix: "3.8"
- major-dot-minor: "3.9"
matrix: "3.9"
- major-dot-minor: "3.10"
matrix: "3.10"
- major-dot-minor: "3.11"
matrix: "3.11"

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 \
chianetwork/ubuntu-22.04-risc-builder:latest \
bash -exc '\
pyenv global ${{ matrix.python.matrix }} && \
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
if-no-files-found: error
upload:
name: Upload to Chia PyPI
runs-on: ubuntu-latest
needs:
- build_wheels
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set Env
uses: Chia-Network/actions/setjobenv@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Download artifacts
if: env.RELEASE == 'true'
uses: actions/download-artifact@v3
with:
name: packages
path: ./dist

- name: Configure AWS credentials
if: env.RELEASE == 'true'
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.CHIA_AWS_ACCOUNT_ID }}:role/installer-upload
aws-region: us-west-2

- name: List existing wheels
if: env.RELEASE == 'true'
shell: sh
run: |
aws s3 ls s3://download.chia.net/simple/chiavdf/ > existing_wheel_list_raw
cat existing_wheel_list_raw
cat existing_wheel_list_raw | tr -s ' ' | cut -d ' ' -f 4 > existing_wheel_list
- name: List new wheels
if: env.RELEASE == 'true'
shell: sh
run: |
(cd dist/; ls ${{ inputs.package_name }}-*.whl) > new_wheel_list
cat new_wheel_list | xargs -I % sh -c 'ls -l dist/%'
- name: Choose wheels to upload
if: env.RELEASE == 'true'
shell: sh
run: |
grep -F -x -v -f existing_wheel_list new_wheel_list > upload_wheel_list
cat upload_wheel_list
- name: Upload wheels
if: env.RELEASE == 'true'
shell: sh
run: |
cat upload_wheel_list | xargs -I % sh -c 'aws s3 cp dist/% s3://download.chia.net/simple/chiapos/'
Loading

0 comments on commit cb53da9

Please sign in to comment.