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
61 changes: 61 additions & 0 deletions .github/workflows/build-sdist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build sdist

on:
workflow_call:
inputs:
dev:
default: false
required: false
type: boolean
workflow_dispatch:
inputs:
dev:
default: false
required: false
type: boolean

concurrency:
group: build-sdist-${{ github.ref }}
cancel-in-progress: false

permissions:
contents: read

jobs:
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
env:
UV_NO_PROGRESS: true
UV_SYSTEM_PYTHON: true
permissions:
contents: read
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: audit

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: marcelotduarte/python-msilib
persist-credentials: false

- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: false
python-version: "3.14"

- name: Bump new dev version
if: ${{ inputs.dev }}
run: ./ci/bump-version.sh build-dev

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

- name: Upload the artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: python-msilib-sdist
path: dist
compression-level: 0 # no compression
45 changes: 26 additions & 19 deletions .github/workflows/build.yml → .github/workflows/build-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:

concurrency:
group: build-${{ github.ref }}
group: build-wheel-${{ github.ref }}
cancel-in-progress: false

permissions:
Expand All @@ -19,11 +19,6 @@ jobs:
name: Generate matrix of builds
runs-on: ubuntu-slim
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
with:
egress-policy: audit

- name: Extra includes
id: includes
run: |
Expand Down Expand Up @@ -56,8 +51,16 @@ jobs:
outputs:
data: ${{ steps.includes.outputs.data }}

build_sdist:
name: Build sdist for python-msilib
uses: $/.github/workflows/build-sdist.yml
with:
dev: ${{ github.event_name != 'release' }}

build_wheel:
needs: matrix
needs:
- build_sdist
- matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.matrix.outputs.data) }}
Expand All @@ -76,10 +79,18 @@ jobs:
with:
egress-policy: audit

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download sdist artifact
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
repository: marcelotduarte/python-msilib
persist-credentials: false
name: python-msilib-sdist
path: dist

- name: Checkout from sdist
run: |
(cd dist && tar xvf python_msilib-*.tar.gz)
mv dist/python_msilib-*/* .
rm -rf dist
ls -l

- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
Expand All @@ -92,14 +103,9 @@ jobs:
cache-dependency-glob: "pyproject.toml"
enable-cache: false

- name: Bump new dev version
if: github.event_name != 'release'
run: ./ci/bump-version.sh build-dev

- name: Build sdist and wheels
- name: Build wheels
run: ./ci/build-wheel.sh "${MATRIX_TAG}"
env:
BUILD_SDIST: true
MATRIX_TAG: ${{ matrix.tag }}

- name: Upload the artifact
Expand All @@ -112,7 +118,8 @@ jobs:
publish:
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
name: Publish package to PyPI
needs: build_wheel
needs:
- build_wheel
environment:
name: pypi
url: https://pypi.org/p/python-msilib
Expand All @@ -126,10 +133,10 @@ jobs:
egress-policy: audit

- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
path: wheelhouse
pattern: python-msilib-wheel-*
pattern: python-msilib-*
merge-multiple: true

- name: Publish package to PyPI
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ jobs:

type_check:
name: Type check
if: |
contains(github.event.pull_request.title, '[skip tests]') == false &&
contains(github.event.head_commit.message, '[skip tests]') == false
runs-on: ${{ matrix.os }}-${{ matrix.os_version }}
strategy:
fail-fast: false
matrix:
os: [windows]
os_version: [latest]
python-version: ["3.13", "3.14", "3.15-dev"]
python-version: ["3.13", "3.14", "3.15"]
defaults:
run:
shell: bash
Expand All @@ -70,6 +73,7 @@ jobs:
activate-environment: true
cache-dependency-glob: "pyproject.toml"
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install the dependencies for the tests
run: uv pip install --upgrade -r pyproject.toml --group tests
Expand All @@ -81,7 +85,7 @@ jobs:

build_wheel:
name: Build wheels
uses: $/.github/workflows/build.yml
uses: $/.github/workflows/build-wheel.yml
needs:
- pre_commit
- type_check
Expand Down Expand Up @@ -131,7 +135,7 @@ jobs:
enable-cache: true

- name: Download the wheel
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
merge-multiple: true
pattern: python-msilib-wheel-${{ matrix.os }}*
Expand Down Expand Up @@ -174,7 +178,7 @@ jobs:
persist-credentials: true

- name: Download coverage data
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: cov-*
merge-multiple: true
Expand Down
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ repos:
hooks:
- id: validate-pyproject
additional_dependencies:
- validate-pyproject-schema-store[all]==2026.09.30
- validate-pyproject-schema-store[all]==2026.10.06

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: a56c0b927e6465d37cae3e97d35d4d18ab2b96cd # frozen: v0.16.9
rev: 44b5042edab9382aba712eed4f9c7bab7a3d6a3e # frozen: v0.17.0
hooks:
- id: ruff-check
args: ["--fix", "--show-fixes", "--unsafe-fixes"]
Expand All @@ -39,9 +39,10 @@ repos:
additional_dependencies:
- tomli
args: ["--ignore-words-list=lief,LIEF", "-w", "--skip=*.rtf"]
exclude: (?x)^(src/msilib/include/pythoncapi_compat.h)$

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: e2b496dc2bd8340c2524cb9a2d2a943cde1bb6df # frozen: v23.1.1
rev: 98ad4ddb9c057de2f5b9e93e44e6db959807d68c # frozen: v23.1.3
hooks:
- id: clang-format
exclude: (?x)^(src/msilib/include/pythoncapi_compat.h)$
Expand All @@ -59,7 +60,7 @@ repos:
- id: shellcheck

- repo: https://github.com/astral-sh/ty-pre-commit
rev: 6972e4c5a7e9f45f05a2f30b668f221f43b770c9 # frozen: v0.0.84
rev: ded8634232ffc633dc66d44f1b0dfe2bdf766542 # frozen: v0.0.86
hooks:
- id: ty
args: [--no-sync]
Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include Makefile
recursive-include src *.c
recursive-include src *.h
recursive-include tests *.py
graft ci
graft tests
9 changes: 7 additions & 2 deletions ci/build-wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ if [ "$IS_CONDA" == "1" ]; then
PLATFORM_TAG_MASK=$PLATFORM_TAG
else
if [[ $PY_PLATFORM == linux* ]]; then
PLATFORM_TAG=many${PY_PLATFORM/-/_}
if [ "$OSTYPE" == "linux-musl" ]; then
PLATFORM_TAG=musl${PY_PLATFORM/-/_}
else
PLATFORM_TAG=many${PY_PLATFORM/-/_}
fi
PLATFORM_TAG_MASK=${PLATFORM_TAG/_/*_}
elif [[ $PY_PLATFORM == macosx* ]]; then
PLATFORM_TAG=macosx_universal2
Expand Down Expand Up @@ -134,7 +138,8 @@ _build_wheel () {
if [ "$CI" == "true" ] && [[ $PY_PLATFORM == win* ]]; then
export UV_LINK_MODE=copy
fi
if [ "$ZIP_SAFE" == "true" ]; then
# check for $container while cibuildwheel does not support to run on it
if [ "$ZIP_SAFE" == "true" ] || [ -n "$container" ]; then
UV_NO_BUILD=0 \
uv build -p "$PY_VERSION$PY_ABI_THREAD" --wheel -o wheelhouse
else
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ Documentation = "https://docs.python.org/3.12/library/msilib.html"

[dependency-groups]
dev = [
"cibuildwheel>=4.2.1",
"prek>=0.5.4,<0.6.0",
"cibuildwheel>=4.3.0",
"prek>=0.5.5,<0.6.0",
]
tests = [
"coverage>=7.13.0",
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cibuildwheel>=4.2.1
prek>=0.5.4,<0.6.0
cibuildwheel>=4.3.0
prek>=0.5.5,<0.6.0
Loading
Loading