-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rattler-build recipe for Zig-built conda-launchers (#7)
Co-authored-by: jaimergp <[email protected]>
- Loading branch information
Showing
9 changed files
with
478 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
jobs: | ||
build_recipe: | ||
conda_build_recipe: | ||
name: Build conda recipe (${{ matrix.subdir }}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
|
@@ -80,3 +80,45 @@ jobs: | |
echo "Use this command to try out the build:" | ||
echo " conda install -c ${ANACONDA_ORG_CHANNEL}/label/${ANACONDA_ORG_LABEL} conda-launchers" | ||
rattler_build_recipe: | ||
name: Rattler build recipe | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Setup Pixi | ||
uses: prefix-dev/[email protected] | ||
with: | ||
cache: true | ||
|
||
- name: Run Build | ||
shell: pwsh | ||
run: pixi run build | ||
|
||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: conda-launchers-zig-builds | ||
path: | | ||
./output/noarch/conda-launchers*.conda | ||
- name: Upload to Anaconda | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
env: | ||
ANACONDA_OWNER: conda-canary | ||
ANACONDA_CHANNEL: conda-launchers-zig_dev | ||
ANACONDA_API_KEY: ${{ secrets.ANACONDA_ORG_CONDA_CANARY_TOKEN }} | ||
shell: pwsh | ||
run: | | ||
if (-not $env:ANACONDA_API_KEY -or $env:ANACONDA_API_KEY -eq '') { | ||
Write-Error "ANACONDA_API_KEY is not set." | ||
exit 1 | ||
} | ||
foreach ($file in Get-ChildItem -Path "./output/noarch/conda-launchers*.conda") { | ||
Write-Host "Uploading $($file.Name)" | ||
pixi run upload "$file" | ||
} |
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[project] | ||
name = "conda-launchers" | ||
version = "0.0.0" | ||
description = "Conda launchers for Windows" | ||
channels = ["conda-forge"] | ||
platforms = ["win-64"] | ||
license = "BSD-3-Clause" | ||
|
||
[tasks] | ||
build = "rattler-build build --recipe recipe-zig --log-style plain --skip-existing all -c conda-forge" | ||
upload = "rattler-build upload anaconda --log-style plain" | ||
|
||
[dependencies] | ||
rattler-build = ">=0.29.0,<0.30" | ||
|
||
[target.win-64.dependencies] | ||
m2-patch = ">=2.7.6.2,<3" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
setlocal EnableDelayedExpansion | ||
|
||
@rem no-op for conda-launchers metapackage | ||
if %PKG_NAME% == conda-launchers (exit 0) | ||
|
||
@rem rename patched source file to be used for building | ||
move /Y launcher.c.orig launcher.c | ||
|
||
if %PKG_NAME% == conda-launchers_win-32 ( | ||
set ZIG_TARGET=x86-windows-gnu | ||
set EXE_TARGET=32 | ||
) | ||
|
||
if %PKG_NAME% == conda-launchers_win-64 ( | ||
set ZIG_TARGET=x86_64-windows-gnu | ||
set EXE_TARGET=64 | ||
) | ||
|
||
if %PKG_NAME% == conda-launchers_win-arm64 ( | ||
set ZIG_TARGET=aarch64-windows-gnu | ||
set EXE_TARGET=arm64 | ||
) | ||
|
||
@rem build cli launcher | ||
zig build -Doptimize=ReleaseSmall -Dtarget=%ZIG_TARGET% -Dgui=false --prefix-exe-dir "%PREFIX%\Scripts" | ||
if %ERRORLEVEL% neq 0 exit 1 | ||
|
||
@rem build gui launcher | ||
zig build -Doptimize=ReleaseSmall -Dtarget=%ZIG_TARGET% -Dgui=true --prefix-exe-dir "%PREFIX%\Scripts" | ||
if %ERRORLEVEL% neq 0 exit 1 | ||
|
||
@rem install launcher scripts | ||
cd "%PREFIX%\Scripts" | ||
( | ||
echo print^("cli-%EXE_TARGET%.exe successfully launched the accompanying Python script"^) | ||
)> "cli-%EXE_TARGET%-script.py" | ||
|
||
if %ERRORLEVEL% neq 0 exit 1 | ||
|
||
( | ||
echo import tkinter as tk | ||
echo root = tk.Tk^(^) | ||
echo text = tk.Label^(root, text ="Hello and Bye!"^) | ||
echo text.pack^(^) | ||
echo root.geometry^("150x100"^) | ||
echo root.after^(1000, lambda: root.destroy^(^)^) | ||
echo root.mainloop^(^) | ||
)> "gui-%EXE_TARGET%-script.pyw" | ||
|
||
if %ERRORLEVEL% neq 0 exit 1 |
Oops, something went wrong.