-
Notifications
You must be signed in to change notification settings - Fork 4
MAINT: Create CircleCI job to test against wheels (binary distributions) #310
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
base: main
Are you sure you want to change the base?
Changes from all commits
2a329f5
90eb203
1027bf8
40dc5a0
922d72b
1d271d6
b02fb45
d0f1d91
0c87fea
60fdb50
e3ce397
f0d4265
5236d10
58fefee
2431b49
86c62a5
65e5d3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,7 +25,30 @@ executors: | |||||
| # Define a job to be invoked later in a workflow. | ||||||
| # See: https://circleci.com/docs/2.0/configuration-reference/#jobs | ||||||
| jobs: | ||||||
| build_and_test: | ||||||
| build_distribution: | ||||||
| parameters: | ||||||
| version: | ||||||
| description: "version tag" | ||||||
| default: "latest" | ||||||
| type: string | ||||||
| executor: | ||||||
| name: python-docker | ||||||
| version: <<parameters.version>> | ||||||
| steps: | ||||||
| - checkout | ||||||
| - run: | ||||||
| name: install build dependencies | ||||||
| command: pip install ".[deploy]" | ||||||
| - run: | ||||||
| name: Build distribution artifacts | ||||||
| command: | | ||||||
| python -m build | ||||||
| - persist_to_workspace: | ||||||
| root: . | ||||||
| paths: | ||||||
| - dist | ||||||
|
|
||||||
| test_source: | ||||||
| parameters: | ||||||
| version: | ||||||
| description: "version tag" | ||||||
|
|
@@ -36,16 +59,46 @@ jobs: | |||||
| version: <<parameters.version>> | ||||||
| steps: | ||||||
| - checkout | ||||||
| # - run: | ||||||
| # name: Install System Dependencies | ||||||
| # command: sudo apt-get update && sudo apt-get install -y libsndfile1 | ||||||
| - run: | ||||||
| name: install dependencies | ||||||
| command: pip install ".[tests]" | ||||||
| - run: | ||||||
| name: Run tests | ||||||
| command: pytest | ||||||
|
|
||||||
| test_wheel: | ||||||
| parameters: | ||||||
| version: | ||||||
| description: "version tag" | ||||||
| default: "latest" | ||||||
| type: string | ||||||
| executor: | ||||||
| name: python-docker | ||||||
| version: <<parameters.version>> | ||||||
| steps: | ||||||
| - checkout | ||||||
| - attach_workspace: | ||||||
| at: /tmp/workspace | ||||||
| - run: | ||||||
| name: Install wheel from workspace in isolated venv | ||||||
| command: | | ||||||
| rm -rf /tmp/wheeltest | ||||||
| python -m venv /tmp/wheeltest | ||||||
| # Find the wheel file in the workspace and save it to an environment variable | ||||||
| WHEEL=$(ls -1 /tmp/workspace/dist/*.whl | head -n 1) | ||||||
| /tmp/wheeltest/bin/python -m pip install "${WHEEL}[tests]" | ||||||
| - run: | ||||||
| name: Move test files to isolated location | ||||||
| command: | | ||||||
| rm -rf /tmp/spharpy-wheel-tests | ||||||
| mkdir -p /tmp/spharpy-wheel-tests | ||||||
| cp -r tests /tmp/spharpy-wheel-tests/ | ||||||
| - run: | ||||||
| name: Run tests against wheel installation (i.e. in isolated environment) | ||||||
| command: | | ||||||
| cd /tmp/spharpy-wheel-tests | ||||||
| /tmp/wheeltest/bin/python -m pytest tests | ||||||
|
|
||||||
| ruff: | ||||||
| parameters: | ||||||
| version: | ||||||
|
|
@@ -75,9 +128,6 @@ jobs: | |||||
| version: <<parameters.version>> | ||||||
| steps: | ||||||
| - checkout | ||||||
| # - run: | ||||||
| # name: Install System Dependencies | ||||||
| # command: sudo apt-get update && sudo apt-get install -y libsndfile1 texlive-latex-extra dvipng | ||||||
| - run: | ||||||
| name: Sphinx | ||||||
| command: | | ||||||
|
|
@@ -96,9 +146,6 @@ jobs: | |||||
| version: <<parameters.version>> | ||||||
| steps: | ||||||
| - checkout | ||||||
| # - run: | ||||||
| # name: Install System Dependencies | ||||||
| # command: sudo apt-get update && sudo apt-get install -y libsndfile1 texlive-latex-extra dvipng | ||||||
| - run: | ||||||
| name: install dependencies | ||||||
| command: pip install ".[tests]" | ||||||
|
|
@@ -119,17 +166,15 @@ jobs: | |||||
| version: <<parameters.version>> | ||||||
| steps: | ||||||
| - checkout | ||||||
| # - run: | ||||||
| # name: Install System Dependencies | ||||||
| # command: sudo apt-get update && sudo apt-get install -y libsndfile1 | ||||||
| - attach_workspace: | ||||||
| at: /tmp/workspace | ||||||
| - run: | ||||||
| name: install dependencies | ||||||
| command: pip install ".[deploy]" | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
woudnt this be sufficiant?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In theory yes, but I'd like to avoid managing dependencies in the CircleCI config and the pyproject.toml. This way it's always sufficient to extend and update in a single place.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see your point. My thinking here is that this job is only invoking twine, which doesn’t depend on our project’s dependencies or anything that could vary with the package—it’s just a standalone tool.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I still don't really get the point. You could also pin to a specific version within the CircleCI config. My point is more about central management of dependencies in the toml, instead of individual management of dependencies in different places. I realized though, that its probably more useful to check the binary distribution within the built job instead of creating a new job. This probably saves more time than the 29 secs you mentioned.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be honest, I think this job can be removed altogether.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that would also work for me |
||||||
| - run: | ||||||
| name: deploy | ||||||
| command: | # create whl, install twine and publish to Test PyPI | ||||||
| python -m build | ||||||
| twine check dist/* | ||||||
| command: | | ||||||
| twine check /tmp/workspace/dist/* | ||||||
|
|
||||||
| run_pypi_publish: | ||||||
| parameters: | ||||||
|
|
@@ -142,26 +187,24 @@ jobs: | |||||
| version: <<parameters.version>> | ||||||
| steps: | ||||||
| - checkout | ||||||
| - run: | ||||||
| name: Install System Dependencies | ||||||
| command: sudo apt-get update && sudo apt-get install -y libsndfile1 | ||||||
| - attach_workspace: | ||||||
| at: /tmp/workspace | ||||||
| - run: | ||||||
| name: install dependencies | ||||||
| command: pip install ".[deploy]" | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
same here.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see comment above |
||||||
| - run: | ||||||
| name: deploy | ||||||
| command: | # create whl, install twine and publish to Test PyPI | ||||||
| python -m build | ||||||
| twine check dist/* | ||||||
| twine upload dist/* | ||||||
| command: | | ||||||
| twine check /tmp/workspace/dist/* | ||||||
| twine upload /tmp/workspace/dist/* | ||||||
|
|
||||||
| # Invoke jobs via workflows | ||||||
| # See: https://circleci.com/docs/2.0/configuration-reference/#workflows | ||||||
| workflows: | ||||||
| test: # Test workflow | ||||||
| jobs: | ||||||
| # Run tests for all python versions | ||||||
| - build_and_test: | ||||||
| - test_source: | ||||||
| matrix: | ||||||
| parameters: | ||||||
| version: | ||||||
|
|
@@ -170,44 +213,69 @@ workflows: | |||||
| - "3.13" | ||||||
| - "3.14" | ||||||
|
|
||||||
| - build_distribution: | ||||||
| matrix: | ||||||
| parameters: | ||||||
| version: | ||||||
| - "3.14" | ||||||
| requires: | ||||||
| - test_source | ||||||
|
|
||||||
| - ruff: | ||||||
| matrix: | ||||||
| parameters: | ||||||
| version: | ||||||
| - "3.14" | ||||||
| requires: | ||||||
| - build_and_test | ||||||
| - test_source | ||||||
|
|
||||||
| - test_wheel: | ||||||
| matrix: | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to reduce redandency we could also jsut run test_wheel on main and develop and not for each pull in a pr
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll update that at the end, to make sure it still triggers as long as work on this PR is ongoing |
||||||
| parameters: | ||||||
| version: | ||||||
| - "3.11" | ||||||
| - "3.12" | ||||||
| - "3.13" | ||||||
| - "3.14" | ||||||
| requires: | ||||||
| - build_distribution | ||||||
|
|
||||||
| - test_documentation_build: | ||||||
| matrix: | ||||||
| parameters: | ||||||
| version: | ||||||
| - "3.14" | ||||||
| requires: | ||||||
| - build_and_test | ||||||
| - test_source | ||||||
|
|
||||||
| - test_deprecation_warnings: | ||||||
| matrix: | ||||||
| parameters: | ||||||
| version: | ||||||
| - "3.14" | ||||||
| requires: | ||||||
| - build_and_test | ||||||
| - test_source | ||||||
|
|
||||||
| - test_pypi_publish: | ||||||
| matrix: | ||||||
| parameters: | ||||||
| version: | ||||||
| - "3.14" | ||||||
| requires: | ||||||
| - build_and_test | ||||||
| - test_source | ||||||
| - build_distribution | ||||||
| filters: | ||||||
| branches: | ||||||
| only: | ||||||
| - main | ||||||
| - develop | ||||||
|
|
||||||
|
|
||||||
| test_and_publish: | ||||||
| # Test and publish on new git version tags | ||||||
| # This requires its own workflow to successfully trigger the test and build | ||||||
| jobs: | ||||||
| - build_and_test: | ||||||
| - test_source: | ||||||
| matrix: | ||||||
| parameters: | ||||||
| version: | ||||||
|
|
@@ -223,13 +291,45 @@ workflows: | |||||
| tags: | ||||||
| only: /^v[0-9]+(\.[0-9]+)*$/ | ||||||
|
|
||||||
| - build_distribution: | ||||||
| matrix: | ||||||
| parameters: | ||||||
| version: | ||||||
| - "3.14" | ||||||
| requires: | ||||||
| - test_source | ||||||
| filters: | ||||||
| branches: | ||||||
| ignore: /.*/ | ||||||
| # only act on version tags | ||||||
| tags: | ||||||
| only: /^v[0-9]+(\.[0-9]+)*$/ | ||||||
|
|
||||||
| - ruff: | ||||||
| matrix: | ||||||
| parameters: | ||||||
| version: | ||||||
| - "3.14" | ||||||
| requires: | ||||||
| - build_and_test | ||||||
| - test_source | ||||||
| filters: | ||||||
| branches: | ||||||
| ignore: /.*/ | ||||||
| # only act on version tags | ||||||
| tags: | ||||||
| only: /^v[0-9]+(\.[0-9]+)*$/ | ||||||
|
|
||||||
| - test_wheel: | ||||||
| matrix: | ||||||
| parameters: | ||||||
| version: | ||||||
| - "3.11" | ||||||
| - "3.12" | ||||||
| - "3.13" | ||||||
| - "3.14" | ||||||
| requires: | ||||||
| - test_source | ||||||
| - build_distribution | ||||||
| filters: | ||||||
| branches: | ||||||
| ignore: /.*/ | ||||||
|
|
@@ -243,7 +343,7 @@ workflows: | |||||
| version: | ||||||
| - "3.14" | ||||||
| requires: | ||||||
| - build_and_test | ||||||
| - test_source | ||||||
| filters: | ||||||
| branches: | ||||||
| ignore: /.*/ | ||||||
|
|
@@ -257,7 +357,7 @@ workflows: | |||||
| version: | ||||||
| - "3.14" | ||||||
| requires: | ||||||
| - build_and_test | ||||||
| - test_source | ||||||
| filters: | ||||||
| branches: | ||||||
| ignore: /.*/ | ||||||
|
|
@@ -271,7 +371,9 @@ workflows: | |||||
| version: | ||||||
| - "3.14" | ||||||
| requires: | ||||||
| - build_and_test | ||||||
| - test_source | ||||||
| - test_wheel | ||||||
| - build_distribution | ||||||
| - ruff | ||||||
| - test_documentation_build | ||||||
| filters: | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.