diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8037428..86c5917 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,7 +45,6 @@ jobs: python-version: "3.14" - uses: astral-sh/setup-uv@v3 - run: uv venv --python 3.14 - - run: uv pip install build - name: Create tag from version run: | VERSION=$(python scripts/get-version.py) @@ -66,6 +65,6 @@ jobs: TAG="v$VERSION" echo "Verifying tag $TAG matches version $VERSION" - name: Build - run: uv run python -m build + run: uv build - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/examples/sandbox_07_ruby_sinatra.py b/examples/sandbox_07_ruby_sinatra.py index 200bd82..168fd7c 100644 --- a/examples/sandbox_07_ruby_sinatra.py +++ b/examples/sandbox_07_ruby_sinatra.py @@ -47,6 +47,12 @@ async def main() -> None: runtime = ( os.getenv("SANDBOX_RUNTIME") or "node22" ) # note: ruby runtime is not supported so we have to install ruby via dnf + bundle_env = { + "BUNDLE_APP_CONFIG": ".bundle", + "BUNDLE_USER_HOME": ".bundle-home", + "BUNDLE_PATH": "vendor/bundle", + "BUNDLE_CACHE_PATH": "vendor/cache", + } # Sinatra default port is 4567 port = 4567 @@ -101,10 +107,13 @@ async def main() -> None: "-lc", ( f"cd {sandbox.sandbox.cwd} && " + "mkdir -p .bundle-home vendor/cache && " "bundle config set --local path vendor/bundle && " + "bundle config set --local cache_path vendor/cache && " "bundle config set --local without 'development:test'" ), ], + env=bundle_env, ) async for line in bundler_cfg_cmd.logs(): print(line.data, end="") @@ -120,6 +129,7 @@ async def main() -> None: "-lc", (f"cd {sandbox.sandbox.cwd} && bundle install --jobs 4 --retry 3"), ], + env=bundle_env, ) async for line in bundle_install_cmd.logs(): print(line.data, end="") @@ -135,9 +145,10 @@ async def main() -> None: ( f"cd {sandbox.sandbox.cwd} && " # Start via rackup using WEBrick, binding to 0.0.0.0 and selected port - f"RACK_ENV=production bundle exec rackup -s webrick -o 0.0.0.0 -p {port}" + f"bundle exec rackup -s webrick -o 0.0.0.0 -p {port}" ), ], + env={**bundle_env, "RACK_ENV": "production"}, ) # Stream logs and open browser once server is ready. diff --git a/examples/sandbox_09_rails_api.py b/examples/sandbox_09_rails_api.py index 6a533cd..19ec3e9 100644 --- a/examples/sandbox_09_rails_api.py +++ b/examples/sandbox_09_rails_api.py @@ -41,6 +41,12 @@ async def main() -> None: runtime = ( os.getenv("SANDBOX_RUNTIME") or "node22" ) # note: ruby runtime is not supported so we install ruby via dnf + bundle_env = { + "BUNDLE_APP_CONFIG": ".bundle", + "BUNDLE_USER_HOME": ".bundle-home", + "BUNDLE_PATH": "vendor/bundle", + "BUNDLE_CACHE_PATH": "vendor/cache", + } # Rails default port is 3000 port = 3000 @@ -104,6 +110,7 @@ async def main() -> None: "--skip-action-cable " "--skip-system-test " "--skip-git " + "--skip-bundle " "--force" ), ], @@ -122,8 +129,14 @@ async def main() -> None: "bash", [ "-lc", - (f"cd {app_path} && bundle config set --local path vendor/bundle"), + ( + f"cd {app_path} && " + "mkdir -p .bundle-home vendor/cache && " + "bundle config set --local path vendor/bundle && " + "bundle config set --local cache_path vendor/cache" + ), ], + env=bundle_env, ) async for line in bundler_cfg_cmd.logs(): print(line.data, end="") @@ -139,6 +152,7 @@ async def main() -> None: "-lc", (f"cd {app_path} && bundle install --jobs 4 --retry 3"), ], + env=bundle_env, ) async for line in bundle_install_cmd.logs(): print(line.data, end="") @@ -157,6 +171,7 @@ async def main() -> None: "bundle exec rails generate scaffold Post title:string body:text" ), ], + env=bundle_env, ) async for line in scaffold_cmd.logs(): print(line.data, end="") @@ -185,6 +200,7 @@ async def main() -> None: "-lc", (f"cd {app_path} && bundle exec rails db:migrate"), ], + env=bundle_env, ) async for line in migrate_cmd.logs(): print(line.data, end="") @@ -200,6 +216,7 @@ async def main() -> None: "-lc", (f"cd {app_path} && bundle exec rails db:seed"), ], + env=bundle_env, ) async for line in seed_cmd.logs(): print(line.data, end="") @@ -216,11 +233,9 @@ async def main() -> None: "bash", [ "-lc", - ( - f"cd {app_path} && " - f"ALLOWED_HOST={allowed_host} bundle exec rails server -b 0.0.0.0 -p {port}" - ), + (f"cd {app_path} && bundle exec rails server -b 0.0.0.0 -p {port}"), ], + env={**bundle_env, "ALLOWED_HOST": allowed_host}, ) # Stream logs and open browser once server is ready. diff --git a/scripts/build.sh b/scripts/build.sh index cab0c02..ccbaf5e 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -euo pipefail -uv run python -m build +uv build