Skip to content

Commit

Permalink
Use a venv when testing pypi release
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 595767400
Change-Id: I15dcc897a957d209c9eb8b91c6d4fffe27a6bdc5
  • Loading branch information
jagapiou authored and Copybara-Service committed Jan 4, 2024
1 parent e18c84b commit 4b7247d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
4 changes: 1 addition & 3 deletions .github/actions/install-meltingpot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ runs:
if: steps.restore.outputs.cache-hit != 'true'
shell: bash
run: |
pip install --upgrade pip
pip install --upgrade virtualenv
virtualenv venv
python -m venv venv
source venv/bin/activate
pip install --editable .[dev]
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,22 @@ jobs:
with:
python-version: '3.11'

- name: Install Python dependencies
- name: Build source distribution
run: |
pip install pip==23.3.1
pip install build==1.0.3
pip install pytest-xdist==3.5.0
pip install setuptools==68.0.0
- name: Build source distribution
run: python -m build --sdist --outdir dist/
python -m build --sdist --outdir dist/
- name: Install from source distribution
- name: Test source distribution
if: github.event_name == 'release' || inputs.test_sdist
run: pip -vvv install dist/*.tar.gz

- name: Test installation
if: github.event_name == 'release' || inputs.test_sdist
run: pytest -n auto -rax --pyargs meltingpot
run: |
VENV="$(mktemp --dry-run)"
python -m venv "${VENV}"
source "${VENV}/bin/activate"
pip install dist/*.tar.gz
pip install pytest-xdist
pytest -n auto -rax --pyargs meltingpot
deactivate
rm -rf "${VENV}"
- name: Publish to TestPyPI
if: github.event_name == 'release' || inputs.upload_to_test_pypi
Expand Down

0 comments on commit 4b7247d

Please sign in to comment.