Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change from using quay.io image and using the rustup script to a docker imag… #319

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
70 changes: 41 additions & 29 deletions .github/workflows/build-arm64-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ on:

jobs:
build_wheels:
name: ARM64 Python Wheels on ARM64 Ubuntu
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [[ARM64, Linux]]
name: Build ARM64 Python Wheels
runs-on: [ARM64, Linux]
container:
image: ghcr.io/chia-network/build-images/centos-pypa-rust-aarch64:latest

steps:
- uses: Chia-Network/actions/clean-workspace@main
Expand All @@ -27,45 +26,58 @@ jobs:
with:
fetch-depth: 1

- name: Setup for python wheel build
run: |
echo "${PATH}"
yum -y install openssl-devel
source /root/.cargo/env
rustup default stable
rustup target add aarch64-unknown-linux-musl
rm -rf venv
export PATH="${PATH}:/opt/python/cp39-cp39/bin/:/opt/python/cp38-cp38/bin/:/opt/python/cp37-cp37m/bin/"

- name: Build Python wheels
run: |
docker run --rm \
-v ${{ github.workspace }}:/ws --workdir=/ws \
quay.io/pypa/manylinux2014_aarch64 \
bash -exc '\
echo $PATH && \
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 aarch64-unknown-linux-musl && \
rm -rf venv && \
export PATH=/opt/python/cp310-cp310/bin/:$PATH && \
export PATH=/opt/python/cp39-cp39/bin/:$PATH && \
export PATH=/opt/python/cp38-cp38/bin/:$PATH && \
export PATH=/opt/python/cp37-cp37m/bin/:$PATH && \
/opt/python/cp38-cp38/bin/python -m venv venv && \
if [ ! -f "activate" ]; then ln -s venv/bin/activate; fi && \
. ./activate && \
pip install maturin && \
CC=gcc maturin build -m wheel/Cargo.toml --release --strip --manylinux 2014 --features=openssl \
'
cd wheel
/opt/python/cp38-cp38/bin/python -m venv venv
if [ ! -f "activate" ]; then ln -s venv/bin/activate; fi
. ./activate
pip install maturin==0.12.20
CC=gcc maturin build --release --strip --manylinux 2014 --no-sdist --cargo-extra-args=--all-features

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: target/wheels/

- name: Clean up ARM64
if: startsWith(matrix.os, 'ARM64')
run: |
rm -rf venv
rm -rf dist

publish_wheels:
name: Publish ARM64 Python Wheels
runs-on: ubuntu-latest
needs: build_wheels

steps:
- name: Fetch wheels from previous job
uses: actions/download-artifact@v3
with:
name: wheels
path: target/wheels/

- name: Install Twine
run: |
if [ ! -f "venv" ]; then sudo rm -rf venv; fi
sudo apt-get install python3-venv python3-pip -y
python3 -m venv venv
if [ ! -f "activate" ]; then ln -s venv/bin/activate; fi
. ./activate
pip install setuptools_rust
pip install twine
pip3 install setuptools_rust
pip3 install twine

- name: Test for secrets access
id: check_secrets
Expand All @@ -77,7 +89,7 @@ jobs:
env:
SECRET: "${{ secrets.test_pypi_password }}"

- name: publish (PyPi)
- name: Publish (PyPi)
if: startsWith(github.event.ref, 'refs/tags') && steps.check_secrets.outputs.HAS_SECRET
env:
TWINE_USERNAME: __token__
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/build-m1-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@ jobs:

- name: Set up rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust.sh
arch -arm64 sh rust.sh -y
curl https://static.rust-lang.org/rustup/dist/aarch64-apple-darwin/rustup-init.sha256 | awk '{print $1 " *rustup-init"}' > checksum.txt
curl -O https://static.rust-lang.org/rustup/dist/aarch64-apple-darwin/rustup-init
cat checksum.txt
shasum -a 256 -c checksum.txt

- name: Install rust
run: |
chmod +x rustup-init
./rustup-init -y || (echo "Rust is already installed. Exiting..." && exit 2)
rm rustup-init checksum.txt

- name: Build m1 wheels
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ jobs:
run: |
docker run --rm \
-v ${{ github.workspace }}:/ws --workdir=/ws \
quay.io/pypa/manylinux2014_x86_64 \
ghcr.io/chia-network/build-images/centos-pypa-rust-x86_64 \
bash -exc '\
curl -L https://sh.rustup.rs > rustup-init.sh && \
sh rustup-init.sh -y && \
yum -y --disablerepo=epel install openssl-devel && \
source $HOME/.cargo/env && \
rustup target add x86_64-unknown-linux-musl && \
Expand Down Expand Up @@ -194,13 +192,15 @@ jobs:
cargo fmt -- --files-with-diff --check
- name: clippy
run: |
rustup update
cd fuzz
cargo clippy
- name: cargo-fuzz
run: cargo +nightly install cargo-fuzz
# TODO: it would be nice to save and restore the corpus between runs
- name: build corpus
run: |
cargo update -p proc-macro2 # Temporary fix to get the nightly build to run correctly
pmaslana marked this conversation as resolved.
Show resolved Hide resolved
cd tools
cargo run --bin generate-fuzz-corpus
- name: build
Expand Down