From 2f4ae194ac8fe08b80e2b1a8097c2467d97710d7 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 13 Mar 2024 10:32:31 -0400 Subject: [PATCH 1/5] remove dead docker run in build step --- .github/workflows/build-test.yml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 6fa0cc7f..aaf7902a 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -62,27 +62,6 @@ jobs: - name: Build Linux in manylinux2010 with maturin on Python ${{ matrix.python }} if: startsWith(matrix.os, 'ubuntu') run: | - docker run --rm \ - -v ${{ github.workspace }}:/ws --workdir=/ws \ - ghcr.io/chia-network/build-images/centos-pypa-rust-x86_64 \ - bash -exc '\ - yum -y install libc6 openssl-devel && \ - source $HOME/.cargo/env && \ - rustup target add x86_64-unknown-linux-musl && \ - rm -rf venv && \ - PY_VERSION=${{ matrix.python }} - PY_VERSION=${PY_VERSION/.} && \ - echo "Python version with dot removed is $PY_VERSION" && \ - if [ "$PY_VERSION" = "37" ]; \ - then export SCND_VERSION="${PY_VERSION}m"; \ - else export SCND_VERSION="$PY_VERSION"; fi && \ - echo "Exporting path /opt/python/cp$PY_VERSION-cp$SCND_VERSION/bin" && \ - export PATH=/opt/python/cp$PY_VERSION-cp$SCND_VERSION/bin/:$PATH && \ - /opt/python/cp38-cp38/bin/python -m venv venv && \ - if [ ! -f "activate" ]; then ln -s venv/bin/activate; fi && \ - . ./activate && \ - pip install --upgrade pip - ' docker run --rm -v $(pwd):/io ghcr.io/pyo3/maturin:v1.1.0 build --release --strip --manylinux 2014 # Refresh in case any ownerships changed. mv target target.docker && cp -r target.docker target From 175c5ab6e0045281fa2c9589294e35db77cd38ae Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 13 Mar 2024 10:42:36 -0400 Subject: [PATCH 2/5] fixup --- .github/workflows/build-test.yml | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index aaf7902a..bf70a8c5 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -49,19 +49,24 @@ jobs: run: | python -m pip install maturin==1.1.0 + - uses: chia-network/actions/create-venv@main + id: create-venv + + - uses: chia-network/actions/activate-venv@main + with: + directories: ${{ steps.create-venv.outputs.activate-venv-directories }} + - name: Build MacOs with maturin on Python ${{ matrix.python }} if: startsWith(matrix.os, 'macos') env: MACOSX_DEPLOYMENT_TARGET: '11.0' run: | - python -m venv venv - ln -s venv/bin/activate - . ./activate maturin build -i python --release --strip - name: Build Linux in manylinux2010 with maturin on Python ${{ matrix.python }} if: startsWith(matrix.os, 'ubuntu') run: | + # TODO: does this need to be outside the env? docker run --rm -v $(pwd):/io ghcr.io/pyo3/maturin:v1.1.0 build --release --strip --manylinux 2014 # Refresh in case any ownerships changed. mv target target.docker && cp -r target.docker target @@ -71,9 +76,6 @@ jobs: - name: Build Windows with maturin on Python ${{ matrix.python }} if: startsWith(matrix.os, 'windows') run: | - python -m venv venv - echo ". .\venv\Scripts\Activate.ps1" > activate.ps1 - . ./activate maturin build -i python --release --strip # Find and install the newly built wheel pip install --no-index --find-links target/wheels/ clvm_tools_rs @@ -81,7 +83,6 @@ jobs: - name: Install clvm_tools_rs wheel if: ${{ !startsWith(matrix.os, 'windows') }} run: | - . ./activate ls target/wheels/ # this mess puts the name of the `.whl` file into `$WHEEL_PATH` # remove the dot, use the `glob` lib to grab the file from the directory @@ -91,13 +92,11 @@ jobs: - name: Install other wheels run: | - . ./activate python -m pip install pytest python -m pip install blspy - name: install clvm & clvm_tools run: | - . ./activate git clone https://github.com/Chia-Network/clvm.git --branch=main --single-branch python -m pip install ./clvm @@ -112,7 +111,6 @@ jobs: - name: Ensure clvm, clvm_rs, clvm_tools_rs are installed run: | - . ./activate python -c 'import clvm' python -c 'import clvm; print(clvm.__file__)' python -c 'import clvm_rs; print(clvm_rs.__file__)' @@ -122,7 +120,6 @@ jobs: # Test cldb output both run from python and via its command line tool. - name: "Run step run tests" run: | - . ./activate cargo build # This finds and installs a compatible wheel from the target directory on linux. # We do it here as a hedge against changes in the python environment that might @@ -135,7 +132,6 @@ jobs: - name: "Test step run with mandelbrot, setting print only" run: | - . ./activate python ./resources/tests/lib/steprun.py ./resources/tests/mandelbrot/mandelbrot.clvm.hex resources/tests/mandelbrot/mand_args.txt ./resources/tests/mandelbrot/mandelbrot.sym > mand_output.txt # git diff invoked this way returns 0 (as /bin/true) if there is no difference or 1 if there is. git diff --no-index -s --quiet -- mand_output.txt ./resources/tests/mandelbrot/mand_test.txt @@ -148,7 +144,6 @@ jobs: if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8') run: | set -x - . ./activate # Build cmd line tools PYO3_PYTHON=`which python` cargo build --release @@ -170,6 +165,7 @@ jobs: - name: Test Classic command line tools with pytest if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8') run: | + # TODO: does this need to be outside the env? python -m pip install pytest # This script installs the wheel built during this workflow. pip install --no-index --find-links wheel/target/wheels/ clvm_tools_rs @@ -179,7 +175,6 @@ jobs: - name: Verify recompilation of cl21 sources if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8') run: | - . ./activate # We need chia-rs for the following. pip install chia-rs # Ensure we're using the sources we have. This is a hedge against @@ -191,23 +186,21 @@ jobs: - name: Verify recompilation follows date and modification rules if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8') run: | + # TODO: does this need to be outside the env? pip install --no-index --find-links wheel/target/wheels/ clvm_tools_rs python resources/tests/test-clvm-recompile-behavior.py - name: Install pytest run: | - . ./activate pip install pytest pytest-asyncio - name: Run tests from clvm run: | - . ./activate cd clvm pytest tests - name: Run tests from clvm_tools run: | - . ./activate cd clvm_tools pytest tests From 0c47527a6980d1aaa1e0309d0f90da6759d2dde1 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 13 Mar 2024 13:22:26 -0400 Subject: [PATCH 3/5] touchup --- .github/workflows/build-test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index bf70a8c5..f48dad16 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -66,7 +66,6 @@ jobs: - name: Build Linux in manylinux2010 with maturin on Python ${{ matrix.python }} if: startsWith(matrix.os, 'ubuntu') run: | - # TODO: does this need to be outside the env? docker run --rm -v $(pwd):/io ghcr.io/pyo3/maturin:v1.1.0 build --release --strip --manylinux 2014 # Refresh in case any ownerships changed. mv target target.docker && cp -r target.docker target @@ -165,8 +164,6 @@ jobs: - name: Test Classic command line tools with pytest if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8') run: | - # TODO: does this need to be outside the env? - python -m pip install pytest # This script installs the wheel built during this workflow. pip install --no-index --find-links wheel/target/wheels/ clvm_tools_rs # TODO: bring in the other tests in resources/tests/cmdline/tests besides cmds_test.py From 896d8705128e91b30442ba44affea61461207197 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 13 Mar 2024 13:51:14 -0400 Subject: [PATCH 4/5] touchup --- .github/workflows/build-test.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index f48dad16..1d10491b 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -36,19 +36,11 @@ jobs: with: python-version: ${{ matrix.python }} - - name: Update pip - run: | - python -m pip install --upgrade pip - - name: Set up rust uses: actions-rs/toolchain@v1 with: toolchain: stable - - name: Install dependencies - run: | - python -m pip install maturin==1.1.0 - - uses: chia-network/actions/create-venv@main id: create-venv @@ -56,6 +48,11 @@ jobs: with: directories: ${{ steps.create-venv.outputs.activate-venv-directories }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install maturin==1.1.0 + - name: Build MacOs with maturin on Python ${{ matrix.python }} if: startsWith(matrix.os, 'macos') env: @@ -183,7 +180,6 @@ jobs: - name: Verify recompilation follows date and modification rules if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8') run: | - # TODO: does this need to be outside the env? pip install --no-index --find-links wheel/target/wheels/ clvm_tools_rs python resources/tests/test-clvm-recompile-behavior.py From 0b579c5d1f5a8ba69ac2587c723714be3cbc3334 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 13 Mar 2024 14:07:03 -0400 Subject: [PATCH 5/5] touchup --- .github/workflows/build-test.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 1d10491b..d8b6baa1 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -31,16 +31,16 @@ jobs: with: fetch-depth: 0 - - uses: actions/setup-python@v4 - name: Install Python ${{ matrix.python }} - with: - python-version: ${{ matrix.python }} - - name: Set up rust uses: actions-rs/toolchain@v1 with: toolchain: stable + - uses: actions/setup-python@v4 + name: Install Python ${{ matrix.python }} + with: + python-version: ${{ matrix.python }} + - uses: chia-network/actions/create-venv@main id: create-venv @@ -161,6 +161,7 @@ jobs: - name: Test Classic command line tools with pytest if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.python, '3.8') run: | + python -m pip install pytest # This script installs the wheel built during this workflow. pip install --no-index --find-links wheel/target/wheels/ clvm_tools_rs # TODO: bring in the other tests in resources/tests/cmdline/tests besides cmds_test.py