Skip to content

Commit 75ef420

Browse files
authored
Better way to mark release mode in pyproject & Ability to upload to test-pypi from workflow (#869)
* Better way to mark release mode in pyproject * Accept test_pypi input * Update workflow inputs * Update default values
1 parent 147f067 commit 75ef420

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

.github/workflows/build_wheels.yml

+17-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ on:
1010
# default: "v0.4.0"
1111
upload_to_pypi:
1212
type: boolean
13-
description: Whether the artifacts should be uploaded to PyPI
13+
description: Should upload
1414
required: false
15-
default: false
15+
default: true
16+
test_pypi:
17+
type: boolean
18+
description: Use Test PyPI
19+
required: false
20+
default: true
1621

1722
jobs:
1823
build_wheels:
@@ -71,7 +76,17 @@ jobs:
7176
path: dist
7277

7378
- uses: pypa/gh-action-pypi-publish@release/v1
79+
if: github.event.inputs.test_pypi == 'false'
7480
with:
7581
user: __token__
7682
password: ${{ secrets.PYPI_API_TOKEN }}
7783
verbose: true
84+
85+
- uses: pypa/gh-action-pypi-publish@release/v1
86+
if: github.event.inputs.test_pypi == 'true'
87+
with:
88+
repository-url: https://test.pypi.org/legacy/
89+
user: __token__
90+
password: ${{ secrets.TESTPYPI_API_TOKEN }}
91+
verbose: true
92+

pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ before-all = [
4848
"unzip scip.zip",
4949
"mv scip_install scip"
5050
]
51-
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"}
51+
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"}
5252

5353

5454
[tool.cibuildwheel.macos]
@@ -64,7 +64,7 @@ fi
6464
unzip scip.zip
6565
mv scip_install src/scip
6666
'''
67-
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"}
67+
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"}
6868
repair-wheel-command = [
6969
"delocate-listdeps {wheel}",
7070
"delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}",
@@ -81,5 +81,5 @@ before-all = [
8181
"mv .\\test .\\scip"
8282
]
8383
before-build = "pip install delvewheel"
84-
environment = { SCIPOPTDIR='D:\\a\\PySCIPOpt\\PySCIPOpt\\scip' }
84+
environment = { SCIPOPTDIR='D:\\a\\PySCIPOpt\\PySCIPOpt\\scip', RELEASE="true" }
8585
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}"

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585

8686

8787
on_github_actions = os.getenv('GITHUB_ACTIONS') == 'true'
88-
release_mode = os.getenv('SCIPOPTSUITE_VERSION') is not None
88+
release_mode = os.getenv('RELEASE') == 'true'
8989
compile_with_line_tracing = on_github_actions and not release_mode
9090

9191
extensions = [

tests/test_model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def test_setLogFile_none():
345345
os.remove(log_file_name)
346346

347347
def test_locale():
348-
on_release = os.getenv('SCIPOPTSUITE_VERSION') is not None
348+
on_release = os.getenv('RELEASE') is not None
349349
if on_release:
350350
pytest.skip("Skip this test on release builds")
351351

0 commit comments

Comments
 (0)