Skip to content

Commit

Permalink
Better way to mark release mode in pyproject & Ability to upload to t…
Browse files Browse the repository at this point in the history
…est-pypi from workflow (#869)

* Better way to mark release mode in pyproject

* Accept test_pypi input

* Update workflow inputs

* Update default values
  • Loading branch information
mmghannam authored Jun 22, 2024
1 parent 147f067 commit 75ef420
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ on:
# default: "v0.4.0"
upload_to_pypi:
type: boolean
description: Whether the artifacts should be uploaded to PyPI
description: Should upload
required: false
default: false
default: true
test_pypi:
type: boolean
description: Use Test PyPI
required: false
default: true

jobs:
build_wheels:
Expand Down Expand Up @@ -71,7 +76,17 @@ jobs:
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
if: github.event.inputs.test_pypi == 'false'
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true

- uses: pypa/gh-action-pypi-publish@release/v1
if: github.event.inputs.test_pypi == 'true'
with:
repository-url: https://test.pypi.org/legacy/
user: __token__
password: ${{ secrets.TESTPYPI_API_TOKEN }}
verbose: true

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ before-all = [
"unzip scip.zip",
"mv scip_install scip"
]
environment = { SCIPOPTDIR="$(pwd)/scip", LD_LIBRARY_PATH="$(pwd)/scip/lib:$LD_LIBRARY_PATH", DYLD_LIBRARY_PATH="$(pwd)/scip/lib:$DYLD_LIBRARY_PATH", PATH="$(pwd)/scip/bin:$PATH", PKG_CONFIG_PATH="$(pwd)/scip/lib/pkgconfig:$PKG_CONFIG_PATH"}
environment = { SCIPOPTDIR="$(pwd)/scip", LD_LIBRARY_PATH="$(pwd)/scip/lib:$LD_LIBRARY_PATH", DYLD_LIBRARY_PATH="$(pwd)/scip/lib:$DYLD_LIBRARY_PATH", PATH="$(pwd)/scip/bin:$PATH", PKG_CONFIG_PATH="$(pwd)/scip/lib/pkgconfig:$PKG_CONFIG_PATH", RELEASE="true"}


[tool.cibuildwheel.macos]
Expand All @@ -64,7 +64,7 @@ fi
unzip scip.zip
mv scip_install src/scip
'''
environment = {SCIPOPTDIR="$(pwd)/src/scip", LD_LIBRARY_PATH="$(pwd)/src/scip/lib:LD_LIBRARY_PATH", DYLD_LIBRARY_PATH="$(pwd)/src/scip/lib:$DYLD_LIBRARY_PATH", PATH="$(pwd)/src/scip/bin:$PATH", PKG_CONFIG_PATH="$(pwd)/src/scip/lib/pkgconfig:$PKG_CONFIG_PATH"}
environment = {SCIPOPTDIR="$(pwd)/src/scip", LD_LIBRARY_PATH="$(pwd)/src/scip/lib:LD_LIBRARY_PATH", DYLD_LIBRARY_PATH="$(pwd)/src/scip/lib:$DYLD_LIBRARY_PATH", PATH="$(pwd)/src/scip/bin:$PATH", PKG_CONFIG_PATH="$(pwd)/src/scip/lib/pkgconfig:$PKG_CONFIG_PATH", RELEASE="true"}
repair-wheel-command = [
"delocate-listdeps {wheel}",
"delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}",
Expand All @@ -81,5 +81,5 @@ before-all = [
"mv .\\test .\\scip"
]
before-build = "pip install delvewheel"
environment = { SCIPOPTDIR='D:\\a\\PySCIPOpt\\PySCIPOpt\\scip' }
environment = { SCIPOPTDIR='D:\\a\\PySCIPOpt\\PySCIPOpt\\scip', RELEASE="true" }
repair-wheel-command = "delvewheel repair --add-path c:/bin;c:/lib;c:/bin/src;c:/lib/src;D:/a/PySCIPOpt/PySCIPOpt/scip/;D:/a/PySCIPOpt/PySCIPOpt/scip/lib/;D:/a/PySCIPOpt/PySCIPOpt/scip/bin/ -w {dest_dir} {wheel}"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@


on_github_actions = os.getenv('GITHUB_ACTIONS') == 'true'
release_mode = os.getenv('SCIPOPTSUITE_VERSION') is not None
release_mode = os.getenv('RELEASE') == 'true'
compile_with_line_tracing = on_github_actions and not release_mode

extensions = [
Expand Down
2 changes: 1 addition & 1 deletion tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def test_setLogFile_none():
os.remove(log_file_name)

def test_locale():
on_release = os.getenv('SCIPOPTSUITE_VERSION') is not None
on_release = os.getenv('RELEASE') is not None
if on_release:
pytest.skip("Skip this test on release builds")

Expand Down

0 comments on commit 75ef420

Please sign in to comment.