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

Fix CI for MacOS and Numpy2.0 #158

Merged
merged 5 commits into from
Sep 18, 2024
Merged
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
46 changes: 6 additions & 40 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,13 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: [cp37, cp38, cp39, cp310]
os: [ubuntu-latest, windows-latest, macos-13]
python: [cp37, cp38, cp39, cp310, cp311, cp312]

exclude:
# MacOS 14.4.1 for arm64 doesn't support Python < 3.8
- os: macos-latest
python: "cp37"

include:
# Put coverage and results files in the project directory for mac
- os: macos-latest
- os: macos-13
cov_file: "{project}/dist/coverage.xml"
results_file: "{project}/dist/pytest-results.xml"
# And for windows
Expand All @@ -74,11 +70,6 @@ jobs:
- os: ubuntu-latest
cov_file: /output/coverage.xml
results_file: /output/pytest-results.xml
# MacOS 13 required for Python < 3.8
- os: macos-13
python: "cp37"
cov_file: "{project}/dist/coverage.xml"
results_file: "{project}/dist/pytest-results.xml"

name: build/${{ matrix.os }}/${{ matrix.python }}
runs-on: ${{ matrix.os }}
Expand All @@ -97,8 +88,7 @@ jobs:
python-version: "3.12"

- name: Install Python Dependencies
# Pin cibuildwheel due to https://github.com/pypa/cibuildwheel/issues/962
run: pip install build cibuildwheel>=2.3.1
run: pip install build cibuildwheel>=2.16.2

- name: Build Wheel
run: cibuildwheel --output-dir dist
Expand Down Expand Up @@ -127,37 +117,13 @@ jobs:
name: ${{ matrix.os }}/${{ matrix.python }}
directory: dist

- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Unit Test Results (${{ matrix.os }}-${{ matrix.python }})
path: dist/pytest-results.xml

publish-test-results:
name: Publish Unit Tests Results
needs: build
runs-on: ubuntu-latest
if: always()

steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
files: artifacts/**/*.xml

test-sdist:
needs: [sdist]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: [cp37, cp38, cp39, cp310]
os: [ubuntu-latest, windows-latest, macos-13]
python: [cp37, cp38, cp39, cp310, cp311, cp312]

runs-on: ${{ matrix.os }}

Expand Down
313 changes: 181 additions & 132 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools", "wheel", "setuptools_dso>=2.1", "epicscorelibs>=7.0.7.99.0.2"]
requires = ["setuptools", "wheel", "setuptools_dso>=2.1", "epicscorelibs>=7.0.7.99.1.1a3"]
build-backend = "setuptools.build_meta:__legacy__"
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ dev =
flake8 <5.0.0
# Higher version of sphinx require importlib-metadata version that conflicts with other packages
sphinx ==4.3.2
sphinx-rtd-theme-github-versions
sphinx-rtd-theme ==1.0.0
sphinx-rtd-theme-github-versions ==1.1
pytest-asyncio
aioca >=1.6
cothread; sys_platform != "win32"
p4p>=4.1.11
p4p>=4.2.0a2

[flake8]
max-line-length = 80
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ def install_for_development(self):
install_requires = [
# Dependency version declared in pyproject.toml
epicscorelibs.version.abi_requires(),
"pvxslibs>=1.2.4",
"numpy<2.0",
"pvxslibs>=1.3.2a2",
"numpy",
"epicsdbbuilder>=1.4",
"pyyaml>=6.0"
],
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def create_random_prefix():
return "".join(random.choice(string.ascii_uppercase) for _ in range(12))

# Can't use logging as it's not multiprocess safe, and
# alteratives are overkill
# alternatives are overkill
def log(*args):
print(datetime.now().strftime("%H:%M:%S"), *args)

Expand Down
11 changes: 10 additions & 1 deletion tests/sim_cothread_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

from softioc import softioc, builder, pvlog

from conftest import ADDRESS, select_and_recv
from conftest import ADDRESS, log, select_and_recv

if __name__ == "__main__":
log("sim_cothread_ioc starting")
with Client(ADDRESS) as conn:
import cothread

Expand All @@ -18,16 +19,24 @@

import sim_records

log("sim_cothread_ioc records created")

# Run the IOC
builder.LoadDatabase()
softioc.iocInit()

log("sim_cothread_ioc ready")

conn.send("R") # "Ready"

log("sim_cothread_ioc waiting for Done")

select_and_recv(conn, "D") # "Done"
# Attempt to ensure all buffers flushed - C code (from `import pvlog`)
# may not be affected by these calls...
sys.stdout.flush()
sys.stderr.flush()

log("sim_cothread_ioc sending Done")

conn.send("D") # "Ready"
8 changes: 6 additions & 2 deletions tests/test_cothread.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from multiprocessing.connection import Listener

from conftest import requires_cothread, ADDRESS, select_and_recv
from conftest import requires_cothread, ADDRESS, log, select_and_recv

@requires_cothread
def test_cothread_ioc(cothread_ioc):
Expand All @@ -12,8 +12,9 @@ def test_cothread_ioc(cothread_ioc):
pre = cothread_ioc.pv_prefix

with Listener(ADDRESS) as listener, listener.accept() as conn:

log("test_cothread_ioc wait for Ready")
select_and_recv(conn, "R") # "Ready"
log("test_cothread_ioc Ready received")

# Start
assert caget(pre + ":UPTIME").startswith("00:00:0")
Expand All @@ -31,9 +32,12 @@ def test_cothread_ioc(cothread_ioc):
with Context("pva") as ctx:
assert ctx.get(pre + ":STRINGOUT") == "something"

log("test_cothread_ioc sending Done")
conn.send("D") # "Done"

log("test_cothread_ioc waiting for Done")
select_and_recv(conn, "D") # "Done"
log("test_cothread_ioc received Done")

# Stop
cothread_ioc.proc.send_signal(signal.SIGINT)
Expand Down
Loading