Skip to content

Commit

Permalink
Merge pull request #16 from Chia-Network/python_3.11
Browse files Browse the repository at this point in the history
Python 3.11
  • Loading branch information
emlowe authored Sep 21, 2022
2 parents 7914fc5 + 2fc0221 commit 350fe2f
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 30 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ on:
jobs:
max-cost-checks:
name: Cost checks
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

- uses: actions/setup-python@v2
name: Install Python 3.9
- uses: chia-network/actions/setup-python@main
name: Install Python ${{ matrix.python-version }}
with:
python-version: 3.9
python-version: ${{ matrix.python-version }}

- name: Update pip
run: |
Expand All @@ -38,11 +43,11 @@ jobs:
- name: setup venv
run: |
python -m venv venv
ln -s venv/bin/activate
- uses: chia-network/actions/activate-venv@main

- name: Install dependencies
run: |
. ./activate
python -m pip install maturin
rustup target add x86_64-unknown-linux-musl
python -m pip install pytest
Expand All @@ -52,31 +57,32 @@ jobs:
env:
CC: gcc
run: |
. ./activate
git clone https://github.com/Chia-Network/clvm_tools.git --branch=main --single-branch
python -m pip install ./clvm_tools
python -m pip install colorama
maturin develop --release -m wheel/Cargo.toml
- name: python mypy
run: |
. ./activate
mypy tests/test_*.py
mypy tests
- name: python tests
run: |
. ./activate
pytest tests
- name: test generators
if: matrix.os == 'ubuntu-latest'
# TODO: This should happen everywhere but the benchmarking part is not passing
# on all platforms so this can be revisited separately.
run: |
. ./activate
cd tests
./test-generators.py
- name: Run cost checks
if: matrix.os == 'ubuntu-latest'
# TODO: This should happen everywhere but the benchmarking part is not passing
# on all platforms so this can be revisited separately.
run: |
. ./activate
cd tests
./generate-programs.py
./run-programs.py
65 changes: 52 additions & 13 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,71 @@ jobs:
runs-on:
arm: [Linux, ARM64]
intel: [ubuntu-latest]
options:
arm:
docker-url: quay.io/pypa/manylinux2014_aarch64
manylinux-version: 2014
rustup-target: aarch64-unknown-linux-musl
intel:
docker-url: quay.io/pypa/manylinux2010_x86_64
manylinux-version: 2010
rustup-target: x86_64-unknown-linux-musl
- name: Windows
matrix: windows
runs-on:
intel: [windows-latest]
python:
- major-dot-minor: '3.7'
cibw-build: 'cp37-*'
by-arch:
arm:
manylinux-version: 2014
docker-url: quay.io/pypa/manylinux2014_aarch64
rustup-target: aarch64-unknown-linux-musl
intel:
manylinux-version: 2010
docker-url: quay.io/pypa/manylinux2010_x86_64
rustup-target: x86_64-unknown-linux-musl
matrix: '3.7'
- major-dot-minor: '3.8'
cibw-build: 'cp38-*'
by-arch:
arm:
manylinux-version: 2014
docker-url: quay.io/pypa/manylinux2014_aarch64
rustup-target: aarch64-unknown-linux-musl
intel:
manylinux-version: 2010
docker-url: quay.io/pypa/manylinux2010_x86_64
rustup-target: x86_64-unknown-linux-musl
matrix: '3.8'
- major-dot-minor: '3.9'
cibw-build: 'cp39-*'
by-arch:
arm:
manylinux-version: 2014
docker-url: quay.io/pypa/manylinux2014_aarch64
rustup-target: aarch64-unknown-linux-musl
intel:
manylinux-version: 2010
docker-url: quay.io/pypa/manylinux2010_x86_64
rustup-target: x86_64-unknown-linux-musl
matrix: '3.9'
- major-dot-minor: '3.10'
cibw-build: 'cp310-*'
by-arch:
arm:
manylinux-version: 2014
docker-url: quay.io/pypa/manylinux2014_aarch64
rustup-target: aarch64-unknown-linux-musl
intel:
manylinux-version: 2010
docker-url: quay.io/pypa/manylinux2010_x86_64
rustup-target: x86_64-unknown-linux-musl
matrix: '3.10'
- major-dot-minor: '3.11'
cibw-build: 'cp311-*'
by-arch:
arm:
manylinux-version: 2014
docker-url: quay.io/pypa/manylinux2014_aarch64
rustup-target: aarch64-unknown-linux-musl
intel:
manylinux-version: 2014
docker-url: quay.io/pypa/manylinux2014_x86_64
rustup-target: x86_64-unknown-linux-musl
matrix: '3.11'
arch:
- name: ARM
matrix: arm
Expand Down Expand Up @@ -137,23 +176,23 @@ jobs:
. venv/bin/activate
maturin build -i python --release -m wheel/Cargo.toml
- name: Build Linux in manylinux2010 with maturin on Python ${{ matrix.python }}
- name: Build Linux with maturin on Python ${{ matrix.python }}
if: matrix.os.matrix == 'ubuntu'
run: |
podman run --rm=true \
-v ${{ github.workspace }}:/ws:rw --workdir=/ws \
${{ matrix.os.options[matrix.arch.matrix].docker-url }} \
${{ matrix.python.by-arch[matrix.arch.matrix].docker-url }} \
bash -exc '\
curl -L https://sh.rustup.rs > rustup-init.sh && \
sh rustup-init.sh -y && \
yum -y install openssl-devel && \
source $HOME/.cargo/env && \
rustup target add ${{ matrix.os.options[matrix.arch.matrix].rustup-target }} && \
rustup target add ${{ matrix.python.by-arch[matrix.arch.matrix].rustup-target }} && \
python${{ matrix.python.major-dot-minor }} -m venv /venv && \
. /venv/bin/activate && \
pip install --upgrade pip && \
pip install maturin && \
CC=gcc maturin build --release --manylinux ${{ matrix.os.options[matrix.arch.matrix].manylinux-version }} -m wheel/Cargo.toml \
CC=gcc maturin build --release --manylinux ${{ matrix.python.by-arch[matrix.arch.matrix].manylinux-version }} -m wheel/Cargo.toml \
'
python -m venv venv
ln -s venv/bin/activate
Expand Down
5 changes: 5 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[mypy-clvm.*]
ignore_missing_imports = True

[mypy-colorama.*]
ignore_missing_imports = True
10 changes: 5 additions & 5 deletions tests/run-programs.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@

print(' '.join(command))
start = time.perf_counter()
proc = subprocess.run(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
output = proc.stderr.decode('UTF-8')
output += proc.stdout.decode('UTF-8')
completed_process = subprocess.run(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
output = completed_process.stderr.decode('UTF-8')
output += completed_process.stdout.decode('UTF-8')
end = time.perf_counter()

if 'FAIL: ' not in output or 'cost exceeded' not in output:
Expand All @@ -77,8 +77,8 @@
if 'maxresident)k' not in l:
continue
size = int(l.split('maxresident)k')[0].split(' ')[-1]) / 1024
if size != None:
print(Fore.YELLOW + (' Resident Size: %d MiB' % size) + Style.RESET_ALL)
if size is not None:
print(Fore.YELLOW + f' Resident Size: {size:.0f} MiB' + Style.RESET_ALL)

if size > 2300:
ret += 1
Expand Down

0 comments on commit 350fe2f

Please sign in to comment.