diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5ace4600..6cc00712 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,3 +4,5 @@ updates: directory: "/" schedule: interval: "weekly" + cooldown: + default-days: 7 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7ae23b2..7421992e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -# Adapted from example at +# Adapted from example at # https://github.com/pypa/cibuildwheel/blob/0319c431dedc020eb/examples/github-deploy.yml # # Original license: @@ -40,17 +40,26 @@ on: types: - published +permissions: {} + +concurrency: + group: build-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + jobs: build_pure: # s2fft is pure Python: one wheel for every platform, and the sdist name: Build s2fft wheel and source distribution runs-on: ubuntu-latest + permissions: + contents: read steps: - - uses: actions/checkout@v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 fetch-tags: true - - uses: actions/setup-python@v7 + persist-credentials: false + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.x" - name: Install pipx @@ -59,7 +68,7 @@ jobs: run: pipx run build --outdir dist - name: Check the wheel is pure Python run: ls dist && ls dist/*-py3-none-any.whl - - uses: actions/upload-artifact@v7 + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: dist-s2fft path: dist/* @@ -73,6 +82,8 @@ jobs: # jax-cuda12-plugin and jax-cuda13-plugin. name: Build s2fft-cuda${{ matrix.cuda-major }}-plugin wheels (${{ matrix.platform.arch }}) runs-on: ${{ matrix.platform.runner }} + permissions: + contents: read strategy: fail-fast: false matrix: @@ -92,12 +103,13 @@ jobs: cufft-soname: libcufft.so.12 architectures: "75-real;80-real;86-real;89-real;90-real;100-real;110-real;120-real;120-virtual" steps: - - uses: actions/checkout@v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 fetch-tags: true + persist-credentials: false - name: Build wheels - uses: pypa/cibuildwheel@v4.3.5 + uses: pypa/cibuildwheel@f9b966cfadf4109556cadc5bb39ddb72d0ce664e # v4.3.5 with: package-dir: plugins/s2fft-cuda/cuda${{ matrix.cuda-major }} output-dir: wheelhouse @@ -127,22 +139,25 @@ jobs: unzip -o -q "$wheel" -d check done readelf -d check/s2fft_cuda*_plugin/_s2fft*.so | grep -E 'NEEDED|RUNPATH' - - uses: actions/upload-artifact@v7 + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: dist-cuda${{ matrix.cuda-major }}-plugin-${{ matrix.platform.arch }} path: wheelhouse/*.whl upload_test_pypi: + name: Make release on test PyPI needs: [build_pure, build_cuda_plugins] runs-on: ubuntu-latest environment: test-pypi permissions: - id-token: write + contents: read + id-token: write # required for pushing to PyPI if: | (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'push' && github.ref == 'refs/heads/main') + steps: - - uses: actions/download-artifact@v8 + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: # Unpack all artifacts (s2fft wheel and sdist, plugin wheels) into dist/ # pypa/gh-action-pypi-publish action uploads contents of dist/ unconditionally @@ -152,22 +167,24 @@ jobs: # Try publishing to Test PyPI first - if there are issues this should # cause job to fail before attempting to publish on PyPI itself - name: Publish package distributions to Test PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 with: repository-url: https://test.pypi.org/legacy/ upload_pypi: + name: Make release on PyPI needs: [build_pure, build_cuda_plugins, upload_test_pypi] runs-on: ubuntu-latest environment: pypi permissions: - id-token: write + contents: read + id-token: write # required for pushing to PyPI if: github.event_name == 'release' && github.event.action == 'published' steps: - - uses: actions/download-artifact@v8 + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: pattern: dist-* path: dist merge-multiple: true - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4816a907..167b2ed3 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -14,21 +14,27 @@ on: branches: - main +permissions: {} + concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: docs-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: build: - + name: Build documentation runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout source - uses: actions/checkout@v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - - name: Set up Python - uses: actions/setup-python@v7 + - name: Set up Python + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.13" @@ -59,22 +65,24 @@ jobs: - name: Upload built docs as artifact id: deployment - uses: actions/upload-pages-artifact@v5 + uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 with: path: docs/_build/html retention-days: 30 deploy: + name: Deploy documentation to GitHub pages environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} permissions: - pages: write - id-token: write + contents: read + pages: write # required for pages deployment + id-token: write # required for pages upload runs-on: ubuntu-latest needs: build if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v5 + uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 7e11a2a0..982a9f29 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -6,21 +6,32 @@ on: - main pull_request: +permissions: {} + +concurrency: + group: linting-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + jobs: linting: + name: Linting runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout source - uses: actions/checkout@v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Cache pre-commit - uses: actions/cache@v6 + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ~/.cache/pre-commit key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} - name: Set up Python - uses: actions/setup-python@v7 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.x" cache: pip diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index 12e8a24d..6e9a3cd2 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml @@ -7,13 +7,21 @@ on: - cron: "0 23 * * *" workflow_dispatch: # Allow for running this manually. +permissions: {} + +concurrency: + group: stats-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + jobs: collect-stats: name: github-repo-stats runs-on: ubuntu-latest + permissions: + contents: read steps: - name: run-ghrs # Use latest release. - uses: jgehrcke/github-repo-stats@306db38ad131cab2aa5f2cd3062bf6f8aa78c1aa + uses: jgehrcke/github-repo-stats@306db38ad131cab2aa5f2cd3062bf6f8aa78c1aa # v1.4.2 with: ghtoken: ${{ secrets.ghrs_github_api_token }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2de56423..c0ae11b4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,13 +15,15 @@ on: schedule: - cron: 0 0 * * 0 +permissions: {} + concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: tests-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: - tests-non-cached: + name: Tests (non-cached) # Test job run on Ubuntu runner only which installs full set of test dependencies # and generates test data using external packages such as healpy, pyssht and so3 @@ -32,15 +34,19 @@ jobs: # so3 requires Conan 1 which only supports older CMake policy and GCC versions CMAKE_POLICY_VERSION_MINIMUM: 3.5 GCC_VERSION: 14 + permissions: + contents: read + steps: - name: Checkout Source - uses: actions/checkout@v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 fetch-tags: true + persist-credentials: false - name: Set up Python - uses: actions/setup-python@v7 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.13" cache: pip @@ -63,18 +69,19 @@ jobs: pytest -v --cov-report=xml --cov=s2fft --cov-config=.coveragerc --update-cache -m "uses_cached_data or pyssht or healpy" - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v7 + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - name: Upload cached test data - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: cached-test-data path: tests/cached-test-data retention-days: 30 tests-with-cached-data: + name: Tests (with cached data) # Matrix test job using cached test data from previous job to allow running tests # with a smaller set of dependencies (in particular not requiring pyssht, so3 or @@ -86,21 +93,24 @@ jobs: python-version: ["3.11", "3.12", "3.13"] os: [ubuntu-latest, macos-latest, windows-latest] fail-fast: false + permissions: + contents: read steps: - name: Checkout Source - uses: actions/checkout@v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 fetch-tags: true + persist-credentials: false - - uses: actions/download-artifact@v8 + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: cached-test-data path: tests/cached-test-data - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v7 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: ${{ matrix.python-version }} cache: pip @@ -125,6 +135,6 @@ jobs: pytest -v --cov-report=xml --cov=s2fft --cov-config=.coveragerc -m "not pyssht and not healpy" --use-cache - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v7 + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}