Skip to content

Commit

Permalink
Update this program generator for current base
Browse files Browse the repository at this point in the history
  • Loading branch information
prozacchiwawa committed Oct 25, 2023
2 parents ba6a202 + 15206a4 commit 0639f72
Show file tree
Hide file tree
Showing 152 changed files with 17,143 additions and 1,149 deletions.
45 changes: 34 additions & 11 deletions .github/workflows/build-m1-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,32 @@ jobs:
name: wheels
path: ./target/wheels

- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_AWS_SECRET
if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi
echo HAS_AWS_SECRET=${HAS_AWS_SECRET} >>$GITHUB_OUTPUT
env:
AWS_SECRET: "${{ secrets.CHIA_AWS_ACCOUNT_ID }}"
upload:
name: Upload to 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: Install python
uses: Chia-Network/actions/setup-python@main
with:
python-version: "3.10"

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: wheels
path: ./target/wheels/

- name: publish (PyPi)
if: env.RELEASE == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
Expand All @@ -142,6 +152,17 @@ jobs:
packages-dir: target/wheels/
skip-existing: true

- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_AWS_SECRET
if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi
echo HAS_AWS_SECRET=${HAS_AWS_SECRET} >>$GITHUB_OUTPUT
env:
AWS_SECRET: "${{ secrets.CHIA_AWS_ACCOUNT_ID }}"

- name: Configure AWS credentials
if: steps.check_secrets.outputs.HAS_AWS_SECRET
uses: aws-actions/configure-aws-credentials@v2
Expand All @@ -151,8 +172,10 @@ jobs:

- name: Publish Dev
if: steps.check_secrets.outputs.HAS_AWS_SECRET && github.ref == 'refs/heads/dev'
shell: bash
working-directory: ./target/wheels
run: |
FILES=$(find ${{ github.workspace }}/target/wheels -type f -name '*.whl')
FILES=$(find . -type f -name '*.whl')
while IFS= read -r file; do
filename=$(basename $file)
aws --no-progress s3 cp "$file" "s3://download.chia.net/simple-dev/clvm-tools-rs/$filename"
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/build-riscv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: QEMU Build and test riscv64 crate

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

jobs:
build_crate:
name: Build riscv64 crate and run tests
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
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: riscv64

- 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 '\
cargo test --release
'
build_wheels:
name: QEMU riscv64 wheel
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
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: riscv64

- name: Build
run: |
docker run --rm --platform linux/riscv64 \
-v ${{ github.workspace }}:/ws --workdir=/ws \
chianetwork/ubuntu-22.04-risc-builder:latest \
bash -exc '\
pyenv global 3.10
python -m venv venv && \
source ./venv/bin/activate && \
pip install --upgrade pip && \
pip install --extra-index-url https://pypi.chia.net/simple/ maturin==1.2.3 && \
maturin build -i python --release --strip \
'
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: packages
path: ./target/wheels/

82 changes: 59 additions & 23 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,43 +223,70 @@ jobs:
rustup component add llvm-tools-preview
python ./resources/coverage/run_coverage.py --require-percent 60
- name: Build alpine wheel via docker
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8')
run: |
cd resources/alpine && docker build -t clvm-tools-rs-alpine .
docker run -v ${GITHUB_WORKSPACE}:/root/clvm_tools_rs -t clvm-tools-rs-alpine sh /root/build-alpine.sh
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: ./target/wheels/

- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_AWS_SECRET
if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi
echo HAS_AWS_SECRET=${HAS_AWS_SECRET} >>$GITHUB_OUTPUT
env:
AWS_SECRET: "${{ secrets.CHIA_AWS_ACCOUNT_ID }}"
upload:
name: Upload to 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: publish (PyPi)
- name: Install python
uses: Chia-Network/actions/setup-python@main
with:
python-version: "3.10"

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: wheels
path: ./target/wheels/

- name: Publish distribution to PyPI
if: env.RELEASE == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: target/wheels/
skip-existing: true

- name: publish (Test PyPi)
- name: Publish distribution to Test PyPI
if: env.PRE_RELEASE == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: target/wheels/
skip-existing: true

- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_AWS_SECRET
if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi
echo HAS_AWS_SECRET=${HAS_AWS_SECRET} >>$GITHUB_OUTPUT
env:
AWS_SECRET: "${{ secrets.CHIA_AWS_ACCOUNT_ID }}"

- name: Configure AWS credentials
if: steps.check_secrets.outputs.HAS_AWS_SECRET
uses: aws-actions/configure-aws-credentials@v2
Expand All @@ -278,12 +305,6 @@ jobs:
aws --no-progress s3 cp "$file" "s3://download.chia.net/simple-dev/clvm-tools-rs/$filename"
done <<< "$FILES"
- name: Build alpine wheel via docker
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8')
run: |
cd resources/alpine && docker build -t clvm-tools-rs-alpine .
docker run -v ${GITHUB_WORKSPACE}:/root/clvm_tools_rs -t clvm-tools-rs-alpine sh /root/build-alpine.sh
fmt:
runs-on: ubuntu-20.04
name: cargo fmt
Expand Down Expand Up @@ -337,11 +358,26 @@ jobs:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
- name: Install tarpaulin
run: cargo +nightly install cargo-tarpaulin
- name: Run tarpaulin
run: cargo tarpaulin --no-dead-code --engine llvm --workspace --all-features --ignore-panics --out Lcov
toolchain: stable
- name: Run for coverage
run: |
sudo apt-get update
sudo apt-get install lcov -y
rustup component add llvm-tools-preview
cargo install grcov
export RUSTFLAGS="-Cinstrument-coverage"
export LLVM_PROFILE_FILE=$(pwd)/target/clvm_tools_rs-%p-%m.profraw
export CARGO_TARGET_DIR=$(pwd)/target
cargo test --release --workspace
python -m venv venv
source venv/bin/activate
git clone https://github.com/Chia-Network/clvm_tools.git --branch=main --single-branch
pip install ./clvm_tools
pip install maturin pytest
maturin develop --release
(cd resources/tests/cmdline/tests && pytest)
grcov . --binary-path target -s . --branch --ignore-not-existing --ignore='*/.cargo/*' --ignore='*/tests/*' -o rust_cov.info
python -c 'with open("rust_cov.info") as f: lines = [l for l in f if not (l.startswith("DA:") and int(l.split(",")[1].strip()) >= 2**63)]; open("lcov.info", "w").writelines(lines)'
- name: Upload to Coveralls
uses: coverallsapp/github-action@v2
if: always()
Expand Down
Loading

0 comments on commit 0639f72

Please sign in to comment.