Skip to content

docs(changelog): update unreleased section #174

docs(changelog): update unreleased section

docs(changelog): update unreleased section #174

Workflow file for this run

# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2025 py7zz contributors
name: CI
on:
push:
branches: ["**"] # All branches
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: |
uv sync --dev
uv pip install -e .
- name: Run ruff check
run: uv run ruff check . --output-format=github
- name: Run ruff format check
run: uv run ruff format --check --diff .
- name: REUSE compliance check
run: pipx run reuse lint
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Ubuntu: comprehensive testing across all supported Python versions
- os: ubuntu-latest
python-version: "3.8"
- os: ubuntu-latest
python-version: "3.9"
- os: ubuntu-latest
python-version: "3.10"
- os: ubuntu-latest
python-version: "3.11"
- os: ubuntu-latest
python-version: "3.12"
- os: ubuntu-latest
python-version: "3.13"
# Windows: test key versions (minimum and maximum supported)
- os: windows-latest
python-version: "3.8"
- os: windows-latest
python-version: "3.13"
# macOS: test intermediate version for additional platform validation
- os: macos-latest
python-version: "3.11"
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: |
uv sync --dev
uv pip install -e .
- name: Download 7zz binary for testing
shell: bash
run: |
# Use locked version from file
echo "Reading configured 7-Zip version..."
chmod +x scripts/get_7zz.sh
VERSION=$(./scripts/get_7zz.sh --get-current)
echo "Configured version: $VERSION"
VERSION_FOR_ASSET=$(echo "$VERSION" | sed 's/\.//g') # e.g., 25.01 -> 2501
# Map platform to 7zz release naming (same logic as release.yml)
if [[ "${{ runner.os }}" == "Windows" ]]; then
ASSET_NAME="7z${VERSION_FOR_ASSET}-x64.exe"
BINARY_NAME="7zz.exe"
elif [[ "${{ runner.os }}" == "macOS" ]]; then
ASSET_NAME="7z${VERSION_FOR_ASSET}-mac.tar.xz"
BINARY_NAME="7zz"
else
ASSET_NAME="7z${VERSION_FOR_ASSET}-linux-x64.tar.xz"
BINARY_NAME="7zz"
fi
DOWNLOAD_URL="https://github.com/ip7z/7zip/releases/download/${VERSION}/${ASSET_NAME}"
echo "Downloading from: $DOWNLOAD_URL"
TEMP_DIR=$(mktemp -d)
curl -L -o "${TEMP_DIR}/${ASSET_NAME}" "$DOWNLOAD_URL"
if [[ "${{ runner.os }}" == "Windows" ]]; then
# Windows installer - extract CLI components (same logic as release.yml)
echo "Downloading installer and extracting CLI components..."
echo "URL: $DOWNLOAD_URL"
# Create binary directory for testing
mkdir -p "py7zz/bin"
# GitHub Runner has built-in 7z.exe for extraction
7z x "${TEMP_DIR}/${ASSET_NAME}" -o"${TEMP_DIR}/out" > /dev/null
# Extract complete CLI with DLL for full format support (7z.exe + 7z.dll)
if [[ -f "${TEMP_DIR}/out/7z.exe" ]] && [[ -f "${TEMP_DIR}/out/7z.dll" ]]; then
# Rename 7z.exe to 7zz.exe for cross-platform consistency
cp "${TEMP_DIR}/out/7z.exe" "py7zz/bin/${BINARY_NAME}"
cp "${TEMP_DIR}/out/7z.dll" "py7zz/bin/"
echo "Windows CLI components (7z.exe + 7z.dll) extracted and copied successfully"
else
echo "Error: 7z.exe or 7z.dll not found in extracted files"
echo "Contents of extracted directory:"
ls -la "${TEMP_DIR}/out/"
exit 1
fi
else
# Unix tar.xz file (same logic as release.yml)
echo "Downloading and extracting Unix binary..."
echo "URL: $DOWNLOAD_URL"
# Create binary directory for testing
mkdir -p "py7zz/bin"
cd "${TEMP_DIR}"
tar -xf "${ASSET_NAME}"
# Find and copy the 7zz binary (search only in current extraction directory)
BINARY_PATH=$(find . -name "7zz" -type f | head -1)
if [ -n "$BINARY_PATH" ]; then
cp "$BINARY_PATH" "$GITHUB_WORKSPACE/py7zz/bin/${BINARY_NAME}"
echo "Binary found and copied: $BINARY_PATH -> py7zz/bin/${BINARY_NAME}"
# Return to workspace directory to set permissions
cd "$GITHUB_WORKSPACE"
# Make binary executable for Unix systems
if [[ "${{ runner.os }}" != "Windows" ]]; then
chmod +x "py7zz/bin/${BINARY_NAME}"
echo "Set executable permissions for Unix binary"
fi
else
echo "Error: 7zz binary not found in extracted files"
echo "Contents of extracted directory:"
ls -la .
exit 1
fi
fi
# Ensure we're in the workspace directory for verification
cd "$GITHUB_WORKSPACE"
# Verify the binary was placed correctly (same logic as release.yml)
echo "Verifying binary placement..."
if [[ -f "py7zz/bin/${BINARY_NAME}" ]]; then
echo "✓ Binary correctly placed at: py7zz/bin/${BINARY_NAME}"
ls -la "py7zz/bin/"
else
echo "✗ Binary not found at expected location: py7zz/bin/${BINARY_NAME}"
echo "Contents of py7zz/bin/:"
find py7zz/bin/ -type f -ls || echo "No files found"
exit 1
fi
# Verify binary works (same logic as release.yml)
echo "Verifying binary functionality..."
BINARY_PATH="py7zz/bin/${BINARY_NAME}"
if [[ "${{ runner.os }}" == "Windows" ]]; then
# Windows binary verification - verify 7zz.exe (from 7z.exe) with 7z.dll works
if "$BINARY_PATH" -h > /dev/null 2>&1; then
echo "✓ Windows binary verification passed - 7zz.exe (from 7z.exe) with full format support"
else
echo "✗ Windows binary cannot run properly"
echo "Binary path: $BINARY_PATH"
echo "Binary exists: $(test -f "$BINARY_PATH" && echo "yes" || echo "no")"
echo "DLL exists: $(test -f "py7zz/bin/7z.dll" && echo "yes" || echo "no")"
echo "Binary size: $(stat -c%s "$BINARY_PATH" 2>/dev/null || stat -f%z "$BINARY_PATH" 2>/dev/null || echo "unknown")"
exit 1
fi
else
# Unix binary verification
if "$BINARY_PATH" --help > /dev/null 2>&1; then
echo "✓ Unix binary verification passed"
else
echo "✗ Unix binary verification failed for: $BINARY_PATH"
exit 1
fi
fi
# Clean up
cd "$GITHUB_WORKSPACE"
rm -rf "${TEMP_DIR}"
- name: Run pytest
shell: bash
run: uv run pytest -v --tb=short
- name: Run mypy
shell: bash
run: uv run mypy .
build-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
enable-cache: true
- name: Set up Python
run: uv python install 3.11
- name: Install build dependencies
run: |
uv sync --dev
uv pip install build
- name: Build wheel and sdist
run: uv run python -m build
- name: Check wheel contents
run: |
WHL=$(ls dist/*.whl | head -n1)
echo "Checking wheel contents: $WHL"
unzip -l "$WHL" | grep -E "(LICENSE|THIRD_PARTY_NOTICES\.md|licenses/7zip-LICENSE\.txt)" || {
echo "❌ Missing required license files in wheel"
echo "Wheel contents:"
unzip -l "$WHL"
exit 1
}
echo "✅ All required license files found in wheel"
- name: Check sdist contents
run: |
SDIST=$(ls dist/*.tar.gz | head -n1)
echo "Checking sdist contents: $SDIST"
tar tzf "$SDIST" | grep -E "(LICENSE|THIRD_PARTY_NOTICES\.md|licenses/7zip-LICENSE\.txt)" || {
echo "❌ Missing required license files in sdist"
echo "Sdist contents:"
tar tzf "$SDIST"
exit 1
}
echo "✅ All required license files found in sdist"
- name: Install and test wheel
run: |
WHL=$(ls dist/*.whl | head -n1)
uv pip install "$WHL"
uv run python -c "import py7zz; print('✅ Wheel installation successful')"
sbom-generation:
runs-on: ubuntu-latest
if: github.event_name == 'release' || github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
enable-cache: true
- name: Set up Python
run: uv python install 3.11
- name: Install SBOM and license tools
run: |
uv sync --dev
uv add --dev cyclonedx-bom pip-licenses
- name: Generate SBOM
run: |
uv run cyclonedx-py environment .venv -o sbom.json --output-format=json
echo "✅ SBOM generated: sbom.json"
- name: Generate dependency licenses report
run: |
uv run pip-licenses --format=markdown > licenses-dependencies.md
echo "✅ Dependency licenses generated: licenses-dependencies.md"
- name: Upload SBOM and licenses as artifacts
uses: actions/upload-artifact@v4
with:
name: compliance-reports
path: |
sbom.json
licenses-dependencies.md
retention-days: 90