Skip to content

Commit

Permalink
chore: Updated CI's maturin, ARM building on MacOS 14, and book versions
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidmt committed May 2, 2024
1 parent 46af3a9 commit 18b789e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
20 changes: 13 additions & 7 deletions .github/scripts/find_compatible_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,29 @@
description="Program to find wheels in a directory compatible with the current version of Python"
)

parser.add_argument("package", help="The name of the package that you are searching for a wheel for")
parser.add_argument(
"package", help="The name of the package that you are searching for a wheel for"
)
parser.add_argument("dir", help="the directory under which to search for the wheels")

args=parser.parse_args()
args = parser.parse_args()

wheel=None
wheel = None

for tag in sys_tags():
print(f"Looking for file matching tag {tag}", file=sys.stderr)
matches=glob.glob(args.package + "*" + str(tag) + "*.whl", root_dir=args.dir)
matches = glob.glob(args.package + "*" + str(tag) + "*.whl", root_dir=args.dir)
if len(matches) == 1:
wheel=matches[0]
wheel = matches[0]
break
elif len(matches) > 1:
print("Found multiple matches for the same tag " + str(tag), matches, file=sys.stderr)
print(
f"Found multiple matches for the same tag `{tag}`",
matches,
file=sys.stderr,
)

if wheel:
if wheel:
print(os.path.join(args.dir, wheel))
else:
sys.exit("Did not find compatible wheel")
24 changes: 13 additions & 11 deletions .github/workflows/python-build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
defaults:
run:
working-directory: pylace

steps:
- uses: actions/checkout@v4

Expand All @@ -30,7 +30,7 @@ jobs:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: "pylace/requirements-lint.txt"

- name: Install Python dependencies
run: |
pip install --upgrade pip
Expand Down Expand Up @@ -102,18 +102,18 @@ jobs:
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
maturin-version: 1.5.1
target: ${{ matrix.target }}
args: --release --out dist -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12 --manifest-path pylace/Cargo.toml
manylinux: auto

- name: Install dev dependencies
run: |
pip install --upgrade pip
pip install -r pylace/requirements-dev.txt
- name: Install pylace
run: |
ls -l ./dist
WHEEL_FILE=$(python3 .github/scripts/find_compatible_wheel.py pylace ./dist)
echo "Installing $WHEEL_FILE"
pip install $WHEEL_FILE
Expand Down Expand Up @@ -147,17 +147,17 @@ jobs:
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
maturin-version: 1.5.1
target: ${{ matrix.target }}
args: --release --out dist -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12 --manifest-path pylace/Cargo.toml

- name: Install dev dependencies
run: |
pip install --upgrade pip
pip install -r pylace/requirements-dev.txt
- name: Install pylace
run: |
ls -l ./dist
$WHEEL_FILE = (python3 .github/scripts/find_compatible_wheel.py pylace ./dist)
echo "Installing $WHEEL_FILE"
pip install $WHEEL_FILE
Expand All @@ -172,11 +172,15 @@ jobs:
path: dist

macos:
runs-on: macos-latest
needs: ["lint-python", "lint-rust"]
strategy:
matrix:
target: [x86_64, aarch64]
include:
- os: macos-latest
target: aarch64
- os: macos-13
target: x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -190,24 +194,22 @@ jobs:
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
maturin-version: 1.5.1
target: ${{ matrix.target }}
args: --release --out dist -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12 --manifest-path pylace/Cargo.toml

- name: Install dev dependencies
if: ${{ matrix.target != 'aarch64' }}
run: |
pip install --upgrade pip
pip install -r pylace/requirements-dev.txt
- name: Install pylace
if: ${{ matrix.target != 'aarch64' }}
run: |
WHEEL_FILE=$(python3 .github/scripts/find_compatible_wheel.py pylace ./dist)
echo "Installing $WHEEL_FILE"
pip install $WHEEL_FILE
- name: Run Tests
if: ${{ matrix.target != 'aarch64' }}
run: pytest pylace/tests

- name: Upload wheels
Expand Down
4 changes: 2 additions & 2 deletions book/lace_preprocess_mdbook_yaml/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ path = "src/main.rs"
anyhow = "1.0"
clap = "4.2"
env_logger = "0.10"
lace_codebook = { path = "../../lace/lace_codebook", version = "0.6.0" }
lace_stats = { path = "../../lace/lace_stats", version = "0.3.0" }
lace_codebook = { path = "../../lace/lace_codebook", version = "0.7.0" }
lace_stats = { path = "../../lace/lace_stats", version = "0.4.0" }
log = "0.4"
mdbook = "0.4"
pulldown-cmark = { version = "0.9", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion pylace/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=0.13,<0.14"]
requires = ["maturin>=1.0,<2"]
build-backend = "maturin"

[project]
Expand Down

0 comments on commit 18b789e

Please sign in to comment.