Skip to content

Commit

Permalink
Merge branch 'main' into bump-ipython_8.30.0_to_8.31.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DerThorsten authored Jan 20, 2025
2 parents 84837a2 + 799a3b3 commit 85b5d27
Show file tree
Hide file tree
Showing 65 changed files with 3,486 additions and 478 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/new_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ on:

jobs:
update_versions:
strategy:
matrix:
branch: [main, emscripten-3.1.73]


if: (github.event_name == 'schedule' && github.repository == 'emscripten-forge/recipes') || (github.event_name != 'schedule')
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
ref: main

- name: Install micromamba
uses: mamba-org/setup-micromamba@v1
Expand All @@ -19,6 +26,6 @@ jobs:

- name: Determine new package version and open/merge PRs
shell: bash -l -eo pipefail {0}
run: python -m emci bot bump-recipes-versions
run: python -m emci bot bump-recipes-versions ${{ matrix.branch }}
env:
GITHUB_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }}
2 changes: 1 addition & 1 deletion docs/development/adding_packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@ requirements:
**Example recipes**:

* [cryptography](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/cryptography)
* [pydantic-core](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/cryptography)
* [pydantic-core](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/pydantic-core)
* [pycrdt](https://github.com/emscripten-forge/recipes/tree/main/recipes/recipes_emscripten/pycrdt)
4 changes: 2 additions & 2 deletions emci/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ def changed(


@bot_app.command()
def bump_recipes_versions():
def bump_recipes_versions(target_branch_name: str):
from .bot.bump_recipes_versions import bump_recipe_versions

bump_recipe_versions(RECIPES_EMSCRIPTEN_DIR)
bump_recipe_versions(RECIPES_EMSCRIPTEN_DIR, target_branch_name)

if __name__ == "__main__":
app()
72 changes: 55 additions & 17 deletions emci/bot/bump_recipes_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .next_version import next_version
from .url_exists import url_exists
from .hash_url import hash_url
from ..git_utils import bot_github_user_ctx, git_branch_ctx, make_pr_for_recipe, automerge_is_enabled,set_bot_user
from ..git_utils import bot_github_user_ctx, git_branch_ctx, make_pr_for_recipe, automerge_is_enabled,set_bot_user,get_current_branch_name
import sys
import json

Expand Down Expand Up @@ -110,10 +110,13 @@ def update_recipe_version(recipe_file, new_version, new_sha256, is_ratler):
with open(recipe_file, 'w') as file:
YAML().dump(recipe, file)

def make_pr_title(name, old_version, new_version):
return f"Update {name} from {old_version} to {new_version}"
def make_pr_title(name, old_version, new_version, target_pr_branch_name):
if target_pr_branch_name == "main":
return f"Update {name} from {old_version} to {new_version}"
else:
return f"Update {name} from {old_version} to {new_version} [{target_pr_branch_name}]"

def bump_recipe_version(recipe_dir):
def bump_recipe_version(recipe_dir, target_pr_branch_name):

recipe_locations = [ ("recipe.yaml", True)]

Expand Down Expand Up @@ -150,7 +153,7 @@ def bump_recipe_version(recipe_dir):
automerge = True


branch_name = f"bump-{name}_{current_version}_to_{new_version}"
branch_name = f"bump-{name}_{current_version}_to_{new_version}_for_{target_pr_branch_name}"


with git_branch_ctx(branch_name, stash_current=False):
Expand All @@ -162,9 +165,11 @@ def bump_recipe_version(recipe_dir):
update_recipe_version(recipe_file, new_version=new_version, new_sha256=new_sha256, is_ratler=is_rattler)

# commit the changes and make a PR
pr_title = make_pr_title(name, current_version, new_version)
print(f"Making PR for {name} with title: {pr_title}")
make_pr_for_recipe(recipe_dir=recipe_dir, pr_title=pr_title, branch_name=branch_name, automerge=automerge)
pr_title = make_pr_title(name, current_version, new_version, target_pr_branch_name)
print(f"Making PR for {name} with title: {pr_title} with target branch {target_pr_branch_name}")
make_pr_for_recipe(recipe_dir=recipe_dir, pr_title=pr_title, branch_name=branch_name,
target_branch_name=target_pr_branch_name,
automerge=automerge)

return True , current_version, new_version

Expand Down Expand Up @@ -224,8 +229,8 @@ def user_ctx(user, email, bypass=False):
subprocess.check_output(['git', 'config', '--unset', 'user.email'])


def bump_recipe_versions(recipe_dir, use_bot=True, pr_limit=10):

def bump_recipe_versions(recipe_dir, pr_target_branch, use_bot=True, pr_limit=20):
print(f"Bumping recipes in {recipe_dir} to {pr_target_branch}")
# empty context manager
@contextlib.contextmanager
def empty_context_manager():
Expand All @@ -247,12 +252,40 @@ def empty_context_manager():

# get all opened PRs
with user_ctx():

current_branch_name = get_current_branch_name()
if current_branch_name == pr_target_branch:
print(f"Already on target branch {pr_target_branch}")
else:
print(f"swichting from {current_branch_name} to {pr_target_branch}")
# switch to the target branch
subprocess.run(['git', 'stash'], check=False)
print(f"fetch {pr_target_branch}")
subprocess.check_output(['git', 'fetch', 'origin', pr_target_branch])
print(f"checkout {pr_target_branch}")
subprocess.check_output(['git', 'checkout', pr_target_branch])
print("checkout done")

assert get_current_branch_name() == pr_target_branch
current_branch_name = pr_target_branch

# Check for opened PRs and merge them if the CI passed
print("Checking opened PRs and merge them if green!")
prs = subprocess.check_output(
all_prs = subprocess.check_output(
['gh', 'pr', 'list', '--author', 'emscripten-forge-bot'],
).decode('utf-8').split('\n')
prs = []
for pr_line in all_prs:
if not pr_line:
continue
pr_id = pr_line.split()[0]
that_pr_target_branch = subprocess.check_output(
['gh', 'pr', 'view', pr_id, '--json', 'baseRefName', '-q', '.baseRefName']
).decode('utf-8').strip()
if that_pr_target_branch == pr_target_branch:
prs.append(pr_line)
else:
print(f"PR {pr_id} is not targeting {pr_target_branch} [but {that_pr_target_branch}], skipping it")

all_recipes = [recipe for recipe in Path(recipe_dir).iterdir() if recipe.is_dir()]
# map from folder names to recipe-dir
Expand All @@ -262,11 +295,16 @@ def empty_context_manager():
prs_id = [line.split()[0] for line in prs if line]
prs_packages = [line.split()[2] for line in prs if line]

# Merge PRs if possible
for pr,pr_pkg in zip(prs_id, prs_packages):
# get the recipe dir
recipe_dir = recipe_name_to_recipe_dir.get(pr_pkg)
try_to_merge_pr(pr, recipe_dir=recipe_dir)
# Merge PRs if possible (only for main atm)
if pr_target_branch == "main":
for pr,pr_pkg in zip(prs_id, prs_packages):
# get the recipe dir
recipe_dir = recipe_name_to_recipe_dir.get(pr_pkg)

try:
try_to_merge_pr(pr, recipe_dir=recipe_dir)
except Exception as e:
print(f"Error in {pr}: {e}")

# only recipes for which there is no opened PR
all_recipes = [recipe for recipe in all_recipes if recipe.name not in prs_packages]
Expand All @@ -282,7 +320,7 @@ def empty_context_manager():
total_bumped = 0
for recipe in all_recipes:
try:
bumped_version, old_version, new_version = bump_recipe_version(recipe)
bumped_version, old_version, new_version = bump_recipe_version(recipe, pr_target_branch)
if bumped_version:
print(f"Bumped {recipe} from {old_version} to {new_version}")
total_bumped += int(bumped_version)
Expand Down
26 changes: 18 additions & 8 deletions emci/git_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def automerge_is_enabled(pr):



def make_pr_for_recipe(recipe_dir, pr_title, branch_name, automerge):
def make_pr_for_recipe(recipe_dir, pr_title, target_branch_name, branch_name, automerge):

# git commit
subprocess.check_output(['git', 'add', recipe_dir])
Expand All @@ -108,11 +108,21 @@ def make_pr_for_recipe(recipe_dir, pr_title, branch_name, automerge):
# gh set default repo
subprocess.check_call(['gh', 'repo', 'set-default', 'emscripten-forge/recipes'], cwd=os.getcwd())


args = ['gh', 'pr', 'create',
'-B', target_branch_name,
'--title', pr_title, '--body', 'Beep-boop-beep! Whistle-whistle-woo!',
'--label', 'Automerge' if automerge else 'Needs Tests'
]
if target_branch_name == 'main':
extra_label = "3.1.45"
elif target_branch_name == "emscripten-3.1.73":
extra_label = "3.1.73"
else:
extra_label = None

if extra_label is not None:
args.extend(['--label', extra_label])

# call gh to create a PR
subprocess.check_call([
'gh', 'pr', 'create',
'-B', 'main',
'--title', pr_title,
'--body', 'Beep-boop-beep! Whistle-whistle-woo!',
'--label', 'Automerge' if automerge else 'Needs Tests'
], cwd=os.getcwd())
subprocess.check_call(args, cwd=os.getcwd())
4 changes: 2 additions & 2 deletions recipes/recipes/cross-python_emscripten-wasm32/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package:
version: ${{ version }}

build:
number: 10
number: 11

requirements:

Expand All @@ -17,7 +17,7 @@ requirements:
- emscripten_emscripten-wasm32
- rsync
- sed
- python 3.11
- python ==3.11
- setuptools #<60.0
- pip

Expand Down
9 changes: 7 additions & 2 deletions recipes/recipes/emscripten_emscripten-wasm32/activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ if [ -z ${CONDA_FORGE_EMSCRIPTEN_ACTIVATED+x} ]; then

export CONDA_FORGE_EMSCRIPTEN_ACTIVATED=1

export EMSDK_PYTHON=${BUILD_PREFIX}/bin/python3
export PYTHON=${BUILD_PREFIX}/bin/python3
if [ -z ${BUILD_PREFIX+x} ]; then
export EMSDK_PYTHON=${CONDA_PREFIX}/bin/python3
export PYTHON=${CONDA_PREFIX}/bin/python3
else
export EMSDK_PYTHON=${BUILD_PREFIX}/bin/python3
export PYTHON=${BUILD_PREFIX}/bin/python3
fi

CONDA_EMSDK_DIR=$CONDA_PREFIX/opt/emsdk

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,11 @@ for file in $PREFIX/opt/emsdk/upstream/emscripten/*; do
echo "Linking $file"
ln -sf $file $PREFIX/bin/
fi

# Check if the ends with .py
if [[ $file == *.py ]]; then
# Create a symbolic link in the $PREFIX/bin directory
echo "Linking $file"
ln -sf $file $PREFIX/bin/
fi
done
11 changes: 10 additions & 1 deletion recipes/recipes/emscripten_emscripten-wasm32/deactivate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@
unset cmake

unset CONDA_FORGE_EMSCRIPTEN_ACTIVATED
unset EMSDK_PYTHON
unset PYTHON
unset CONDA_EMSDK_DIR
unset CC
unset CXX
unset AR
unset RANLIB
unset CMAKE_ARGS
unset PY_SIDE_LD_FLAGV
unset EM_FORGE_OPTFLAGS
unset EM_FORGE_DBGFLAGS
unset EM_FORGE_LDFLAGS_BASE
unset EM_FORGE_CFLAGS_BASE
unset EM_FORGE_SIDE_MODULE_LDFLAGS
unset EM_FORGE_SIDE_MODULE_CFLAGS
unset EM_FORGE_SIDE_MODULE_CFLAGS
unset LDFLAGS
5 changes: 3 additions & 2 deletions recipes/recipes/emscripten_emscripten-wasm32/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ context:
version: 3.1.45

build:
number: 30
number: 33

outputs:
- package:
Expand All @@ -28,7 +28,8 @@ outputs:
- python
- nodejs 16.*
run_exports:
- ${{ pin_subpackage('emscripten-abi', lower_bound='x.x.x', upper_bound='x.x.x') }}
strong:
- ${{ pin_subpackage('emscripten-abi', lower_bound='x.x.x', upper_bound='x.x.x') }}

- package:
name: emscripten-abi
Expand Down
6 changes: 3 additions & 3 deletions recipes/recipes/rust/activate-rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export PATH=$CARGO_HOME/bin:$PATH
# if $CARO_HOME does not exist, install rustup
if [ ! -d "$CARGO_HOME" ]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y #--default-toolchain=1.78.0
rustup install nightly-2024-04-22
rustup default nightly-2024-04-22
rustup install nightly-2025-01-09
rustup default nightly-2025-01-09
rustup target add wasm32-unknown-emscripten
fi

Expand All @@ -33,4 +33,4 @@ export PYO3_CROSS_INCLUDE_DIR=$PREFIX/include
export PYO3_PYTHON=python

export CARGO_BUILD_TARGET="wasm32-unknown-emscripten"
export LDFLAGS="$LDFLAGS -L${PREFIX}/lib"
export LDFLAGS="$LDFLAGS -L${PREFIX}/lib"
6 changes: 3 additions & 3 deletions recipes/recipes/rust/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export CARGO_HOME=$HOME/.cargo_emscripten_forge
export PATH=$CARGO_HOME/bin:$PATH

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y #--default-toolchain=1.78.0
rustup install nightly-2024-04-22
rustup default nightly-2024-04-22
rustup target add wasm32-unknown-emscripten
rustup install nightly-2025-01-09
rustup default nightly-2025-01-09
rustup target add wasm32-unknown-emscripten
4 changes: 2 additions & 2 deletions recipes/recipes/rust/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
context:
name: rust
version: "1.79.0"
version: "1.86.0"

package:
name: ${{ name|lower }}
version: ${{ version }}


build:
number: 32
number: 0

requirements:
build:
Expand Down
4 changes: 2 additions & 2 deletions recipes/recipes_emscripten/cairo/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ source:
sha256: 243a0736b978a33dee29f9cca7521733b78a65b5418206fef7bd1c3d4cf10b64

build:
number: 2
number: 3

requirements:
build:
Expand Down Expand Up @@ -55,4 +55,4 @@ about:
extra:
recipe-maintainers:
- IsabelParedes
- anutosh491
- anutosh491
13 changes: 5 additions & 8 deletions recipes/recipes_emscripten/cppinterop/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX

# Configure step
emcmake cmake -DCMAKE_BUILD_TYPE=Release \
-DUSE_CLING=OFF \
-DUSE_REPL=ON \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DLLVM_DIR=$PREFIX \
-DLLD_DIR=$PREFIX \
-DClang_DIR=$PREFIX \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DLLVM_DIR=$PREFIX/lib/cmake/llvm \
-DLLD_DIR=$PREFIX/lib/cmake/lld \
-DClang_DIR=$PREFIX/lib/cmake/clang \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
../

# Build step
Expand Down
Loading

0 comments on commit 85b5d27

Please sign in to comment.