From 2894c8366a4b903d7b15f38a3e6604a46c7dcfd8 Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 10:58:35 +0100 Subject: [PATCH 01/17] Update test matrix and add scheduled tests --- .github/workflows/tests.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f2c2ebc7..472fec72 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,14 +7,17 @@ on: pull_request: branches: - main + schedule: + - cron: 0 0 * * 0 jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.9] + python-version: [3.8, 3.9, 3.10, 3.11, 3.12] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - name: Checkout Source From b4479ce24457406ddd8cca3348195e3d9bc685a2 Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 11:06:25 +0100 Subject: [PATCH 02/17] Update actions versions in tests workflow --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 472fec72..e811728e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,10 +21,10 @@ jobs: steps: - name: Checkout Source - uses: actions/checkout@v2.3.1 + uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} From 1c0faf97cbca5c299adb0b96ec31cee13419631f Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 11:07:13 +0100 Subject: [PATCH 03/17] Continue with other jobs if one job in matrix fails --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e811728e..4e647653 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,6 +18,7 @@ jobs: matrix: python-version: [3.8, 3.9, 3.10, 3.11, 3.12] os: [ubuntu-latest, macos-latest, windows-latest] + fail-fast: false steps: - name: Checkout Source From 3dfc85787aeff38060708fc2f2e399f1cd0a389b Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 11:10:46 +0100 Subject: [PATCH 04/17] Force Python versions in matrix to be strings --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4e647653..ee374396 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.8, 3.9, 3.10, 3.11, 3.12] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, macos-latest, windows-latest] fail-fast: false From 770f54c050164029369259d8c3698fd4caf1c0ad Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 11:10:57 +0100 Subject: [PATCH 05/17] Cancel in progress tests on updates to PR --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ee374396..68049fd4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,6 +9,10 @@ on: - main schedule: - cron: 0 0 * * 0 + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: build: From f707ec36c07750f149f07a07687e28bd0a5a4152 Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 11:13:22 +0100 Subject: [PATCH 06/17] Revert to testing on ubuntu-latest only --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 68049fd4..f4ecd1a1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest] fail-fast: false steps: From 31f38b54392374860314114f1243a48931538aed Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 11:21:10 +0100 Subject: [PATCH 07/17] Add upper bound to NumPy major version --- requirements/requirements-core.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/requirements-core.txt b/requirements/requirements-core.txt index 1ee80e61..d1f4aa6b 100644 --- a/requirements/requirements-core.txt +++ b/requirements/requirements-core.txt @@ -1,5 +1,5 @@ # Packages required for core functionality -numpy>=1.20 +numpy>=1.20,<2 colorlog pyyaml jax>=0.3.13 From 09ca0693b1ae29f6b2ddc61836b3b346990a5e85 Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 11:40:40 +0100 Subject: [PATCH 08/17] Make docstrings raw to avoid invalid escape sequence errors --- s2fft/recursions/trapani.py | 2 +- s2fft/sampling/so3_samples.py | 2 +- s2fft/utils/resampling.py | 4 ++-- s2fft/utils/resampling_jax.py | 2 +- s2fft/utils/resampling_torch.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/s2fft/recursions/trapani.py b/s2fft/recursions/trapani.py index 3c9a2af0..40affd60 100644 --- a/s2fft/recursions/trapani.py +++ b/s2fft/recursions/trapani.py @@ -760,7 +760,7 @@ def compute_full_jax(dl: jnp.ndarray, L: int, el: int) -> jnp.ndarray: def _arg_checks(dl: np.ndarray, L: int, el: int): - """Check arguments of Trapani functions. + r"""Check arguments of Trapani functions. Args: dl (np.ndarray): Wigner-d plane of which to check shape. diff --git a/s2fft/sampling/so3_samples.py b/s2fft/sampling/so3_samples.py index 63a29784..aee97d16 100644 --- a/s2fft/sampling/so3_samples.py +++ b/s2fft/sampling/so3_samples.py @@ -177,7 +177,7 @@ def _ngamma(N: int) -> int: def elmn2ind(el: int, m: int, n: int, L: int, N: int) -> int: - """Convert from Wigner space 3D indexing of :math:`(\ell,m, n)` to 1D index. + r"""Convert from Wigner space 3D indexing of :math:`(\ell,m, n)` to 1D index. Args: el (int): Harmonic degree :math:`\ell`. diff --git a/s2fft/utils/resampling.py b/s2fft/utils/resampling.py index 606ea3a5..b3d5bbe1 100644 --- a/s2fft/utils/resampling.py +++ b/s2fft/utils/resampling.py @@ -126,7 +126,7 @@ def upsample_by_two_mwss(f: np.ndarray, L: int, spin: int = 0) -> np.ndarray: def upsample_by_two_mwss_ext(f_ext: np.ndarray, L: int) -> np.ndarray: - """Upsample an extended MWSS sampled signal on the sphere defined on domain + r"""Upsample an extended MWSS sampled signal on the sphere defined on domain :math:`[0,2\pi]` by a factor of two. Upsampling is performed by zero-padding in harmonic space. @@ -153,7 +153,7 @@ def upsample_by_two_mwss_ext(f_ext: np.ndarray, L: int) -> np.ndarray: def downsample_by_two_mwss(f_ext: np.ndarray, L: int) -> np.ndarray: - """Downsample an MWSS sampled signal on the sphere. + r"""Downsample an MWSS sampled signal on the sphere. Can be applied to either MWSS signal sampled on original domain :math:`[0,\pi]` or extended domain :math:`[0,2\pi]`. diff --git a/s2fft/utils/resampling_jax.py b/s2fft/utils/resampling_jax.py index 976f6d20..56832134 100644 --- a/s2fft/utils/resampling_jax.py +++ b/s2fft/utils/resampling_jax.py @@ -293,7 +293,7 @@ def upsample_by_two_mwss(f: jnp.ndarray, L: int, spin: int = 0) -> jnp.ndarray: @partial(jit, static_argnums=(1)) def upsample_by_two_mwss_ext(f_ext: jnp.ndarray, L: int) -> jnp.ndarray: - """Upsample an extended MWSS sampled signal on the sphere defined on domain + r"""Upsample an extended MWSS sampled signal on the sphere defined on domain :math:`[0,2\pi]` by a factor of two. Upsampling is performed by zero-padding in harmonic space. JAX implementation of diff --git a/s2fft/utils/resampling_torch.py b/s2fft/utils/resampling_torch.py index 7f636909..145d4b5a 100644 --- a/s2fft/utils/resampling_torch.py +++ b/s2fft/utils/resampling_torch.py @@ -278,7 +278,7 @@ def upsample_by_two_mwss(f: torch.tensor, L: int, spin: int = 0) -> torch.tensor def upsample_by_two_mwss_ext(f_ext: torch.tensor, L: int) -> torch.tensor: - """Upsample an extended MWSS sampled signal on the sphere defined on domain + r"""Upsample an extended MWSS sampled signal on the sphere defined on domain :math:`[0,2\pi]` by a factor of two. Upsampling is performed by zero-padding in harmonic space. Torch implementation of From a1da7fe76bc656be2316bf09a1d728f519d1e87b Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 11:56:27 +0100 Subject: [PATCH 09/17] Readd MacOS to test matrix --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f4ecd1a1..cc249c50 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - os: [ubuntu-latest] + os: [ubuntu-latest, macos-latest] fail-fast: false steps: From de21255fb8fb60c1d9b2715e5c044ca92b01d0dc Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 15:59:59 +0100 Subject: [PATCH 10/17] Install requirements in one pass and cache pip --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cc249c50..112b1e6e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,12 +32,12 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache: pip - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements/requirements-tests.txt - pip install -r requirements/requirements-core.txt + pip install -r requirements/requirements-core.txt -r requirements/requirements-tests.txt pip install . - name: Run tests From 22b9535b26ca4b9abac99a285e42d9b8ed427e58 Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 16:02:27 +0100 Subject: [PATCH 11/17] Update cache-dependency-path --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 112b1e6e..82da4d0b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,6 +33,9 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: pip + cache-dependency-path: | + requirements/requirements-core.txt + requirements/requirements-tests.txt - name: Install dependencies run: | From bbac18131eae6dafd948e4407ffde2d232e06e67 Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 16:20:27 +0100 Subject: [PATCH 12/17] Only test on Python 3.8 on MacOS --- .github/workflows/tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 82da4d0b..16cb4583 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,10 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest] + include: + - os: macos-latest + python-version: "3.8" fail-fast: false steps: From e74d0a299f70a9d99c6ec77a8e92c7786dd28551 Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 16 Sep 2024 16:27:35 +0100 Subject: [PATCH 13/17] Increase test output verbosity --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 16cb4583..1bdba0b1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,5 +48,5 @@ jobs: - name: Run tests run: | - pytest --cov-report term --cov=s2fft --cov-config=.coveragerc + pytest -v --cov-report term --cov=s2fft --cov-config=.coveragerc codecov --token 298dc7ee-bb9f-4221-b31f-3576cc6cb702 From 1d195ffe7115d74515d5addb0b9410caff0a868a Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Thu, 10 Oct 2024 09:47:13 +0100 Subject: [PATCH 14/17] Only run tests workflow on updates to relevant files --- .github/workflows/tests.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 545fff75..3ff568ee 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,6 +7,13 @@ on: pull_request: branches: - main + paths: + - .github/workflows/tests.yml + - pyproject.toml + - s2fft/** + - tests/** + - .coveragerc + - CMakesLists.txt schedule: - cron: 0 0 * * 0 From f6990f5ab4aed899907a4b348bf3ef2f771dc5f1 Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 11 Nov 2024 15:54:47 +0000 Subject: [PATCH 15/17] Update setup-python cache options --- .github/workflows/tests.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b001e92c..c8da1ed8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,6 +1,6 @@ name: Tests -on: +on: push: branches: - main @@ -16,7 +16,7 @@ on: - CMakesLists.txt schedule: - cron: 0 0 * * 0 - + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} @@ -37,25 +37,22 @@ jobs: steps: - name: Checkout Source uses: actions/checkout@v4 - + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: pip - cache-dependency-path: | - requirements/requirements-core.txt - requirements/requirements-tests.txt - + - name: Install dependencies run: | python -m pip install --upgrade pip pip install .[tests] - + - name: Run tests run: | pytest -v --cov-report=xml --cov=s2fft --cov-config=.coveragerc - + - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 env: From e4e5c69a8ae1568c3425e05ce664597ea56b24b6 Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Mon, 11 Nov 2024 15:55:19 +0000 Subject: [PATCH 16/17] Try running on all macos-latest / Python version combinations --- .github/workflows/tests.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c8da1ed8..994074d7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,10 +28,7 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - os: [ubuntu-latest] - include: - - os: macos-latest - python-version: "3.8" + os: [ubuntu-latest, macos-latest] fail-fast: false steps: From b6228fa4026e59af5d2a9c7d358ecbbc27158d6e Mon Sep 17 00:00:00 2001 From: Matt Graham Date: Tue, 12 Nov 2024 09:30:38 +0000 Subject: [PATCH 17/17] Revert "Try running on all macos-latest / Python version combinations" This reverts commit e4e5c69a8ae1568c3425e05ce664597ea56b24b6. --- .github/workflows/tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 994074d7..c8da1ed8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,7 +28,10 @@ jobs: strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest] + include: + - os: macos-latest + python-version: "3.8" fail-fast: false steps: