Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enable all publishing steps in CI/CD workflow #166

Enable all publishing steps in CI/CD workflow

Enable all publishing steps in CI/CD workflow #166

name: Release Pipeline
on:
push:
tags:
- 'patch'
- 'minor'
- 'major'
permissions:
contents: write
actions: read
jobs:
# Version bump job
prepare-release:
runs-on: ubuntu-latest
outputs:
release_type: ${{ github.ref_name }}
new_version: ${{ steps.bump.outputs.new_version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Get current version and bump
id: bump
run: python ./.github/scripts/version_bump.py ${{ github.ref_name }}
- name: Commit version bump and create release tag
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add pyproject.toml
git commit -m "🔖 Bump version to ${{ steps.bump.outputs.new_version }}"
git tag v${{ steps.bump.outputs.new_version }}
git push origin HEAD:main
git push origin v${{ steps.bump.outputs.new_version }}
- name: Delete trigger tag
run: |
# Delete the original trigger tag to keep repo clean
git push --delete origin ${{ github.ref_name }}
# Second job: Build binaries (depends on prepare-release success)
build:
needs: prepare-release
strategy:
matrix:
include:
- name: "Linux amd64"
os: ubuntu-latest
arch: x86_64
arch_bin_ext: linux-x86_64
runner: ubuntu-latest
os_name: linux
- name: "Linux arm64"
os: ubuntu-24.04-arm
arch: aarch64
arch_bin_ext: linux-aarch64
runner: ubuntu-24.04-arm
os_name: linux
- name: "macOS Universal"
os: macos-latest
arch: universal
arch_bin_ext: macos-universal
runner: macos-latest
os_name: macos
- name: "Windows amd64"
os: windows-latest
arch: amd64
arch_bin_ext: windows-x86_64.exe
runner: windows-latest
os_name: windows
# Windows ARM64 temporarily disabled due to psutil build issues
# - name: "Windows arm64"
# os: windows-11-arm
# arch: arm64
# arch_bin_ext: windows-arm64.exe
# runner: windows-11-arm
# os_name: windows
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main # Get the updated version
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install dependencies
run: |
echo "======================="
echo "Install Python packages"
echo "======================="
uv sync
echo "======================="
echo "List Python packages"
echo "======================="
uv pip list
echo "======================="
echo "Check Nuitka version"
echo "======================="
uv run python -m nuitka --version
- name: Setup MSVC (Windows)
if: matrix.os_name == 'windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Build binary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: uv run python .github/scripts/build_nuitka.py
- name: Test binary (Unix)
if: matrix.os_name != 'windows'
run: ./.github/scripts/test_binary.sh ${{ needs.prepare-release.outputs.new_version }} ${{ matrix.arch_bin_ext }}
- name: Test binary (Windows)
if: matrix.os_name == 'windows'
shell: pwsh
run: .\.github\scripts\test_binary.ps1 -Version ${{ needs.prepare-release.outputs.new_version }} -ArchBinExt ${{ matrix.arch_bin_ext }}
- name: Install system dependencies for integration tests (macOS)
if: matrix.os_name == 'macos'
run: |
brew install exiftool tree
- name: Install system dependencies for integration tests (Linux)
if: matrix.os_name == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y exiftool tree
- name: Install system dependencies for integration tests (Windows)
if: matrix.os_name == 'windows'
shell: pwsh
run: |
choco install exiftool tree -y
# DNGLab will be downloaded and bundled during Nuitka build process
- name: Run integration tests (Unix)
# Run integration tests on macOS (DNGLab bundled) and Linux (DNGLab bundled)
if: matrix.os_name == 'macos' || matrix.os_name == 'linux'
env:
EIR_BINARY_PATH: ./dist/eir-${{ needs.prepare-release.outputs.new_version }}-${{ matrix.arch_bin_ext }}
run: |
uv run pytest tests/integration/ -v -s
echo ""
echo "Integration test verification completed successfully!"
echo "All integration tests passed with real directory structures shown above"
echo "Test coverage included:"
echo " - Single date directories (Canon, Sony, iPhone, etc.)"
echo " - Date range mixed directories"
echo " - Camera brand organization verification"
echo " - File type processing (RAW + compressed formats)"
echo "DNG conversion tool: DNGLab (bundled via Nuitka)"
echo "Test workspace: Temporary directories (auto-cleanup enabled)"
- name: Run integration tests (Windows)
# Run integration tests on Windows with DNGLab bundled
if: matrix.os_name == 'windows'
env:
EIR_BINARY_PATH: ./dist/eir-${{ needs.prepare-release.outputs.new_version }}-${{ matrix.arch_bin_ext }}
shell: pwsh
run: |
uv run pytest tests/integration/ -v -s
Write-Host ""
Write-Host "Integration test verification completed successfully!" -ForegroundColor Green
Write-Host "All integration tests passed with real directory structures shown above" -ForegroundColor Green
Write-Host "Test coverage included:" -ForegroundColor Cyan
Write-Host " - Single date directories (Canon, Sony, iPhone, etc.)" -ForegroundColor White
Write-Host " - Date range mixed directories" -ForegroundColor White
Write-Host " - Camera brand organization verification" -ForegroundColor White
Write-Host " - File type processing (RAW + compressed formats)" -ForegroundColor White
Write-Host "DNG conversion tool: DNGLab (bundled via Nuitka)" -ForegroundColor Yellow
Write-Host "Test workspace: Temporary directories (auto-cleanup enabled)" -ForegroundColor Yellow
- name: Install APT tools
if: matrix.os_name == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y dpkg-dev
- name: Build packages
env:
OS_NAME: ${{ matrix.os_name }}
ARCH: ${{ matrix.arch }}
run: uv run python .github/scripts/package_build.py
- name: Test Chocolatey package
if: matrix.os_name == 'windows'
env:
OS_NAME: ${{ matrix.os_name }}
ARCH: ${{ matrix.arch }}
run: .\.github\scripts\test_chocolatey_package.ps1 -Version ${{ needs.prepare-release.outputs.new_version }}
shell: pwsh
- name: Test APT package
if: matrix.os_name == 'linux'
env:
OS_NAME: ${{ matrix.os_name }}
ARCH: ${{ matrix.arch }}
run: ./.github/scripts/test_apt_package.sh ${{ needs.prepare-release.outputs.new_version }}
- name: Test Homebrew package
if: matrix.os_name == 'macos'
env:
OS_NAME: ${{ matrix.os_name }}
ARCH: ${{ matrix.arch }}
run: ./.github/scripts/test_homebrew_package.sh ${{ needs.prepare-release.outputs.new_version }}
- name: Upload binary artifacts
uses: actions/upload-artifact@v4
with:
name: eir-${{ needs.prepare-release.outputs.new_version }}-${{ matrix.arch }}
retention-days: 60
path: |
dist/eir-*
!dist/*.spec
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: eir-${{ needs.prepare-release.outputs.new_version }}-${{ matrix.os_name }}-${{ matrix.arch }}
retention-days: 30
path: |
packages-${{ matrix.os_name }}-${{ matrix.arch }}/*
# Third job: Create GitHub release and publish to package managers
release-and-publish:
needs: [prepare-release, build]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Prepare release assets and body
run: ./.github/scripts/create_github_release.sh ${{ needs.prepare-release.outputs.new_version }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.prepare-release.outputs.new_version }}
name: "Eir ${{ needs.prepare-release.outputs.new_version }}"
body_path: ./release_body.md
files: ./release-assets/*
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Organize packages
run: ./.github/scripts/organize_packages.sh
- name: Publish to Homebrew
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_TOKEN || secrets.GITHUB_TOKEN }}
run: ./.github/scripts/publish_homebrew.sh ${{ needs.prepare-release.outputs.new_version }}
- name: Publish to APT
run: ./.github/scripts/publish_apt.sh ${{ needs.prepare-release.outputs.new_version }}
- name: Publish to Chocolatey
env:
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
run: ./.github/scripts/publish_chocolatey.sh ${{ needs.prepare-release.outputs.new_version }}