Skip to content

Commit

Permalink
Merge branch 'main' into normal_potential
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkWieczorek authored Aug 28, 2024
2 parents 5744b5a + 7182b47 commit 82fd279
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
branch = True
omit =
*/tests/*
*/_version_generated.py
*/_version.py
**/__init__.py
14 changes: 11 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v4.1.2
uses: actions/checkout@v4.1.7
with:
# Need to fetch more than the last commit so that setuptools-scm can
# create the correct version string. If the number of commits since
Expand Down Expand Up @@ -77,6 +77,14 @@ jobs:
echo "Collected dependencies:"
cat requirements-full.txt
- name: Rename conda-forge packages
run: |
echo "Rename conda-forge packages in requirements-full.txt"
# Replace "build" for "python-build"
sed -s --in-place 's/^build$/python-build/' requirements-full.txt
echo "Renamed dependencies:"
cat requirements-full.txt
- name: Install requirements
run: conda install --quiet --file requirements-full.txt python==$PYTHON

Expand Down Expand Up @@ -124,7 +132,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4.1.2
uses: actions/checkout@v4.1.7

# Fetch the built docs from the "build" job
- name: Download HTML documentation artifact
Expand All @@ -134,7 +142,7 @@ jobs:
path: doc/_build/html

- name: Checkout the gh-pages branch in a separate folder
uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
ref: gh-pages
# Checkout to this folder instead of the current one
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v4.1.2
uses: actions/checkout@v4.1.7
with:
# Need to fetch more than the last commit so that setuptools_scm can
# create the correct version string. If the number of commits since
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4.1.2
uses: actions/checkout@v4.1.7
with:
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
Expand All @@ -107,7 +107,7 @@ jobs:
- name: Publish to Test PyPI
# Only publish to TestPyPI when a PR is merged (pushed to main)
if: success() && github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@v1.8.14
uses: pypa/gh-action-pypi-publish@v1.9.0
with:
repository_url: https://test.pypi.org/legacy/
# Allow existing releases on test PyPI without errors.
Expand All @@ -117,4 +117,4 @@ jobs:
- name: Publish to PyPI
# Only publish to PyPI when a release triggers the build
if: success() && github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@v1.8.14
uses: pypa/gh-action-pypi-publish@v1.9.0
4 changes: 2 additions & 2 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.2
uses: actions/checkout@v4.1.7
with:
persist-credentials: false

Expand All @@ -42,7 +42,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.2
uses: actions/checkout@v4.1.7
with:
persist-credentials: false

Expand Down
59 changes: 47 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,31 @@ defaults:

jobs:
#############################################################################
# Run tests and upload to codecov
# Run tests
test:
name: ${{ matrix.os }} python=${{ matrix.python }} dependencies=${{ matrix.dependencies }}
runs-on: ${{ matrix.os }}-latest
runs-on: ${{ matrix.os }}
strategy:
# Otherwise, the workflow would stop if a single job fails. We want to
# run all of them to catch failures in different combinations.
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.8", "3.12"]
include:
- python: "3.8"
dependencies: oldest
- python: "3.12"
dependencies: latest
# test on macos-13 (x86) using oldest dependencies and python 3.8
- os: macos-13
dependencies: oldest
python: "3.8"
exclude:
# don't test on macos-latest (arm64) with oldest dependencies
- os: macos-latest
python: "3.8"

env:
REQUIREMENTS: env/requirements-build.txt env/requirements-test.txt
# Used to tag codecov submissions
Expand All @@ -61,7 +70,7 @@ jobs:

# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v4.1.2
uses: actions/checkout@v4.1.7
with:
# Need to fetch more than the last commit so that setuptools_scm can
# create the correct version string. If the number of commits since
Expand Down Expand Up @@ -106,7 +115,7 @@ jobs:
- name: Get the pip cache folder
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Setup caching for pip packages
uses: actions/cache@v4
Expand Down Expand Up @@ -137,14 +146,40 @@ jobs:
- name: Convert coverage report to XML for codecov
run: coverage xml

- name: Upload coverage to Codecov
- name: Upload coverage report as an artifact
uses: actions/upload-artifact@v4
with:
name: coverage_${{ matrix.os }}_${{ matrix.dependencies }}
path: ./coverage.xml


#############################################################################
# Upload coverage report to codecov
codecov-upload:
runs-on: ubuntu-latest
needs: test

steps:

- name: Download coverage report artifacts
# Download coverage reports from every runner.
# Maximum coverage is achieved by combining reports from every runner.
# Each coverage file will live in its own folder with the same name as
# the artifact.
uses: actions/download-artifact@v4
with:
pattern: coverage_*

- name: List all downloaded artifacts
run: ls -l -R .

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
env_vars: OS,PYTHON
# Don't mark the job as failed if the upload fails for some reason.
# It does sometimes but shouldn't be the reason for running
# everything again unless something else is broken.
fail_ci_if_error: false
# Upload all coverage report files
files: ./coverage_*/coverage.xml
# Fail the job so we know coverage isn't being updated. Otherwise it
# can silently drop and we won't know.
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MANIFEST
dask-worker-space
build/
dist/
boule/_version_generated.py
boule/_version.py
doc/_build
doc/api/generated
doc/tutorials
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ clean:
find . -name "*.pyc" -exec rm -v {} \;
find . -name "*.orig" -exec rm -v {} \;
find . -name ".coverage.*" -exec rm -v {} \;
rm -rvf build dist MANIFEST *.egg-info __pycache__ .coverage .cache .pytest_cache $(PROJECT)/_version_generated.py
rm -rvf build dist MANIFEST *.egg-info __pycache__ .coverage .cache .pytest_cache $(PROJECT)/_version.py
rm -rvf $(TESTDIR) dask-worker-space
3 changes: 3 additions & 0 deletions boule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@
from ._sphere import Sphere
from ._triaxialellipsoid import TriaxialEllipsoid
from ._version import __version__

# Append a leading "v" to the generated version by setuptools_scm
__version__ = f"v{__version__}"
16 changes: 0 additions & 16 deletions boule/_version.py

This file was deleted.

2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
- attrs
- scipy
# Build
- build
- python-build
- twine
# Test
- pytest
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
version_scheme = "post-release"
local_scheme = "no-local-version"
write_to = "boule/_version_generated.py"
write_to = "boule/_version.py"

# Make sure isort and Black are compatible
[tool.isort]
Expand Down

0 comments on commit 82fd279

Please sign in to comment.