Skip to content

Merge pull request #2861 from CounterpartyXCP/severity #3350

Merge pull request #2861 from CounterpartyXCP/severity

Merge pull request #2861 from CounterpartyXCP/severity #3350

name: PyTest
on:
push:
branches:
- "**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PYTHON_VERSION: "3.10"
COUNTERPARTY_RS_DIR: "./counterparty-rs"
jobs:
macos-m1:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
# Install dependencies
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Install Python 3.10 and leveldb
run: |
brew install rustup [email protected] leveldb
brew reinstall rustup
echo '/opt/homebrew/opt/[email protected]/libexec/bin' >> $GITHUB_PATH
- name: Install pytest and build module
run: |
python3.10 -m pip install pytest hatchling==1.25.0 hatch==1.13.0
python3.10 -m pip install --upgrade build
# Build counterparty packages
- name: Test counterparty-rs
run: |
cd ${{ env.COUNTERPARTY_RS_DIR }}
cargo test
- name: Build counterparty-rs
uses: messense/maturin-action@v1
with:
args: --release --out dist --sdist -m ${{ env.COUNTERPARTY_RS_DIR }}/Cargo.toml
- name: Build counterparty-core
run: |
cd counterparty-core && hatch build ../dist
# Install counterparty packages
- name: Install wheels
run: |
export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib"
export CPATH="$CPATH:$(brew --prefix)/include"
python3.10 -m pip install dist/*.whl --force-reinstall
# Run counterparty-core tests
- name: Run counterparty-core tests
run: |
cd counterparty-core
hatch run pytest
# Upload wheels
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: macos-m1-wheels
path: dist
ubuntu-22-04:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
# Install dependencies
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
- name: Install Rust
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install leveldb
run: |
sudo apt-get install -y libleveldb-dev
- name: Install pytest and build module
run: |
pip install pytest hatchling==1.25.0 hatch==1.13.0
python -m pip install --upgrade build
# Build counterparty packages
- name: Test counterparty-rs
run: |
cd ${{ env.COUNTERPARTY_RS_DIR }}
cargo test
- name: Build counterparty-rs
uses: messense/maturin-action@v1
with:
args: --release --out dist --sdist -m ${{ env.COUNTERPARTY_RS_DIR }}/Cargo.toml
- name: Build counterparty-core
run: |
cd counterparty-core && hatch build ../dist
# Install counterparty packages
- name: Install wheels
run: |
pip install dist/*.whl --force-reinstall
# Run counterparty-core tests
- name: Run counterparty-core tests
run: |
cd counterparty-core
pytest
# Upload wheels
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: ubuntu-22-04-wheels
path: dist