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

Create an action to push some ARM builds to PyPI #306

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/workflows/build_upload_pypi_arm_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build and upload PyPI wheels for ARM Mac

on:
workflow_dispatch:

jobs:
build:
strategy:
matrix:
os: [macos-latest]
python-version: ['3.10', '3.11']
include:
- os: macos-latest
wheelname: macos
# Build wheels against the lowest compatible Numpy version
- python-version: 3.10
numpy-version: 1.21.3
- python-version: 3.11
numpy-version: 1.23.2
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
ref: v1.3.2
fetch-depth: 0 # Ensure tags are fetched for versioning
- name: Setup Python ${{ matrix.python-version }} with Conda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge,defaults
channel-priority: true
- name: Update Python pip, wheel, and twine
shell: bash -l {0}
run: |
python -m pip install --upgrade pip wheel twine
- name: Install llvm on Macos
if: startsWith(matrix.os, 'macos')
run: brew install llvm

- name: Build Python wheel

if: matrix.os != 'ubuntu-latest'
shell: bash -l {0}
env:
NUMPY_VERSION: ${{ matrix.numpy-version }}
run: |
# Build against lowest required Numpy version
python -m pip install numpy==${NUMPY_VERSION}
python -m pip wheel . -w wheelhouse --no-deps

- name: Upload wheels as build artifacts
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.wheelname }}-${{ matrix.python-version }}
path: wheelhouse/*-${{ matrix.wheelname }}*.whl

publish:
needs: build
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/euphonic
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # This is possibly unnecessary?

- name: Download artifacts to Ubuntu environment
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true

- name: List Files
run: ls -R

- name: Upload wheels to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
10 changes: 5 additions & 5 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.8
channels: conda-forge,defaults
Expand All @@ -36,7 +36,7 @@ jobs:
run: python -m tox -c release_tox.ini
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Unit test results ${{ matrix.os }}
path: tests_and_analysis/test/reports/junit_report*.xml
Expand All @@ -47,7 +47,7 @@ jobs:
if: success() || failure()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish test results
Expand Down
18 changes: 15 additions & 3 deletions release_tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,28 @@ commands_pre =
commands = {[testenv]test_command}


[testenv:pypi-{py38,py39,py310,py311}]
[testenv:pypi-{py38}]
install_command = python -m pip install {opts} {packages}
deps =
-r{toxinidir}/tests_and_analysis/tox_requirements.txt
commands_pre =
python -m pip install \
--force-reinstall \
'euphonic[matplotlib,phonopy_reader,brille]=={env:EUPHONIC_VERSION}' \
--only-binary 'euphonic'
python -m pip install numpy==1.24
commands = {[testenv]test_command}

[testenv:pypi-{py39,py310,py311}]
install_command = python -m pip install {opts} {packages}
deps =
numpy
-r{toxinidir}/tests_and_analysis/tox_requirements.txt
commands_pre =
python -m pip install \
--force-reinstall \
'euphonic[matplotlib,phonopy_reader,brille]=={env:EUPHONIC_VERSION}' \
--only-binary 'euphonic'
python -m pip install numpy==1.26
commands = {[testenv]test_command}

[testenv:pypi-py38-min]
Expand Down Expand Up @@ -74,7 +86,7 @@ conda_channels =
conda_deps =
--file={toxinidir}/tests_and_analysis/tox_requirements.txt
commands_pre =
conda install numpy=1.20
conda install numpy=1.22
conda install -c conda-forge euphonic={env:EUPHONIC_VERSION} matplotlib-base pyyaml h5py
# Brille not available on conda
commands = {[testenv]test_command} -m "not brille"
2 changes: 1 addition & 1 deletion tests_and_analysis/tox_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mock
pytest~=7.0
pytest == 7.*
coverage
pytest-mock
pytest-lazy-fixture
Expand Down
Loading