Skip to content

Commit

Permalink
Merge pull request #239 v2.0.0 from Chia-Network/develop
Browse files Browse the repository at this point in the history
Version 2.0.0
  • Loading branch information
haorldbchi authored Nov 3, 2022
2 parents ad85a8f + 3196955 commit d647918
Show file tree
Hide file tree
Showing 222 changed files with 67,922 additions and 21,826 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto

*.sh text eol=lf
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,41 @@
# - BB_ARTIFACT_NAME
# - BB_VERSION
#
set -e
set -o pipefail
set -eo pipefail

thread_count=2

if [[ $OSTYPE == 'darwin'* ]]; then
thread_count=$(sysctl -n hw.logicalcpu)
else
thread_count=$(nproc --all)
fi

# TODO: Use specific GCC version
echo "System: $(uname -s)"
gcc --version

mkdir build && cd build
cmake ..
bash -e -o pipefail ../extract-version.sh
cmake --build . --target bladebit --config Release -j $(nproc --all)
bash -eo pipefail ../embed-version.sh
cmake --build . --target bladebit --config Release -j $thread_count
chmod +x ./bladebit

if [[ $OSTYPE == 'msys'* ]] || [[ $OSTYPE == 'cygwin'* ]]; then
ls -la Release
else
ls -la
fi

# Ensure bladebit version matches expected version
bb_version="$(./bladebit --version | xargs)"

if [[ "$bb_version" != "$BB_VERSION" ]]; then
>&2 echo "Incorrect bladebit version. Got but '$bb_version' expected '$BB_VERSION'."
>&2 echo "Incorrect bladebit version. Got '$bb_version' but expected '$BB_VERSION'."
exit 1
fi

tar --version
tar -czvf $BB_ARTIFACT_NAME bladebit
mkdir ../bin
mv $BB_ARTIFACT_NAME ../bin/
Expand Down
29 changes: 20 additions & 9 deletions .github/actions/get-version.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
#! /usr/bin/env bash
# NOTE: This is meant to be run from the repo root dir
#
set -e
set -o pipefail
set -eo pipefail

os=$1
arch=$2

version=$(cat VERSION)
suffix=
ext="tar.gz"
shift $#

if [[ "$GITHUB_REF_NAME" != "master" ]]; then
suffix="-$GITHUB_REF_NAME"
fi
# version_cmp=($(./extract-version.sh))
. ./extract-version.sh

ver_maj=$bb_ver_maj
ver_min=$bb_ver_min
ver_rev=$bb_ver_rev
ver_suffix=$bb_version_suffix

version="${ver_maj}.${ver_min}.${ver_rev}${ver_suffix}"

# echo "Ref name: '$GITHUB_REF_NAME'"
# if [[ "$GITHUB_REF_NAME" != "master" ]]; then
# suffix="-${GITHUB_REF_NAME}"
# fi

ext="tar.gz"

if [[ "$os" == "windows" ]]; then
ext="zip"
fi

echo "::set-output name=BB_VERSION::$version"
echo "::set-output name=BB_ARTIFACT_NAME::bladebit-v${version}${suffix}-${os}-${arch}.${ext}"
echo "::set-output name=BB_ARTIFACT_NAME::bladebit-v${version}-${os}-${arch}.${ext}"

8 changes: 5 additions & 3 deletions .github/workflows/attach-release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: master

# Setup Node
- uses: actions/setup-node@v2
with: { node-version: '14' }
- uses: actions/setup-node@v3
with: { node-version: '16' }
- run: cd .github/actions && npm install @octokit/action

# Upload Artifacts as Release Assets
Expand All @@ -35,6 +35,8 @@ jobs:
bladebit-v${BB_VERSION}-ubuntu-arm64.tar.gz
bladebit-v${BB_VERSION}-centos-arm64.tar.gz
bladebit-v${BB_VERSION}-windows-x86-64.zip
bladebit-v${BB_VERSION}-macos-arm64.tar.gz
bladebit-v${BB_VERSION}-macos-x86-64.tar.gz
)
mkdir -p bin
Expand Down
90 changes: 74 additions & 16 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Get Version Number
id: version_number
Expand All @@ -22,7 +22,7 @@ jobs:
env:
BB_ARTIFACT_NAME: ${{ steps.version_number.outputs.BB_ARTIFACT_NAME }}
BB_VERSION: ${{steps.version_number.outputs.BB_VERSION}}
run: .github/actions/build-asset-linux.sh
run: .github/actions/build-asset-unix.sh

- name: Upload Artifact Ubuntu x86-64
uses: actions/upload-artifact@v2
Expand All @@ -34,10 +34,10 @@ jobs:
build-centos-x86-64:
runs-on: ubuntu-20.04
container:
image: centos:8
image: quay.io/centos/centos:stream8
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Get Version Number
id: version_number
Expand All @@ -54,7 +54,7 @@ jobs:
BB_VERSION: ${{steps.version_number.outputs.BB_VERSION}}
run: |
source /opt/rh/gcc-toolset-9/enable
.github/actions/build-asset-linux.sh
.github/actions/build-asset-unix.sh
- name: Upload Artifact CentOS x86-64
uses: actions/upload-artifact@v2
Expand All @@ -64,15 +64,15 @@ jobs:
if-no-files-found: error

build-ubuntu-arm64:
runs-on: [ARM64]
runs-on: [ARM64, Linux]
container:
image: ubuntu:20.04
image: chianetwork/ubuntu-20.04-builder:latest
defaults:
run:
shell: bash
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Get Version Number
id: version_number
Expand All @@ -82,13 +82,13 @@ jobs:
run: |
export DEBIAN_FRONTEND=noninteractive
apt update
apt install -y build-essential git cmake libgmp-dev libnuma-dev
apt install -y build-essential git libgmp-dev libnuma-dev
- name: Build
env:
BB_ARTIFACT_NAME: ${{ steps.version_number.outputs.BB_ARTIFACT_NAME }}
BB_VERSION: ${{steps.version_number.outputs.BB_VERSION}}
run: .github/actions/build-asset-linux.sh
run: .github/actions/build-asset-unix.sh

- name: Upload Artifact Ubuntu ARM64
uses: actions/upload-artifact@v2
Expand All @@ -98,12 +98,12 @@ jobs:
if-no-files-found: error

build-centos-arm64:
runs-on: [ARM64]
runs-on: [ARM64, Linux]
container:
image: centos:8
image: quay.io/centos/centos:stream8
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Get Version Number
id: version_number
Expand All @@ -120,7 +120,7 @@ jobs:
BB_VERSION: ${{steps.version_number.outputs.BB_VERSION}}
run: |
source /opt/rh/gcc-toolset-9/enable
.github/actions/build-asset-linux.sh
.github/actions/build-asset-unix.sh
- name: Upload Artifact CentOS ARM64
uses: actions/upload-artifact@v2
Expand All @@ -133,7 +133,7 @@ jobs:
runs-on: windows-2019
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Get Version Number
shell: bash
Expand All @@ -149,7 +149,7 @@ jobs:
mkdir build && cd build
cmake ..
bash -e -o pipefail ../extract-version.sh
bash -e -o pipefail ../embed-version.sh
cat ../src/Version.h
cmake --build . --target bladebit --config Release
Expand All @@ -163,6 +163,7 @@ jobs:
mkdir ../bin
cd Release
ls -la
7z.exe a -tzip ../../bin/${BB_ARTIFACT_NAME} bladebit.exe
ls -la ../../bin
Expand All @@ -173,3 +174,60 @@ jobs:
path: ${{ github.workspace }}/bin/${{ steps.version_number.outputs.BB_ARTIFACT_NAME }}
if-no-files-found: error

build-macos-arm64:
runs-on: [macOS, ARM64]
steps:
- name: Cleanup Environment
uses: Chia-Network/actions/clean-workspace@main

- name: Checkout Repo
uses: actions/checkout@v3

- name: Get Version Number
id: version_number
run: bash -e .github/actions/get-version.sh macos arm64

- name: Install Prerequisites
run: brew install cmake

- name: Build
env:
BB_ARTIFACT_NAME: ${{ steps.version_number.outputs.BB_ARTIFACT_NAME }}
BB_VERSION: ${{steps.version_number.outputs.BB_VERSION}}
run: .github/actions/build-asset-unix.sh

- name: Upload Artifact macOS arm64
uses: actions/upload-artifact@v2
with:
name: ${{ steps.version_number.outputs.BB_ARTIFACT_NAME }}
path: ${{ github.workspace }}/bin/${{ steps.version_number.outputs.BB_ARTIFACT_NAME }}
if-no-files-found: error

build-macos-x86-64:
runs-on: macOS-11
steps:
- name: Cleanup Environment
uses: Chia-Network/actions/clean-workspace@main

- name: Checkout Repo
uses: actions/checkout@v3

- name: Get Version Number
id: version_number
run: .github/actions/get-version.sh macos x86-64

- name: Install Prerequisites
run: brew install cmake

- name: Build
env:
BB_ARTIFACT_NAME: ${{ steps.version_number.outputs.BB_ARTIFACT_NAME }}
BB_VERSION: ${{steps.version_number.outputs.BB_VERSION}}
run: .github/actions/build-asset-unix.sh

- name: Upload Artifact macOS x86-64
uses: actions/upload-artifact@v2
with:
name: ${{ steps.version_number.outputs.BB_ARTIFACT_NAME }}
path: ${{ github.workspace }}/bin/${{ steps.version_number.outputs.BB_ARTIFACT_NAME }}
if-no-files-found: error
65 changes: 65 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '32 4 * * 2'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Build
# uses: github/codeql-action/autobuild@v2
run: |
sudo apt update
sudo apt install -y build-essential cmake libgmp-dev libnuma-dev
cmake . -Bbuild
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Loading

0 comments on commit d647918

Please sign in to comment.