Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias-Fischer authored Jan 20, 2025
2 parents c5f6987 + 799a3b3 commit 0d68914
Show file tree
Hide file tree
Showing 25 changed files with 636 additions and 55 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 }}
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
2 changes: 1 addition & 1 deletion 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: 31
number: 33

outputs:
- package:
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
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
diff --git a/lib/Interpreter/CMakeLists.txt b/lib/Interpreter/CMakeLists.txt
index 103b331..8d0dd97 100644
index 103b331..0eb356c 100644
--- a/lib/Interpreter/CMakeLists.txt
+++ b/lib/Interpreter/CMakeLists.txt
@@ -17,6 +17,11 @@ if(EMSCRIPTEN)
LINK_LIBS
clangInterpreter
)
@@ -4,18 +4,23 @@ if(EMSCRIPTEN)
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-s SIDE_MODULE=1")
set(CMAKE_STRIP FALSE)

- add_llvm_library(clangCppInterOp
- SHARED
-
+ add_library(clangCppInterOp SHARED
CppInterOp.cpp
CXCppInterOp.cpp
DynamicLibraryManager.cpp
DynamicLibraryManagerSymbol.cpp
Paths.cpp
+ )

- # Additional libraries from Clang and LLD
- LINK_LIBS
- clangInterpreter
+ target_link_libraries(clangCppInterOp clangInterpreter)
+
+ target_link_options(clangCppInterOp PRIVATE
+ PUBLIC "SHELL: -s WASM_BIGINT"
+ PUBLIC "SHELL: -Wl,--export=__clang_Interpreter_SetValueNoAlloc"
+ )
+
+ install(TARGETS clangCppInterOp
+ LIBRARY DESTINATION lib
)
else()
set(LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
2 changes: 1 addition & 1 deletion recipes/recipes_emscripten/cppinterop/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ source:
- patches/__clang_Interpreter_SetValueNoAlloc.patch

build:
number: 1
number: 2

requirements:
build:
Expand Down
4 changes: 2 additions & 2 deletions recipes/recipes_emscripten/fmt/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
context:
name: fmt
version: 11.1.1
version: 11.1.2

package:
name: ${{ name }}
version: ${{ version }}

source:
url: https://github.com/fmtlib/${{ name }}/archive/${{ version }}.tar.gz
sha256: 482eed9efbc98388dbaee5cb5f368be5eca4893456bb358c18b7ff71f835ae43
sha256: d8773cf062cc806d4dd4df658111f15ba7a2c9c65db5084d2491696828b1eb97

build:
number: 0
Expand Down
Loading

0 comments on commit 0d68914

Please sign in to comment.