Fix Windows CI: remove minimap2 from MSYS2, download separately #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| artifact: yleaf-linux.tar.gz | |
| - os: macos-latest | |
| artifact: yleaf-macos.tar.gz | |
| - os: windows-latest | |
| artifact: yleaf-windows.zip | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # ── Linux / macOS ───────────────────────────────────────────────────── | |
| - name: Set up Miniconda (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| python-version: "3.11" | |
| channels: conda-forge,bioconda,defaults | |
| auto-activate-base: true | |
| activate-environment: '' | |
| - name: Install tools (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| shell: bash -el {0} | |
| run: conda install -y samtools minimap2 bcftools | |
| - name: Install Yleaf + PyInstaller (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| shell: bash -el {0} | |
| run: pip install -e . && pip install pyinstaller | |
| - name: Build (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| shell: bash -el {0} | |
| run: python -m PyInstaller --distpath dist --workpath build --noconfirm pyinstaller_yleaf.spec | |
| - name: Package (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: tar czf ${{ matrix.artifact }} -C dist yleaf | |
| # ── Windows ─────────────────────────────────────────────────────────── | |
| # samtools and bcftools are available in MSYS2 MINGW64. | |
| # minimap2 is not in MSYS2; we try to download a Windows binary from | |
| # the official releases and fall back gracefully if none is available. | |
| - name: Install samtools + bcftools via MSYS2 (Windows) | |
| if: runner.os == 'Windows' | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: false | |
| install: >- | |
| mingw-w64-x86_64-samtools | |
| mingw-w64-x86_64-bcftools | |
| - name: Stage tools and DLLs (Windows) | |
| if: runner.os == 'Windows' | |
| shell: msys2 {0} | |
| run: | | |
| mkdir -p /c/yleaf-tools | |
| for tool in samtools bcftools; do | |
| cp /mingw64/bin/${tool}.exe /c/yleaf-tools/ | |
| ldd /mingw64/bin/${tool}.exe \ | |
| | grep '/mingw64' | awk '{print $3}' \ | |
| | while read f; do cp "$f" /c/yleaf-tools/ 2>/dev/null || true; done | |
| done | |
| echo "Staged $(ls /c/yleaf-tools | wc -l) files" | |
| - name: Download minimap2 Windows binary (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| # Find the most recent minimap2 release that ships a Windows binary | |
| $releases = gh release list --repo lh3/minimap2 --json tagName --limit 10 | ConvertFrom-Json | |
| foreach ($rel in $releases) { | |
| $assets = gh release view $rel.tagName --repo lh3/minimap2 --json assets | ConvertFrom-Json | |
| $winAsset = $assets.assets | Where-Object { $_.name -match 'win' } | Select-Object -First 1 | |
| if ($winAsset) { | |
| Write-Host "Found Windows binary in $($rel.tagName): $($winAsset.name)" | |
| Invoke-WebRequest $winAsset.browserDownloadUrl -OutFile mm2-win.zip | |
| Expand-Archive mm2-win.zip -DestinationPath C:/mm2-tmp | |
| $exe = Get-ChildItem -Recurse C:/mm2-tmp -Filter "minimap2*.exe" | Select-Object -First 1 | |
| if ($exe) { | |
| Copy-Item $exe.FullName "C:/yleaf-tools/minimap2.exe" | |
| Write-Host "minimap2.exe staged" | |
| } | |
| break | |
| } | |
| } | |
| if (-not (Test-Path "C:/yleaf-tools/minimap2.exe")) { | |
| Write-Host "No Windows minimap2 binary found — FASTQ mode unavailable on Windows" | |
| } | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set YLEAF_BUNDLED_TOOLS (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: echo "YLEAF_BUNDLED_TOOLS=C:/yleaf-tools" >> $env:GITHUB_ENV | |
| - name: Set up Python (Windows) | |
| if: runner.os == 'Windows' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Yleaf + PyInstaller (Windows) | |
| if: runner.os == 'Windows' | |
| run: pip install -e . && pip install pyinstaller | |
| - name: Build (Windows) | |
| if: runner.os == 'Windows' | |
| run: python -m PyInstaller --distpath dist --workpath build --noconfirm pyinstaller_yleaf.spec | |
| - name: Package (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: Compress-Archive -Path dist\yleaf -DestinationPath ${{ matrix.artifact }} | |
| # ── Upload ──────────────────────────────────────────────────────────── | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: ${{ matrix.artifact }} | |
| release: | |
| name: Create GitHub Release | |
| needs: build | |
| # Run even if some build jobs failed (e.g. one platform); skip only if all failed | |
| if: ${{ always() && contains(needs.build.result, 'success') }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Generate changelog | |
| run: | | |
| PREV=$(git tag --sort=-v:refname | sed -n '2p') | |
| RANGE="${PREV:+${PREV}..}HEAD" | |
| git log $RANGE --pretty=format:"- %s" \ | |
| | grep -v "Co-Authored-By" > release_notes.txt | |
| cat release_notes.txt | |
| - name: Publish release | |
| run: | | |
| ASSETS="" | |
| [ -f yleaf-linux.tar.gz ] && ASSETS="$ASSETS yleaf-linux.tar.gz" | |
| [ -f yleaf-macos.tar.gz ] && ASSETS="$ASSETS yleaf-macos.tar.gz" | |
| [ -f yleaf-windows.zip ] && ASSETS="$ASSETS yleaf-windows.zip" | |
| gh release create ${{ github.ref_name }} \ | |
| --title "Yleaf ${{ github.ref_name }}" \ | |
| --notes-file release_notes.txt \ | |
| $ASSETS | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |