Skip to content

Commit 7879951

Browse files
committed
refactor: use Makefile targets instead of inline bash in workflow
Added new Makefile targets: - build-with-version: Build with explicit VERSION without regenerating pyproject.toml - test-install-only: Test installation without rebuilding This follows the project pattern of using Makefile targets instead of inline bash code in workflows.
1 parent 91f6e8e commit 7879951

2 files changed

Lines changed: 22 additions & 14 deletions

File tree

.github/workflows/dev-pypi.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,26 +85,14 @@ jobs:
8585
with:
8686
cache-key: deps-${{ needs.get-config.outputs.default-python-version }}-${{ hashFiles('.project.yml', 'pyproject.toml', 'requirements*.txt') }}
8787
fail-on-cache-miss: false
88-
- name: Update version in pyproject.toml
89-
run: |
90-
# Update version in pyproject.toml for dev builds
91-
sed -i "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
92-
echo "Updated pyproject.toml version to: $VERSION"
93-
grep "^version = " pyproject.toml
9488

9589
- name: Build package
9690
run: |
97-
# Skip generate-pyproject since we already updated version
98-
VERSION=$VERSION BUILD_ARGS="$(BUILD_ARGS)" ./dev-tools/package/build.sh
91+
make build-with-version
9992
10093
- name: Check package
10194
run: |
102-
# Test installation without rebuilding
103-
echo "Testing package installation in clean environment..."
104-
python -m venv /tmp/test-install-env
105-
/tmp/test-install-env/bin/pip install dist/*.whl
106-
/tmp/test-install-env/bin/python -c "import orb_py; print('Package installed successfully')"
107-
rm -rf /tmp/test-install-env
95+
make test-install-only
10896
10997
- name: Publish to Test PyPI
11098
uses: pypa/gh-action-pypi-publish@release/v1

makefiles/deploy.mk

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ build: clean dev-install ## Build package
6565
VERSION=$${VERSION:-$$(make -s get-version)} $(MAKE) generate-pyproject && \
6666
VERSION=$${VERSION:-$$(make -s get-version)} BUILD_ARGS="$(BUILD_ARGS)" ./dev-tools/package/build.sh
6767

68+
build-with-version: clean dev-install ## Build package with explicit version (skips generate-pyproject)
69+
@if [ -z "$$VERSION" ]; then \
70+
echo "ERROR: VERSION environment variable must be set"; \
71+
exit 1; \
72+
fi
73+
@echo "Updating pyproject.toml version to: $$VERSION"
74+
@sed -i.bak "s/^version = .*/version = \"$$VERSION\"/" pyproject.toml && rm -f pyproject.toml.bak
75+
@BUILD_ARGS="$(BUILD_ARGS)" ./dev-tools/package/build.sh
76+
6877
semantic-release-build: ## Build package for semantic-release (minimal dependencies)
6978
./dev-tools/package/build.sh
7079

@@ -80,6 +89,17 @@ test-install: build ## Test package installation in clean environment
8089
/tmp/test-install-env/bin/python -c "import $(PYTHON_MODULE); print('Package installed successfully')"
8190
rm -rf /tmp/test-install-env
8291

92+
test-install-only: ## Test package installation without rebuilding
93+
@echo "Testing package installation in clean environment..."
94+
@if [ ! -f dist/*.whl ]; then \
95+
echo "ERROR: No wheel file found in dist/. Run 'make build' first."; \
96+
exit 1; \
97+
fi
98+
python -m venv /tmp/test-install-env
99+
/tmp/test-install-env/bin/pip install dist/*.whl
100+
/tmp/test-install-env/bin/python -c "import $(PYTHON_MODULE); print('Package installed successfully')"
101+
rm -rf /tmp/test-install-env
102+
83103
# @SECTION Release Management
84104
release: dev-install ## Unified release command (forward/historical/analysis)
85105
@./dev-tools/release/release_dispatcher.py $(filter-out $@,$(MAKECMDGOALS))

0 commit comments

Comments
 (0)