Skip to content
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
144 changes: 47 additions & 97 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,139 +2,89 @@ name: main

on:
push:
branches: ["main"]
branches: ["main", "fix-build"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n -C2 '^concurrency:|cancel-in-progress' .github/workflows/main.yml

Repository: isosuite/splinepy

Length of output: 155


Add workflow concurrency before publishing artifacts.

Line 5 allows multiple push builds to run at once; with skip-existing, an older main run can publish stale wheels before a newer run finishes. Add per-ref concurrency and cancel superseded runs.

Proposed fix
 on:
   push:
     branches: ["main", "fix-build"]
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
branches: ["main", "fix-build"]
branches: ["main", "fix-build"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
🧰 Tools
🪛 zizmor (1.26.1)

[warning] 3-5: insufficient job-level concurrency limits (concurrency-limits): workflow is missing concurrency setting

(concurrency-limits)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/main.yml at line 5, Add workflow-level concurrency to the
main workflow so only the latest run per ref proceeds and older runs are
canceled before artifact publishing. Update the workflow configuration near the
top of the file (around the branches trigger) by introducing a per-ref
concurrency group with cancellation for superseded runs, so stale builds cannot
publish wheels ahead of newer runs.

Source: Linters/SAST tools


jobs:
macos_wheel:
runs-on: macos-15-intel
build_wheels:
strategy:
Comment on lines +8 to 9

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Set explicit least-privilege token permissions for artifact build jobs.

build_wheels and build_sdist currently rely on repository defaults. Pin job permissions explicitly to avoid accidental broad scopes.

Proposed fix
   build_wheels:
+    permissions:
+      contents: read
     strategy:
       fail-fast: false
@@
   build_sdist:
+    permissions:
+      contents: read
     runs-on: ubuntu-latest

Also applies to: 58-60

🧰 Tools
🪛 zizmor (1.26.1)

[warning] 8-56: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


[info] 8-8: workflow or action definition without a name (anonymous-definition): this job

(anonymous-definition)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/main.yml around lines 8 - 9, The build artifact jobs are
relying on default GitHub token scopes instead of explicit least-privilege
permissions. Update the workflow job definitions for build_wheels and
build_sdist to set only the permissions they need, using the job names and the
existing artifact build steps to locate them, so the token scope is pinned
rather than inherited from repository defaults.

Source: Linters/SAST tools

fail-fast: false
matrix:
arch: [x86_64]
cw_build: ["cp310-*", "cp311-*", "cp312-*", "cp313-*", "cp314-*"]

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build wheels
uses: pypa/cibuildwheel@v2.23.2
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.cw_build }}
SPLINEPY_GITHUB_ACTIONS_BUILD: True
SKBUILD_INSTALL_COMPONENTS: PythonModule

- uses: actions/upload-artifact@v4
with:
name: wheels-macos-15-intel-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
retention-days: 1

macos_wheel-m1:
runs-on: macos-latest
strategy:
matrix:
arch: [arm64]
cw_build: ["cp310-*", "cp311-*", "cp312-*", "cp313-*", "cp314-*"]

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build wheels
uses: pypa/cibuildwheel@v2.23.2
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.cw_build }}
SPLINEPY_GITHUB_ACTIONS_BUILD: True
SKBUILD_INSTALL_COMPONENTS: PythonModule

- uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
retention-days: 1

linux_wheel:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86_64]
cw_build: ["cp310*many*", "cp311*many*", "cp312*many*", "cp313*many*", "cp314*many*"]

include:
# macOS Intel
- os: macos-15-intel
arch: x86_64
build: ["cp310-*", "cp311-*", "cp312-*", "cp313-*", "cp314-*"]
platform: macos
# macOS ARM (M1/M2)
- os: macos-latest
arch: arm64
build: ["cp310-*", "cp311-*", "cp312-*", "cp313-*", "cp314-*"]
platform: macos
# Linux
- os: ubuntu-latest
arch: x86_64
build: ["cp310*many*", "cp311*many*", "cp312*many*", "cp313*many*", "cp314*many*"]
platform: linux
skip: "cp314t-*"
# Windows
- os: windows-latest
arch: AMD64
build: ["cp310-*", "cp311-*", "cp312-*", "cp313-*", "cp314-*"]
platform: windows
test_skip: "*-win_arm64"

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
submodules: recursive
Comment on lines +38 to 40

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Do not persist checkout credentials in build jobs.

These jobs do not push back to GitHub, so the checkout token should not remain available to later build steps. actions/checkout persists credentials by default and supports persist-credentials: false. (github.com)

Proposed fix
     - uses: actions/checkout@v7
       with:
         submodules: recursive
+        persist-credentials: false

Also applies to: 92-94, 113-115

🧰 Tools
🪛 zizmor (1.26.1)

[warning] 66-68: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 66-66: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/main.yml around lines 66 - 68, The checkout step in the
build jobs leaves GitHub credentials available to later steps because
actions/checkout persists them by default. Update each affected checkout
invocation in the workflow to explicitly set persist-credentials to false
alongside the existing submodules setting, so the job can still fetch sources
without keeping the token around. Use the checkout step entries in main.yml as
the targets for this change.

Source: Linters/SAST tools

- name: build wheels
uses: pypa/cibuildwheel@v2.23.2
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.cw_build }}
SPLINEPY_GITHUB_ACTIONS_BUILD: True
SKBUILD_INSTALL_COMPONENTS: PythonModule

- uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
retention-days: 1

windows_wheel:
runs-on: windows-latest
strategy:
matrix:
arch: [AMD64]
cw_build: ["cp310-*", "cp311-*", "cp312-*", "cp313-*", "cp314-*"]

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build wheels
uses: pypa/cibuildwheel@v2.23.2
- name: Build wheels
uses: pypa/cibuildwheel@v4.1.0
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.cw_build }}
CIBW_TEST_SKIP: "*-win_arm64"
CIBW_BUILD: ${{ join(matrix.build, ' ') }}
CIBW_SKIP: ${{ matrix.skip || '' }}
CIBW_TEST_SKIP: ${{ matrix.test_skip || '' }}
SPLINEPY_GITHUB_ACTIONS_BUILD: True
SKBUILD_INSTALL_COMPONENTS: PythonModule

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: wheels-windows-${{ strategy.job-index }}
name: wheels-${{ matrix.platform }}-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
retention-days: 1
retention-days: 7

source_dist:
build_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
submodules: recursive

- name: Build sdist
- name: Build source distribution
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: wheels-source
path: ./dist/*
retention-days: 1

retention-days: 7

upload_pypi:
needs: [macos_wheel, macos_wheel-m1, linux_wheel, windows_wheel, source_dist]
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v7
with:
pattern: wheels-*
merge-multiple: true
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
- name: Publish to PyPI
if: github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ docs/source/_generated
**/CMakeFiles/
**/Makefile
**/cmake_install.cmake

#
examples/not_upload/
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/tataratat/splinepy",
"url": "https://github.com/isosuite/splinepy",
"icon": "fa-brands fa-square-github",
},
{
Expand Down
Loading